[TableGen] Fix validateOperandClass for non Phyical Reg (#118146)
[llvm-project.git] / clang / test / Sema / warn-nullchar-nullptr.c
blobeabfebc266d1ede2596fff452898c263a39314f3
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wall %s -std=c11
3 int test1(int *a) {
4 return a == '\0'; // expected-warning {{comparing a pointer to a null character constant; did you mean to compare to (void *)0?}}
7 int test2(int *a) {
8 return '\0' == a; // expected-warning {{comparing a pointer to a null character constant; did you mean to compare to (void *)0?}}
11 int test3(int *a) {
12 return a == L'\0'; // expected-warning {{comparing a pointer to a null character constant; did you mean to compare to (void *)0?}}
15 int test4(int *a) {
16 return a == u'\0'; // expected-warning {{comparing a pointer to a null character constant; did you mean to compare to (void *)0?}}
19 int test5(int *a) {
20 return a == U'\0'; // expected-warning {{comparing a pointer to a null character constant; did you mean to compare to (void *)0?}}
23 int test6(int *a) {
24 return a == (char)0; // expected-warning {{comparing a pointer to a null character constant; did you mean to compare to (void *)0?}}
27 typedef char my_char;
28 int test7(int *a) {
29 return a == (my_char)0;
30 // expected-warning@-1 {{comparing a pointer to a null character constant; did you mean to compare to (void *)0?}}
33 int test8(int *a) {
34 return a != '\0'; // expected-warning {{comparing a pointer to a null character constant; did you mean to compare to (void *)0?}}
37 #define NULL (void *)0
38 int test9(int *a) {
39 return a == '\0'; // expected-warning {{comparing a pointer to a null character constant; did you mean to compare to NULL?}}
42 #define MYCHAR char
43 int test10(int *a) {
44 return a == (MYCHAR)0; // expected-warning {{comparing a pointer to a null character constant; did you mean to compare to NULL?}}
47 int test11(int *a) {
48 return a > '\0';