PATCH: Support priority argument for constructor/destructor arguments
Joseph S. Myers
joseph@codesourcery.com
Mon Feb 26 00:11:00 GMT 2007
On Sun, 25 Feb 2007, Mark Mitchell wrote:
> Joseph S. Myers wrote:
> > One case of invalid attribute arguments that should be tested in the tests
> > for invalid arguments and may need testing for in the code is INTEGER_CSTs
> > of non-integer type, __attribute__((constructor((void *)0))) for example.
>
> By the way, it seems that enumeration constants do not work; for:
>
> enum E { e };
> void f () __attribute__((constructor (e)));
>
> The arugment list is an IDETNIFIER_NODE, not a CONST_DECL or
> INTEGER_CST. Is this handled by any other attributes accepting numeric
> priorities?
This is a general known ambiguity with attribute syntax: the first
argument of an attribute may be either an identifier or an expression, and
if an identifier then it's parsed as such. (So using (e) should work
there as a workaround.)
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc-patches
mailing list