annotate clang/test/Preprocessor/cxx_oper_keyword.cpp @ 237:c80f45b162ad llvm-original

add some fix
author kono
date Wed, 09 Nov 2022 17:47:54 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 %s -E -verify -DOPERATOR_NAMES
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 %s -E -verify -fno-operator-names
anatofuz
parents:
diff changeset
3
anatofuz
parents:
diff changeset
4 #ifndef OPERATOR_NAMES
anatofuz
parents:
diff changeset
5 //expected-error@+3 {{token is not a valid binary operator in a preprocessor subexpression}}
anatofuz
parents:
diff changeset
6 #endif
anatofuz
parents:
diff changeset
7 // Valid because 'and' is a spelling of '&&'
anatofuz
parents:
diff changeset
8 #if defined foo and bar
anatofuz
parents:
diff changeset
9 #endif
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 // Not valid in C++ unless -fno-operator-names is passed:
anatofuz
parents:
diff changeset
12
anatofuz
parents:
diff changeset
13 #ifdef OPERATOR_NAMES
anatofuz
parents:
diff changeset
14 //expected-error@+2 {{C++ operator 'and' (aka '&&') used as a macro name}}
anatofuz
parents:
diff changeset
15 #endif
anatofuz
parents:
diff changeset
16 #define and foo
anatofuz
parents:
diff changeset
17
anatofuz
parents:
diff changeset
18 #ifdef OPERATOR_NAMES
anatofuz
parents:
diff changeset
19 //expected-error@+2 {{C++ operator 'xor' (aka '^') used as a macro name}}
anatofuz
parents:
diff changeset
20 #endif
anatofuz
parents:
diff changeset
21 #if defined xor
anatofuz
parents:
diff changeset
22 #endif
anatofuz
parents:
diff changeset
23
anatofuz
parents:
diff changeset
24 // For error recovery we continue as though the identifier was a macro name regardless of -fno-operator-names.
anatofuz
parents:
diff changeset
25 #ifdef OPERATOR_NAMES
anatofuz
parents:
diff changeset
26 //expected-error@+3 {{C++ operator 'and' (aka '&&') used as a macro name}}
anatofuz
parents:
diff changeset
27 #endif
anatofuz
parents:
diff changeset
28 //expected-warning@+2 {{and is defined}}
anatofuz
parents:
diff changeset
29 #ifdef and
anatofuz
parents:
diff changeset
30 #warning and is defined
anatofuz
parents:
diff changeset
31 #endif
anatofuz
parents:
diff changeset
32
anatofuz
parents:
diff changeset
33 #ifdef OPERATOR_NAMES
anatofuz
parents:
diff changeset
34 //expected-error@+2 {{invalid token at start of a preprocessor expression}}
anatofuz
parents:
diff changeset
35 #endif
anatofuz
parents:
diff changeset
36 #if or
anatofuz
parents:
diff changeset
37 #endif
anatofuz
parents:
diff changeset
38
anatofuz
parents:
diff changeset
39 #ifdef OPERATOR_NAMES
anatofuz
parents:
diff changeset
40 //expected-error@+2 {{invalid token at start of a preprocessor expression}}
anatofuz
parents:
diff changeset
41 #endif
anatofuz
parents:
diff changeset
42 #if and_eq
anatofuz
parents:
diff changeset
43 #endif