From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id BCEA6385828E; Thu, 22 Sep 2022 08:26:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BCEA6385828E Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id EE51F300089; Thu, 22 Sep 2022 08:26:31 +0000 (UTC) From: Tsukasa OI To: Tsukasa OI , Pedro Alves , Joel Brobecker , Enze Li Cc: gdb-patches@sourceware.org, binutils@sourceware.org Subject: [PATCH v2 4/4] gdb: Suppress "unused" variable warning on Clang Date: Thu, 22 Sep 2022 08:25:47 +0000 Message-Id: <189b22f1db46c1ffbb248aeca8b5753da4070f2c.1663835104.git.research_trasio@irq.a4lg.com> In-Reply-To: References: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2022 08:26:35 -0000 Clang generates a warning if there is a variable which is written but not read thereafter. By the default configuration (with "-Werror"), it causes a build failure (unless "--disable-werror" is specified). Because the cause of this error is in the Bison-generated code ($(srcdir)/gdb/cp-name-parser.y -> $(builddir)/gdb/cp-name-parser.c), this commit suppresses this warning ("-Wunused-but-set-variable") by placing the DIAGNOSTIC_IGNORE_UNUSED_BUT_SET_VARIABLE macro at the end of user prologue of cp-name-parser.y. gdb/ChangeLog: * cp-name-parser.y: Suppress -Wunused-but-set-variable warning on the Bison-generated code. --- gdb/cp-name-parser.y | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y index 34c691ddabb..21ba51679d3 100644 --- a/gdb/cp-name-parser.y +++ b/gdb/cp-name-parser.y @@ -248,6 +248,10 @@ cpname_state::make_name (const char *name, int len) static int yylex (YYSTYPE *, cpname_state *); static void yyerror (cpname_state *, const char *); + +#include "diagnostics.h" +DIAGNOSTIC_IGNORE_UNUSED_BUT_SET_VARIABLE + %} %type exp exp1 type start start_opt oper colon_name -- 2.34.1