Why no __attribute__ ((unused)) for g++?

Jerry James james at xemacs.org
Fri Jun 1 00:27:51 EDT 2007


"Stephen J. Turnbull" <stephen at xemacs.org> wrote:
> In compiler.h we have
>
> #ifndef UNUSED
> # if defined(__GNUC__) && !defined(__cplusplus) && !defined(__INTEL_COMPILER)
> #  define ATTRIBUTE_UNUSED __attribute__ ((unused))
> # else
> #  define ATTRIBUTE_UNUSED
> # endif
>
> Why isn't this done for C++?  At least for g++ 4.1.2 it works fine
> (and it suppresses a bunch of warnings).
>
> Jerry?

Because once upon a time I had a version of g++ that complained that I
couldn't use that attribute due to the optional argument feature of C++.
I can't seem to locate a g++ that does that now, and I don't remember
how long ago it was (and hence, which version of g++ did that).  We
could try removing the "&& !defined(__cplusplus)" part and see if
anybody complains.

For that matter, the __INTEL_COMPILER part was based on 2 major versions
ago of the Intel compiler.  The version I currently have installed,
9.1.047, also takes __attribute__ ((unused)) without complaint.  I never
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?
-- 
Jerry James, Assistant Professor        james at xemacs.org
Computer Science Department             http://www.cs.usu.edu/~jerry/
Utah State University



More information about the XEmacs-Beta mailing list