This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: __attribute__((unused)) is ignored in C++
- To: doko at cs dot tu-berlin dot de (Matthias Klose)
- Subject: Re: __attribute__((unused)) is ignored in C++
- From: Joe Buck <jbuck at synopsys dot COM>
- Date: Fri, 5 Nov 99 8:55:57 PST
- Cc: gcc at gcc dot gnu dot org, 45440 at bugs dot debian dot org, rjk at sfere dot greenend dot org dot uk
> [This bug was reported to the Debian bug tracking system. Please CC
> to 45440@bugs.debian.org.]
>
> Tested with gcc-2.95.2
>
> egcs ignores the __attribute__ syntax to mark a function parameter
> unused, and then complains when it is not used. This only happens
> when compiling C++, not C.
While this should be fixed, it tends to get low priority because there
is a standard, portable way in C++ to indicate that a variable is not
used:
int foo2(int)
{
return 1;
}
If you want to give the argument a name for documentation purposes,
the style I use is
int foo2(int /* x */)
{
return 1;
}