aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/PPMacroExpansion.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Lex/PPMacroExpansion.cpp')
-rw-r--r--lib/Lex/PPMacroExpansion.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp
index 23dfbbca57..fb9b613f5c 100644
--- a/lib/Lex/PPMacroExpansion.cpp
+++ b/lib/Lex/PPMacroExpansion.cpp
@@ -370,9 +370,12 @@ MacroArgs *Preprocessor::ReadFunctionLikeMacroArgs(Token &MacroName,
// A("blah")
Diag(Tok, diag::ext_missing_varargs_arg);
- // Remember this occurred if this is a C99 macro invocation with at least
- // one actual argument.
- isVarargsElided = MI->isC99Varargs() && MI->getNumArgs() > 1;
+ // Remember this occurred if this is a macro invocation with at least
+ // one actual argument. This allows us to elide the comma when used for
+ // cases like:
+ // #define A(x, foo...) blah(a, ## foo)
+ // #define A(x, ...) blah(a, ## __VA_ARGS__)
+ isVarargsElided = MI->getNumArgs() > 1;
} else if (MI->getNumArgs() == 1) {
// #define A(x)
// A()