This is the mail archive of the 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]

Re: [libiberty] Add ARG_UNUSED as a C++-friendly replacement forATTRIBUTE_UNUSED

Bernd Schmidt wrote:
> On Tue, 13 Jul 2004, Richard Henderson wrote:
>>On Tue, Jul 13, 2004 at 09:50:36AM +0200, Bernardo Innocenti wrote:
>>#ifdef __cplusplus
>># define ARG_UNUSED(N)
>>#elif somegccversion
>># define ARG_UNUSED(N)	N
> That fails in cases where the argument is unused only on some targets
> and needed by others.

For those (few) cases, I've handled it by moving ATTRIBUTE_UNUSED
before the typename, which seems to work G++ 3.3 too.

> What's wrong with just disabling ATTRIBUTE_UNUSED for compilers that
> can't handle it?

 - You get lots of annoying warnings in stage1 and when building
   a cross compiler;

 - If we switch to C++, ARG_UNUSED would allow using the standard
   C++ syntax for unused arguments;

 - libiberty.h is used in other projects and it's about portability
   across different compilers and platforms.  The ATTRIBUTE_UNUSED
   macro cannot be made to work usefully with all compilers,
   therefore it must be replaced with something more portable;

 - "int ARG_UNUSED(foo)" is shorter, more readable and sexier than
   "int foo ATTRIBUTE_UNUSED".

  // Bernardo Innocenti - Develer S.r.l., R&D dept.

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