public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] gold: Suppress "unused" variable warning on Clang
@ 2022-09-27  5:35 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2022-09-27  5:35 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f7aa1a5acc5faa03ed6c640a426ef70a5f328940

commit f7aa1a5acc5faa03ed6c640a426ef70a5f328940
Author: Tsukasa OI <research_trasio@irq.a4lg.com>
Date:   Mon Sep 26 10:35:40 2022 +0000

    gold: Suppress "unused" variable warning on Clang
    
    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.
    
            * yyscript.y: Suppress -Wunused-but-set-variable warning on
            the Bison-generated code.

Diff:
---
 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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-27  5:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-27  5:35 [binutils-gdb] gold: Suppress "unused" variable warning on Clang Alan Modra

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).