annotate gcc/testsuite/gcc.dg/ordered-comparison-4.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Test warning for ordered comparison pointer with null pointer constant. */
kono
parents:
diff changeset
2 /* Test with -Wextra. */
kono
parents:
diff changeset
3 /* { dg-do compile } */
kono
parents:
diff changeset
4 /* { dg-options "-Wextra" } */
kono
parents:
diff changeset
5 extern void z();
kono
parents:
diff changeset
6 void *p;
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 void f() {
kono
parents:
diff changeset
9 if (z >= 0) /* { dg-warning "ordered comparison of pointer with" } */
kono
parents:
diff changeset
10 z();
kono
parents:
diff changeset
11 if (0 >= z) /* { dg-warning "ordered comparison of pointer with" } */
kono
parents:
diff changeset
12 z();
kono
parents:
diff changeset
13 if (p >= (void*)0) /* { dg-warning "ordered comparison of pointer with null pointer" } */
kono
parents:
diff changeset
14 z();
kono
parents:
diff changeset
15 if ((void*)0 >= p) /* { dg-warning "ordered comparison of pointer with null pointer" } */
kono
parents:
diff changeset
16 z();
kono
parents:
diff changeset
17 if (z >= (void*)0) /* { dg-warning "distinct pointer types lacks a cast" } */
kono
parents:
diff changeset
18 z();
kono
parents:
diff changeset
19 if ((void*)0 >=z) /* { dg-warning "distinct pointer types lacks a cast" } */
kono
parents:
diff changeset
20 z();
kono
parents:
diff changeset
21 }