diff mbox series

Go patch committed: Don't assume that ATTRIBUTE_UNUSED is defined

Message ID CAOyqgcWo0Ma5VZUzyEUGpaomPfRQ8DgQKa3XpMVyer=__zUBjg@mail.gmail.com
State New
Headers show
Series Go patch committed: Don't assume that ATTRIBUTE_UNUSED is defined | expand

Commit Message

Ian Lance Taylor Aug. 7, 2024, 8:31 p.m. UTC
This patch to the Go frontend avoids assuming that ATTRIBUTE_UNUSED is
defined.  While it is defined when building the Go frontend as part of
GCC, it is meant to work with other compilers as well.  Bootstrapped
and ran Go testsuite on x86_64-pc-linux-gnu.  Committed to mainline.

Ian
e89ddb749517ea4c9c0ecf32f6932548140c0dcc
diff mbox series

Patch

diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index e13dc5f58a3..3a839410e9c 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@ 
-5f6fae5ff33e996243acd098c71904695c414c53
+6aa463fef2d8f04e0bd2675f63a6529df080a44a
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/lex.h b/gcc/go/gofrontend/lex.h
index 701e5d4b353..452ef95f334 100644
--- a/gcc/go/gofrontend/lex.h
+++ b/gcc/go/gofrontend/lex.h
@@ -12,6 +12,12 @@ 
 #include "operator.h"
 #include "go-linemap.h"
 
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+# define GO_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#else
+# define GO_ATTRIBUTE_UNUSED
+#endif
+
 struct Unicode_range;
 
 // The keywords.  These must be in sorted order, other than
@@ -561,7 +567,7 @@  class Lex
   gather_embed(const char*, const char*);
 
   // The input file name.
-  const char* input_file_name_ ATTRIBUTE_UNUSED;
+  const char* input_file_name_ GO_ATTRIBUTE_UNUSED;
   // The input file.
   FILE* input_file_;
   // The object used to keep track of file names and line numbers.