diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 2 | ||||
-rw-r--r-- | clang/test/Parser/MicrosoftExtensions.cpp | 6 | ||||
-rw-r--r-- | clang/test/Preprocessor/cxx_oper_keyword.cpp | 12 |
3 files changed, 5 insertions, 15 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 071687981a4..859e8ba18bd 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1882,7 +1882,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords, OPT_fno_gnu_keywords, Opts.GNUKeywords); - if (Args.hasArg(OPT_fno_operator_names) || Args.hasArg(OPT_fms_compatibility)) + if (Args.hasArg(OPT_fno_operator_names)) Opts.CXXOperatorNames = 0; if (Args.hasArg(OPT_fcuda_is_device)) diff --git a/clang/test/Parser/MicrosoftExtensions.cpp b/clang/test/Parser/MicrosoftExtensions.cpp index aabf3bf15a0..74f4bb3268d 100644 --- a/clang/test/Parser/MicrosoftExtensions.cpp +++ b/clang/test/Parser/MicrosoftExtensions.cpp @@ -261,8 +261,9 @@ int __identifier(else} = __identifier(for); // expected-error {{missing ')' afte #define identifier_weird(x) __identifier(x int k = identifier_weird(if)); // expected-error {{use of undeclared identifier 'if'}} -// 'and' is not an operator name with Microsoft compatibility. -extern int __identifier(and) r; // expected-error {{expected ';' after top level declarator}} +// This is a bit weird, but the alternative tokens aren't keywords, and this +// behavior matches MSVC. FIXME: Consider supporting this anyway. +extern int __identifier(and) r; // expected-error {{cannot convert '&&' token to an identifier}} void f() { __identifier(() // expected-error {{cannot convert '(' token to an identifier}} @@ -354,6 +355,7 @@ void TestProperty() { ++sp.V11; } +//expected-warning@+1 {{C++ operator 'and' (aka '&&') used as a macro name}} #define and foo struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable) IUnknown {}; diff --git a/clang/test/Preprocessor/cxx_oper_keyword.cpp b/clang/test/Preprocessor/cxx_oper_keyword.cpp index dce0fa04d7f..89a094d073c 100644 --- a/clang/test/Preprocessor/cxx_oper_keyword.cpp +++ b/clang/test/Preprocessor/cxx_oper_keyword.cpp @@ -1,6 +1,5 @@ // RUN: %clang_cc1 %s -E -verify -DOPERATOR_NAMES // RUN: %clang_cc1 %s -E -verify -fno-operator-names -// RUN: %clang_cc1 %s -verify -DTESTWIN -fms-compatibility #ifndef OPERATOR_NAMES //expected-error@+3 {{token is not a valid binary operator in a preprocessor subexpression}} @@ -30,14 +29,3 @@ #ifdef and #warning and is defined #endif - -#ifdef TESTWIN -// For cl compatibility, fno-operator-names is enabled by default. -int and; -int bitand; -int bitor; -int compl; -int not; -int or; -int xor; -#endif |