[cfe-dev] MS attributes and GNUAttributesAllowed

Douglas Gregor dgregor at apple.com
Tue Aug 31 15:09:15 PDT 2010


On Aug 31, 2010, at 2:22 PM, dawn at burble.org wrote:

> 
> I see that MS attributes were added "if (GNUAttributesAllowed)" is true
> (see ParseTypeQualifierListOpt in lib/Parse/ParseDecl.cpp) - I find that
> a bit confusing.  The grammar at the top also implies MS attributes are
> handled under the [GNU] attributes.

It may have been a convenience, since GCC implements __fastcall, __thiscall, etc. from the Microsoft world, but I agree that it is confusing.

>  I'm about to add a new Borland
> attribute, but would like to clean this up.
> 
> There are a few ways to clean this up:
>    1. Add another bool parameter for each kind of attribute.  This could get
> 	ugly fast.

Ick.


>    2. Change 'GNUAttributesAllowed' to 'AttributesAllowed'.  The problem
>    	with this is that there's no way to disable MS (or other) attributes
> 	from sneaking in when GNU attributes are enabled (and vice versa).
>    3. Turn the bools GNUAttributesAllowed and CXX0XAttributesAllowed 
> 	into flags and add bitfields for GNU, CXX0X, MS and Borland.
> 
> I like #3, but this requires a little reworking of the attributes
> handling and I'm a bit new to be messing with this just yet :-).
> For now I'll just copy what MS did and go with #2.


#3 would be best, of course. #2 is okay if, practically speaking, it doesn't change any behavior.

	- Doug



More information about the cfe-dev mailing list