From patchwork Mon May 21 12:15:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 27354 Received: (qmail 60360 invoked by alias); 21 May 2018 12:16:20 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 60144 invoked by uid 89); 21 May 2018 12:16:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_SOFTFAIL, UPPERCASE_50_75 autolearn=ham version=3.3.2 spammy=pop, Hx-languages-length:2572 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mga01.intel.com Received: from mga01.intel.com (HELO mga01.intel.com) (192.55.52.88) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 21 May 2018 12:16:16 +0000 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 May 2018 05:15:58 -0700 X-ExtLoop1: 1 Received: from gnu-cfl-1.sc.intel.com ([172.25.70.237]) by orsmga006.jf.intel.com with ESMTP; 21 May 2018 05:15:57 -0700 From: "H.J. Lu" To: binutils@sourceware.org Cc: gdb-patches@sourceware.org Subject: [PATCH 2/3] Add DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION Date: Mon, 21 May 2018 05:15:56 -0700 Message-Id: <20180521121557.16535-2-hjl.tools@gmail.com> In-Reply-To: <20180521121557.16535-1-hjl.tools@gmail.com> References: <20180521121557.16535-1-hjl.tools@gmail.com> X-IsSubscribed: yes Add DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION for GCC 8 to silence -Wstringop-truncation warning: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85643 * diagnostics.h (DIAGNOSTIC_STRINGIFY_1): New. (DIAGNOSTIC_STRINGIFY): Likewise. (DIAGNOSTIC_IGNORE): Replace STRINGIFY with DIAGNOSTIC_STRINGIFY. (DIAGNOSTIC_IGNORE_SELF_MOVE): Define empty if not defined. (DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER): Likewise. (DIAGNOSTIC_IGNORE_UNUSED_FUNCTION): Likewise. (DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES): Likewise. (DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION): New. --- include/diagnostics.h | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/include/diagnostics.h b/include/diagnostics.h index 0725664177..ec5ac4190e 100644 --- a/include/diagnostics.h +++ b/include/diagnostics.h @@ -19,8 +19,13 @@ #ifdef __GNUC__ # define DIAGNOSTIC_PUSH _Pragma ("GCC diagnostic push") # define DIAGNOSTIC_POP _Pragma ("GCC diagnostic pop") + +/* Stringification. */ +# define DIAGNOSTIC_STRINGIFY_1(x) #x +# define DIAGNOSTIC_STRINGIFY(x) DIAGNOSTIC_STRINGIFY_1 (x) + # define DIAGNOSTIC_IGNORE(option) \ - _Pragma (STRINGIFY (GCC diagnostic ignored option)) + _Pragma (DIAGNOSTIC_STRINGIFY (GCC diagnostic ignored option)) #else # define DIAGNOSTIC_PUSH # define DIAGNOSTIC_POP @@ -37,24 +42,36 @@ # if __has_warning ("-Wenum-compare-switch") # define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES \ DIAGNOSTIC_IGNORE ("-Wenum-compare-switch") -# else -# define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES # endif #elif defined (__GNUC__) /* GCC */ -# define DIAGNOSTIC_IGNORE_SELF_MOVE -# define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER # define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION \ DIAGNOSTIC_IGNORE ("-Wunused-function") -# define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES -#else /* Other compilers */ +# if __GNUC__ >= 8 +# define DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION \ + DIAGNOSTIC_IGNORE ("-Wstringop-truncation") +# endif +#endif +#ifndef DIAGNOSTIC_IGNORE_SELF_MOVE # define DIAGNOSTIC_IGNORE_SELF_MOVE +#endif + +#ifndef DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER # define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER +#endif + +#ifndef DIAGNOSTIC_IGNORE_UNUSED_FUNCTION # define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION +#endif + +#ifndef DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES # define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES +#endif +#ifndef DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION +# define DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION #endif #endif /* DIAGNOSTICS_H */