aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-05-08 05:10:33 +0000
committerChris Lattner <sabre@nondot.org>2008-05-08 05:10:33 +0000
commit63bc0358706e63faf705803c4799e073b91a63f0 (patch)
tree105048c54ef4c557d62bcdfaef8e2e218d5e701d /lib
parentb6403af3e697f90308fe8daf82f7b15252d198bc (diff)
The awesome GNU "comma elision extension" works with both the standard
__VA_ARGS__ syntax as well as with the amazingly awesome GNU "named variadic macro" extension. Allow it with the GNU syntax as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50843 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-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()