Skip analyzer strndup test on hppa*-*-hpux*
[official-gcc.git] / gcc / testsuite / gcc.dg / cast-qual-2.c
blob5fd2b854d61453f5b459e1317bb599cc0c46f034
1 /* Test whether the -Wcast-qual handles cv-qualified functions correctly. */
2 /* { dg-do compile } */
3 /* { dg-options "-Wcast-qual" } */
5 typedef int (intfn_t) (int);
6 typedef void (voidfn_t) (void);
8 typedef const intfn_t *constfn_t;
9 typedef volatile voidfn_t *noreturnfn_t;
11 intfn_t intfn;
12 const intfn_t constfn;
13 voidfn_t voidfn;
14 volatile voidfn_t noreturnfn;
16 intfn_t *i1 = intfn;
17 intfn_t *i2 = (intfn_t *) intfn;
18 intfn_t *i3 = constfn;
19 intfn_t *i4 = (intfn_t *) constfn; /* { dg-bogus "discards qualifier" } */
21 constfn_t p1 = intfn; /* { dg-warning "makes '__attribute__..const..' qualified function" } */
22 constfn_t p2 = (constfn_t) intfn; /* { dg-warning "adds '__attribute__..const..' qualifier" } */
23 constfn_t p3 = constfn;
24 constfn_t p4 = (constfn_t) constfn;
26 voidfn_t *v1 = voidfn;
27 voidfn_t *v2 = (voidfn_t *) voidfn;
28 voidfn_t *v3 = noreturnfn;
29 voidfn_t *v4 = (voidfn_t *) noreturnfn; /* { dg-bogus "discards qualifier" } */
31 noreturnfn_t n1 = voidfn; /* { dg-warning "makes '__attribute__..noreturn..' qualified function" } */
32 noreturnfn_t n2 = (noreturnfn_t) voidfn; /* { dg-warning "adds '__attribute__..noreturn..' qualifier" } */
33 noreturnfn_t n3 = noreturnfn;
34 noreturnfn_t n4 = (noreturnfn_t) noreturnfn;