[TableGen] Fix validateOperandClass for non Phyical Reg (#118146)
[llvm-project.git] / clang / test / Sema / warn-stringcompare.c
blob77876ad6abd6e7b06802dcb8fd7d8c58bde83e46
1 // RUN: %clang_cc1 -x c -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -x c++ -fsyntax-only -verify %s
4 #define DELIM "/"
5 #define DOT "."
6 #define NULL (void *)0
8 void test(const char *d) {
9 if ("/" != d) // expected-warning {{result of comparison against a string literal is unspecified (use an explicit string comparison function instead)}}
10 return;
11 if (d == "/") // expected-warning {{result of comparison against a string literal is unspecified (use an explicit string comparison function instead)}}
12 return;
13 if ("/" != NULL)
14 return;
15 if (NULL == "/")
16 return;
17 if ("/" != DELIM) // expected-warning {{result of comparison against a string literal is unspecified (use an explicit string comparison function instead)}}
18 return;
19 if (DELIM == "/") // expected-warning {{result of comparison against a string literal is unspecified (use an explicit string comparison function instead)}}
20 return;
21 if (DELIM != NULL)
22 return;
23 if (NULL == DELIM)
24 return;
25 if (DOT != DELIM) // expected-warning {{result of comparison against a string literal is unspecified (use an explicit string comparison function instead)}}
26 return;
27 if (DELIM == DOT) // expected-warning {{result of comparison against a string literal is unspecified (use an explicit string comparison function instead)}}
28 return;