summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Lex/PPDirectives.cpp7
-rw-r--r--clang/test/Preprocessor/macro_paste_bad.c2
2 files changed, 3 insertions, 6 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index a952b2ef1b9..9ba65a57a84 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -2005,13 +2005,8 @@ void Preprocessor::HandleDefineDirective(Token &DefineTok,
MI->getReplacementToken(NumTokens-1).is(tok::comma))
MI->setHasCommaPasting();
- // Things look ok, add the '##' and param name tokens to the macro.
+ // Things look ok, add the '##' token to the macro.
MI->AddTokenToBody(LastTok);
- MI->AddTokenToBody(Tok);
- LastTok = Tok;
-
- // Get the next token of the macro.
- LexUnexpandedToken(Tok);
continue;
}
diff --git a/clang/test/Preprocessor/macro_paste_bad.c b/clang/test/Preprocessor/macro_paste_bad.c
index 0a028a44686..211465433b5 100644
--- a/clang/test/Preprocessor/macro_paste_bad.c
+++ b/clang/test/Preprocessor/macro_paste_bad.c
@@ -32,3 +32,5 @@ XX // expected-error {{attempt to use a poisoned identifier}}
#define VA __VA_ ## ARGS__
int VA; // expected-warning {{__VA_ARGS__ can only appear in the expansion of a C99 variadic macro}}
+#define LOG_ON_ERROR(lvl) ::X x## #__LINE__; // expected-error {{'#' is not followed by a macro parameter}}
+LOG_ON_ERROR(0);
OpenPOWER on IntegriCloud