This is the mail archive of the
mailing list for the GCC project.
Re: How do we write unused arguments?
- From: Richard Earnshaw <Richard dot Earnshaw at foss dot arm dot com>
- To: Jakub Jelinek <jakub at redhat dot com>, Marek Polacek <polacek at redhat dot com>
- Cc: Bernd Schmidt <bschmidt at redhat dot com>, gcc at gcc dot gnu dot org
- Date: Thu, 5 Nov 2015 11:19:36 +0000
- Subject: Re: How do we write unused arguments?
- Authentication-results: sourceware.org; auth=none
- References: <563B221B dot 9070806 at redhat dot com> <20151105104524 dot GU3185 at redhat dot com> <20151105104855 dot GW478 at tucnak dot redhat dot com>
On 05/11/15 10:48, Jakub Jelinek wrote:
> On Thu, Nov 05, 2015 at 11:45:24AM +0100, Marek Polacek wrote:
>> On Thu, Nov 05, 2015 at 10:32:11AM +0100, Bernd Schmidt wrote:
>>> When reviewing patches I'm never quite sure which of the following we should
>>> be using:
>>> some_target_hook (tree decl, machine_mode mode ATTRIBUTE_UNUSED)
>>> some_target_hook (tree decl, machine_mode ARG_UNUSED (mode))
>>> some_target_hook (tree decl, machine_mode /* mode */)
>>> some_target_hook (tree decl, machine_mode)
>>> Any opinions? I'm leaning towards the last version since it's idiomatic in
>>> the language we're using and has the least amount of visual clutter. If no
>>> one comments, I'll start enforcing that in patch reviews. Currently no one
>>> seems sure and everything is getting totally inconsistent.
>> FWIW, I also like the last version best.
> It depends, if the argument is conditionally (based on preprocessor macros)
> used, then we need the first form.
> If it is completely unused, I also prefer the last form, but there are cases
> where one wants to document the purpose of the unused argument or something
> similar and in that case the third one is useful.
Except, of course, that we're moving away from conditionally compiled
code, so we should never need the first (or second) forms.