Patchwork PR other/54324: Do not set __attribute__ for GCC < 3.4

login
register
mail settings
Submitter Aldy Hernandez
Date Dec. 18, 2012, 3:18 p.m.
Message ID <50D08935.50506@redhat.com>
Download mbox | patch
Permalink /patch/207146/
State New
Headers show

Comments

Aldy Hernandez - Dec. 18, 2012, 3:18 p.m.
As discussed in the thread entitled "allow bootstrapping with older 
compilers", this patch disallows __attribute__ for GCC < 3.4.

Applied as obvious, as you mentioned in the other thread.

Thanks.
commit 370a6a8ddc628924c1deedf752ea9fc9a058d5cc
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Tue Dec 18 09:13:48 2012 -0600

    	PR other/54324
    	* ansidecl.h (ATTRIBUTE_UNUSED): Do not set __attribute__ for GCC
    	< 3.4.

Patch

diff --git a/include/ansidecl.h b/include/ansidecl.h
index 23d85bf..40f4a5f 100644
--- a/include/ansidecl.h
+++ b/include/ansidecl.h
@@ -279,8 +279,15 @@  So instead we use the macro below and test it against specific values.  */
 # endif
 #endif
 
+/* Similarly to ARG_UNUSED below.  Prior to GCC 3.4, the C++ frontend
+   couldn't parse attributes placed after the identifier name, and now
+   the entire compiler is built with C++.  */
 #ifndef ATTRIBUTE_UNUSED
-#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#if GCC_VERSION >= 3004
+#  define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#else
+#define ATTRIBUTE_UNUSED
+#endif
 #endif /* ATTRIBUTE_UNUSED */
 
 /* Before GCC 3.4, the C++ frontend couldn't parse attributes placed after the