[AC21.5] Why no __attribute__ ((unused)) for g++?

Stephen J. Turnbull stephen at xemacs.org
Fri Jun 22 13:25:11 EDT 2007


APPROVE COMMIT 21.5

Not relevant to 21.4

I'm committing these, per Jerry's explanation.

Stephen J. Turnbull writes:
 > Jerry James writes:
 > 
 >  > We could try removing the "&& !defined(__cplusplus)" part and see
 >  > if anybody complains.
 > 
 > Will do.
 > 
 >  > checked version 8.  If __INTEL_COMPILER is defined, then the check
 >  > should be __INTEL_COMPILER >= 800 or >= 900, depending.  Does anybody
 >  > have a version 8 installed?
 > 
 > I'll try >= 800 on the same principle as above.

Index: src/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.1070
diff -u -r1.1070 ChangeLog
--- src/ChangeLog	22 Jun 2007 00:21:12 -0000	1.1070
+++ src/ChangeLog	22 Jun 2007 17:10:52 -0000
@@ -0,0 +1,4 @@
+2007-06-23  Stephen J. Turnbull  <stephen at xemacs.org>
+
+	* compiler.h: Try to use USED with more compilers.  Thanks, Jerry!
+

Index: src/compiler.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/compiler.h,v
retrieving revision 1.11
diff -u -r1.11 compiler.h
--- src/compiler.h	26 Nov 2005 11:46:07 -0000	1.11
+++ src/compiler.h	22 Jun 2007 17:10:52 -0000
@@ -210,19 +210,24 @@
 # endif /* GCC_VERSION >= NEED_GCC (2, 5, 0) */
 #endif /* ATTRIBUTE_CONST */
 
-/* Unused declarations; g++ and icc do not support this. */
 /*
    NOTE:  These macros MUST be named UNUSED (exactly) or something
    prefixed with USED_IF_, or DEFUN docstrings will be parsed incorrectly.
    See comments in make_docfile.c (write_c_args).  You'd think that this
    wouldn't happen, but unfortunately we do indeed have some arguments
    of DEFUNs unused for GNU compatibility or because features are missing.
+
+   #### At one time, __attribute__ ((unused)) confused G++.  We don't know
+   which versions.  Please report problems and fix conditionals.
+   #### A similar issue arose with the Intel CC.  We know that v7 didn't
+   work and v9 does.  Let us know if v8 works or not, please.
+   See <m34plsmh88.fsf at jerrypc.cs.usu.edu>.
 */
 #ifndef UNUSED_ARG
 # define UNUSED_ARG(decl) unused_##decl
 #endif
 #ifndef UNUSED
-# if defined(__GNUC__) && !defined(__cplusplus) && !defined(__INTEL_COMPILER)
+# if defined(__GNUC__) && (!defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 800)
 #  define ATTRIBUTE_UNUSED __attribute__ ((unused))
 # else
 #  define ATTRIBUTE_UNUSED



More information about the XEmacs-Beta mailing list