Mercurial > hg > CbC > CbC_gcc
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 |
rev | line source |
---|---|
111 | 1 /* Test warning for ordered comparison pointer with null pointer constant. */ |
2 /* Test with -pedantic-errors. */ | |
3 /* { dg-do compile } */ | |
4 /* { dg-options "-pedantic-errors" } */ | |
5 extern void z(); | |
6 void *p; | |
7 | |
8 void f() { | |
9 if ( z >= 0 ) /* { dg-error "ordered comparison of pointer with" } */ | |
10 z(); | |
11 if ( 0 >= z) /* { dg-error "ordered comparison of pointer with" } */ | |
12 z(); | |
13 if ( p >= (void*)0 ) | |
14 z(); | |
15 if ( (void*)0 >= p) | |
16 z(); | |
17 if (z >= (void*)0) /* { dg-error "distinct pointer types lacks a cast" } */ | |
18 z(); | |
19 if ((void*)0 >=z) /* { dg-error "distinct pointer types lacks a cast" } */ | |
20 z(); | |
21 } |