public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Tsukasa OI <research_trasio@irq.a4lg.com>
To: Tsukasa OI <research_trasio@irq.a4lg.com>,
	Ian Lance Taylor <iant@google.com>,
	Cary Coutant <ccoutant@gmail.com>
Cc: binutils@sourceware.org
Subject: [PATCH 1/1] gold: Suppress "unused" variable warning on Clang
Date: Mon, 26 Sep 2022 10:35:40 +0000	[thread overview]
Message-ID: <3eadb55f979c9a93bba01818b300f90ea048fc55.1664188522.git.research_trasio@irq.a4lg.com> (raw)
In-Reply-To: <cover.1664188522.git.research_trasio@irq.a4lg.com>

Clang generates a warning if there is a variable that is set but not used
otherwise ("-Wunused-but-set-variable").  On the default configuration, it
causes a build failure (unless "--disable-werror" is specified).

Because the cause of this error is in the Bison-generated code
($(srcdir)/gold/yyscript.y -> $(builddir)/gold/yyscript.c),
this commit suppresses this warning ("-Wunused-but-set-variable") by placing
DIAGNOSTIC_IGNORE_UNUSED_BUT_SET_VARIABLE macro at the end of user
prologue on yyscript.y.

gold/ChangeLog:

	* yyscript.y: Suppress -Wunused-but-set-variable warning on
	the Bison-generated code.
---
 gold/yyscript.y | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gold/yyscript.y b/gold/yyscript.y
index 909786f0ddd..fe8f6812712 100644
--- a/gold/yyscript.y
+++ b/gold/yyscript.y
@@ -26,6 +26,7 @@
 %{
 
 #include "config.h"
+#include "diagnostics.h"
 
 #include <stddef.h>
 #include <stdint.h>
@@ -34,6 +35,8 @@
 
 #include "script-c.h"
 
+DIAGNOSTIC_IGNORE_UNUSED_BUT_SET_VARIABLE
+
 %}
 
 /* We need to use a pure parser because we might be multi-threaded.
-- 
2.34.1


  reply	other threads:[~2022-09-26 10:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26 10:35 [PATCH 0/1] " Tsukasa OI
2022-09-26 10:35 ` Tsukasa OI [this message]
2022-09-27  1:05   ` [PATCH 1/1] " Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3eadb55f979c9a93bba01818b300f90ea048fc55.1664188522.git.research_trasio@irq.a4lg.com \
    --to=research_trasio@irq.a4lg.com \
    --cc=binutils@sourceware.org \
    --cc=ccoutant@gmail.com \
    --cc=iant@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).