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

Re: function attribute location


NightStrike <nightstrike@gmail.com> writes:

> If I want to mark a function parameter as unused, do I place it before
> or after the type?
>
> void xx ( __attribute__((unused)) int a ) { ... }
> void xx (  int __attribute__((unused)) a ) { ... }
>
> Which is correct?

This is what the gcc source code does:

void xx (int a __attribute__ ((unused))) { ... }

The unused attribute applies to the parameter, not the type.

Ian


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