Skip to content

Commit

Permalink
gold: Suppress "unused" variable warning on Clang
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
a4lg authored and amodra committed Sep 27, 2022
1 parent 8818c80 commit f7aa1a5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gold/yyscript.y
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
%{

#include "config.h"
#include "diagnostics.h"

#include <stddef.h>
#include <stdint.h>
Expand All @@ -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.
Expand Down

0 comments on commit f7aa1a5

Please sign in to comment.