diff options
| author | Reid Kleckner <rnk@google.com> | 2021-01-27 10:59:28 -0800 |
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2021-01-27 10:59:57 -0800 |
| commit | 61a66e4b5ec18e9e73c2f6334f6b7f7dd4bca77e (patch) | |
| tree | e96f46cfd42a05e83ef54043a3204388417ac828 /clang/lib | |
| parent | e19ec9ca41b8549d8683cc221445b0ce1dc29924 (diff) | |
| download | llvm-61a66e4b5ec18e9e73c2f6334f6b7f7dd4bca77e.zip llvm-61a66e4b5ec18e9e73c2f6334f6b7f7dd4bca77e.tar.gz llvm-61a66e4b5ec18e9e73c2f6334f6b7f7dd4bca77e.tar.bz2 | |
Revert "Suppress non-conforming GNU paste extension in all standard-conforming modes"
This reverts commit f4537935dcdbf390c863591cf556e76c3abab9c1.
This reverts commit b43c26d036dcbf7a6881f39e4434cf059364022a.
This GNU and MSVC extension turns out to be very popular. Most projects
are not using C++20, so cannot use the new __VA_OPT__ feature to be
standards conformant. The other workaround, using -std=gnu*, enables too
many language extensions and isn't viable.
Until there is a way for users to get the behavior provided by the
`, ## __VA_ARGS__` extension in the -std=c++17 and earlier language
modes, we need to revert this.
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Lex/TokenLexer.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Lex/TokenLexer.cpp b/clang/lib/Lex/TokenLexer.cpp index 97cb2cf..da5681a 100644 --- a/clang/lib/Lex/TokenLexer.cpp +++ b/clang/lib/Lex/TokenLexer.cpp @@ -148,12 +148,12 @@ bool TokenLexer::MaybeRemoveCommaBeforeVaArgs( return false; // GCC removes the comma in the expansion of " ... , ## __VA_ARGS__ " if - // __VA_ARGS__ is empty, but not in strict mode where there are no - // named arguments, where it remains. With GNU extensions, it is removed - // regardless of named arguments. + // __VA_ARGS__ is empty, but not in strict C99 mode where there are no + // named arguments, where it remains. In all other modes, including C99 + // with GNU extensions, it is removed regardless of named arguments. // Microsoft also appears to support this extension, unofficially. - if (!PP.getLangOpts().GNUMode && !PP.getLangOpts().MSVCCompat && - Macro->getNumParams() < 2) + if (PP.getLangOpts().C99 && !PP.getLangOpts().GNUMode + && Macro->getNumParams() < 2) return false; // Is a comma available to be removed? |
