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 | 5c0a1a44687cbca0cbb5d253e9ed8b457a6eb92e (patch) | |
tree | 5c6e7c35f6f5be5d0abef06d2d9c9288c1361314 /lib/Lex | |
parent | 733637bbe91838e329b0bb272387637898923860 (diff) | |
download | clang-5c0a1a44687cbca0cbb5d253e9ed8b457a6eb92e.tar.gz clang-5c0a1a44687cbca0cbb5d253e9ed8b457a6eb92e.tar.bz2 clang-5c0a1a44687cbca0cbb5d253e9ed8b457a6eb92e.tar.xz |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209978 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex')
-rw-r--r-- | lib/Lex/PPDirectives.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index 46e8f07c51..a8dde086ba 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/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++. |