[cfe-dev] Premature macro expansion in preprocessor?
dgregor at apple.com
Fri Nov 9 14:46:27 PST 2012
On Nov 9, 2012, at 2:37 PM, Andy Gibbs <andyg1001 at hotmail.co.uk> 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.
More information about the cfe-dev