annotate gcc/testsuite/gcc.dg/ordered-comparison-3.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
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 -pedantic-errors. */
kono
parents:
diff changeset
3 /* { dg-do compile } */
kono
parents:
diff changeset
4 /* { dg-options "-pedantic-errors" } */
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-error "ordered comparison of pointer with" } */
kono
parents:
diff changeset
10 z();
kono
parents:
diff changeset
11 if ( 0 >= z) /* { dg-error "ordered comparison of pointer with" } */
kono
parents:
diff changeset
12 z();
kono
parents:
diff changeset
13 if ( p >= (void*)0 )
kono
parents:
diff changeset
14 z();
kono
parents:
diff changeset
15 if ( (void*)0 >= p)
kono
parents:
diff changeset
16 z();
kono
parents:
diff changeset
17 if (z >= (void*)0) /* { dg-error "distinct pointer types lacks a cast" } */
kono
parents:
diff changeset
18 z();
kono
parents:
diff changeset
19 if ((void*)0 >=z) /* { dg-error "distinct pointer types lacks a cast" } */
kono
parents:
diff changeset
20 z();
kono
parents:
diff changeset
21 }