This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch committed: Define ATTRIBUTE_UNUSED_LABEL for C++


Following up on my recent patch to support the "unused" attribute on
labels in the C++ frontend, this patch changes include/ansidecl.h to
define ATTRIBUTE_UNUSED_LABEL for C++.  C++, unlike C, requires a
semicolon after the attribute.  With perhaps an abundance of caution,
I did not change the definition for C.

Bootstrapped and tested on x86_64-unknown-linux-gnu.  Committed to
trunk and also to gcc-in-cxx branch.

Ian


2009-06-09  Ian Lance Taylor  <ian@airs.com>

	* ansidecl.h (ATTRIBUTE_UNUSED_LABEL): Define for C++.


Index: ansidecl.h
===================================================================
--- ansidecl.h	(revision 148327)
+++ ansidecl.h	(working copy)
@@ -261,14 +261,23 @@
 # endif /* GNUC >= 2.96 */
 #endif /* ATTRIBUTE_MALLOC */
 
-/* Attributes on labels were valid as of gcc 2.93. */
+/* Attributes on labels were valid as of gcc 2.93 and g++ 4.5.  For
+   g++ an attribute on a label must be followed by a semicolon.  */
 #ifndef ATTRIBUTE_UNUSED_LABEL
-# if (!defined (__cplusplus) && GCC_VERSION >= 2093)
-#  define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED
+# ifndef __cplusplus
+#  if GCC_VERSION >= 2093
+#   define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED
+#  else
+#   define ATTRIBUTE_UNUSED_LABEL
+#  endif
 # else
-#  define ATTRIBUTE_UNUSED_LABEL
-# endif /* !__cplusplus && GNUC >= 2.93 */
-#endif /* ATTRIBUTE_UNUSED_LABEL */
+#  if GCC_VERSION >= 4005
+#   define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED ;
+#  else
+#   define ATTRIBUTE_UNUSED_LABEL
+#  endif
+# endif
+#endif
 
 #ifndef ATTRIBUTE_UNUSED
 #define ATTRIBUTE_UNUSED __attribute__ ((__unused__))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]