[cfe-dev] MS attributes and GNUAttributesAllowed

dawn at burble.org dawn at burble.org
Tue Aug 31 14:22:19 PDT 2010


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.  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.
    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.

Opinions?  Thoughts?  
-Dawn



More information about the cfe-dev mailing list