public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* function attribute location
@ 2011-09-21 17:20 NightStrike
  2011-09-21 18:55 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: NightStrike @ 2011-09-21 17:20 UTC (permalink / raw)
  To: gcc-help

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?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: function attribute location
  2011-09-21 17:20 function attribute location NightStrike
@ 2011-09-21 18:55 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2011-09-21 18:55 UTC (permalink / raw)
  To: NightStrike; +Cc: gcc-help

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-21 18:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-21 17:20 function attribute location NightStrike
2011-09-21 18:55 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).