[cfe-commits] r39021 - /cfe/cfe/trunk/Lex/Preprocessor.cpp
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:26:54 PDT 2007
Author: sabre
Date: Wed Jul 11 11:26:54 2007
New Revision: 39021
URL: http://llvm.org/viewvc/llvm-project?rev=39021&view=rev
Log:
Implement test/Preprocessor/macro_arg_keyword.c
Modified:
cfe/cfe/trunk/Lex/Preprocessor.cpp
Modified: cfe/cfe/trunk/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/Preprocessor.cpp?rev=39021&r1=39020&r2=39021&view=diff
==============================================================================
--- cfe/cfe/trunk/Lex/Preprocessor.cpp (original)
+++ cfe/cfe/trunk/Lex/Preprocessor.cpp Wed Jul 11 11:26:54 2007
@@ -1576,11 +1576,15 @@
case tok::eom: // #define X(
Diag(Tok, diag::err_pp_missing_rparen_in_macro_def);
return true;
- default: // #define X(1
- Diag(Tok, diag::err_pp_invalid_tok_in_arg_list);
- return true;
- case tok::identifier:
+ default:
+ // Handle keywords and identifiers here to accept things like
+ // #define Foo(for) for.
IdentifierInfo *II = Tok.getIdentifierInfo();
+ if (II == 0) {
+ // #define X(1
+ Diag(Tok, diag::err_pp_invalid_tok_in_arg_list);
+ return true;
+ }
// If this is already used as an argument, it is used multiple times (e.g.
// #define X(A,A.
More information about the cfe-commits
mailing list