diff options
| author | Alp Toker <alp@nuanti.com> | 2014-05-31 16:32:22 +0000 |
|---|---|---|
| committer | Alp Toker <alp@nuanti.com> | 2014-05-31 16:32:22 +0000 |
| commit | e03e9e15f2a66fe1b947322850e37b8133521759 (patch) | |
| tree | 8efefe8b7b8b4d2a315f0dd766b5a07529df0bbc /clang/lib/Lex | |
| parent | b4690e3fd1c6b660fc4e9ef58ab8b34964a1c7a9 (diff) | |
| download | bcm5719-llvm-e03e9e15f2a66fe1b947322850e37b8133521759.tar.gz bcm5719-llvm-e03e9e15f2a66fe1b947322850e37b8133521759.zip | |
Preprocessor: make C++ operator names as macro identifiers a compatible extension
With recent changes, this is now a compatible language extension and can be
safely enabled with -ms-extensions instead of requiring the full
-ms-compatibility MSVC drop-in mode. As such we can now also emit an extension
warning under -Wmicrosoft to help users port their code.
llvm-svn: 209978
Diffstat (limited to 'clang/lib/Lex')
| -rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 46e8f07c510..a8dde086baf 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -145,11 +145,12 @@ bool Preprocessor::CheckMacroName(Token &MacroNameTok, char isDefineUndef) { if (!II->isCPlusPlusOperatorKeyword()) return Diag(MacroNameTok, diag::err_pp_macro_not_identifier); - if (!getLangOpts().MSVCCompat) - // C++ 2.5p2: Alternative tokens behave the same as its primary token - // except for their spellings. - Diag(MacroNameTok, diag::err_pp_operator_used_as_macro_name) - << II << MacroNameTok.getKind(); + // C++ 2.5p2: Alternative tokens behave the same as its primary token + // except for their spellings. + Diag(MacroNameTok, getLangOpts().MicrosoftExt + ? diag::ext_pp_operator_used_as_macro_name + : diag::err_pp_operator_used_as_macro_name) + << II << MacroNameTok.getKind(); // Allow #defining |and| and friends for Microsoft compatibility or // recovery when legacy C headers are included in C++. |

