[PATCH] Attribute parameters and arguments

Aaron Ballman aaron at aaronballman.com
Tue Aug 27 15:33:27 PDT 2013


On Tue, Aug 27, 2013 at 6:27 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> On Tue, Aug 27, 2013 at 3:16 PM, Aaron Ballman <aaron at aaronballman.com>
> wrote:
>>
>> Attributes can have a single parameter, as well as multiple (sometimes
>> optional) arguments.
>
>
> What is the distinction you're drawing between parameters and arguments
> here?

Parameters are used by GNU-only attributes, arguments everywhere else.
 The distinction is required so that we can properly handle error
reporting when parameters and arguments are both required for the
attribute.

> If you mean the weirdness in the GNU attribute syntax that we sometimes use
> different parsing rules for the first argument, I don't think modeling that
> as a fundamentally different kind of argument is the right way to proceed.
> Instead, we should look at the list of Args when parsing an attribute
> argument list, to determine how to parse each element.

I do mean that weirdness, but this has very little to do with parsing.
 The parsing logic is identical to its previous state, except instead
of looking for things which don't have params and bailing out, we look
for the much smaller list of things which do have params and include
them.

I dislike the notion of looking at the first argument in the list and
essentially guessing whether it's a parameter.  That makes semantic
checking basically impossible to generalize because we don't know
whether we should be looking for a parameter or not.  FWIW, this
caused (what I think are) bugs that I rectified in the test cases once
the logic was made more explicit.

~Aaron



More information about the cfe-commits mailing list