[cfe-dev] Premature macro expansion in preprocessor?
andyg1001 at hotmail.co.uk
Fri Nov 9 15:10:18 PST 2012
On Friday, November 09, 2012 11:46 PM, Douglas Gregor wrote:
> On Nov 9, 2012, at 2:37 PM, Andy Gibbs wrote:
>> In going through the preprocessor code in clang, I have noted a tendancy
>> towards using Lex(Tok) over LexUnexpandedToken(Tok), for example in the
>> built-in macro implementations.
>> This means, the following "works":
>> #define HB __has_builtin
>> #define LP (
>> #define BT __builtin_trap
>> #define RP )
>> HB LP BT RP // expands to 1
>> My question is, is this intentional, or an oversight? Is it worth my
>> while going through and changing Lex(...) to LexUnexpandedToken(...)
>> in these cases?
> I consider this a bug. The __has_builtin/__has_feature/etc. code should
> be using LexUnexpandedToken.
Ok, I'll have a look at it tomorrow then. (Too late in the night now!!)
More information about the cfe-dev