Message ID | 189b22f1db46c1ffbb248aeca8b5753da4070f2c.1663835104.git.research_trasio@irq.a4lg.com |
---|---|
State | Superseded |
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A25413851AAC for <patchwork@sourceware.org>; Thu, 22 Sep 2022 08:27:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A25413851AAC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663835277; bh=sSVeey+uK0xnd3PD+rg1jZ8jg1wdKLsBKxBJ9um9syQ=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=qZSz0y7khfND4AczVgOGXLI7rzAPb2B1mxEonAr97C/E6F98pQWVOnSfXuvw64mE6 9pbTKVoZmzFBFFZy3LAGJWtziaaMazBRTcZkvev4Nsgi4xTQ6EuH2b51He6OIkDcwM 9oC9pqYNSH+UIn+tQFmdcQ1W34UfPvO4dJpTWRgo= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org 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) To: Tsukasa OI <research_trasio@irq.a4lg.com>, Pedro Alves <pedro@palves.net>, Joel Brobecker <brobecker@adacore.com>, Enze Li <lienze@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: <cover.1663835104.git.research_trasio@irq.a4lg.com> References: <cover.1663211419.git.research_trasio@irq.a4lg.com> <cover.1663835104.git.research_trasio@irq.a4lg.com> 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 <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> From: Tsukasa OI via Gdb-patches <gdb-patches@sourceware.org> Reply-To: Tsukasa OI <research_trasio@irq.a4lg.com> Cc: binutils@sourceware.org, gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
gdb: (includes PR28413), Suppress some general warnings if built with Clang
|
|
Commit Message
Tsukasa OI
Sept. 22, 2022, 8:25 a.m. UTC
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(+)
Comments
On 9/22/22 04:25, Tsukasa OI via Gdb-patches wrote: > 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. Hi, I just sent a patch to fix the same thing as your patch here, but only saw your patch after. However, I took a different, more fine-grained approach: https://inbox.sourceware.org/gdb-patches/20221012173256.20079-1-simon.marchi@efficios.com/T/#u Can you let me know what you think? Simon
On 2022/10/13 2:36, Simon Marchi wrote: > On 9/22/22 04:25, Tsukasa OI via Gdb-patches wrote: >> 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. > > Hi, > > I just sent a patch to fix the same thing as your patch here, but only > saw your patch after. However, I took a different, more fine-grained > approach: > > https://inbox.sourceware.org/gdb-patches/20221012173256.20079-1-simon.marchi@efficios.com/T/#u > > Can you let me know what you think? > > Simon > I always prefer fine-grained approach if we can. The only reason I didn't do that on gold is because I didn't know proper place for "(void) yynerrs". I cannot approve (as I'm not a maintainer) but I support your patchset. Thanks, Tsukasa
On 2022-10-16 09:37, Tsukasa OI via Gdb-patches wrote: > On 2022/10/13 2:36, Simon Marchi wrote: >> On 9/22/22 04:25, Tsukasa OI via Gdb-patches wrote: >>> 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. >> >> Hi, >> >> I just sent a patch to fix the same thing as your patch here, but only >> saw your patch after. However, I took a different, more fine-grained >> approach: >> >> https://inbox.sourceware.org/gdb-patches/20221012173256.20079-1-simon.marchi@efficios.com/T/#u >> >> Can you let me know what you think? >> >> Simon >> > > I always prefer fine-grained approach if we can. The only reason I > didn't do that on gold is because I didn't know proper place for "(void) > yynerrs". I cannot approve (as I'm not a maintainer) but I support your > patchset. Ok, thanks for the feedback, I will push my version. Simon
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 <comp> exp exp1 type start start_opt oper colon_name