2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / qual-return-1.c
blob5cab75c93d79a3b631547fbc98fc75226f98aabe
1 /* Test for warnings for qualified function return types. */
2 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
3 /* { dg-do compile } */
4 /* { dg-options "-std=gnu99 -W" } */
6 /* Qualifying a function return type makes no sense. */
8 const int int_fn (void); /* { dg-warning "qualifiers" "int decl" } */
9 const int (*int_ptr) (void); /* { dg-warning "qualifiers" "int ptr" } */
10 const int int_fn2 (void) { return 0; } /* { dg-warning "qualifiers" "int defn" } */
12 const void void_fn (void); /* { dg-warning "qualifiers" "void decl" } */
13 const void (*void_ptr) (void); /* { dg-warning "qualifiers" "void ptr" } */
14 const void void_fn2 (void) { } /* { dg-warning "qualifiers" "void defn" } */
16 /* "volatile void" is a GNU extension, so only warn at -pedantic. */
18 volatile void vvoid_fn (void);
19 volatile void (*vvoid_ptr) (void);
20 volatile void vvoid_fn2 (void) { }
22 int *restrict ip_fn (void); /* { dg-warning "qualifiers" "restrict decl" } */
23 int *restrict (*ip_ptr) (void); /* { dg-warning "qualifiers" "restrict ptr" } */
24 int *restrict ip_fn2 (void) { return (int *)0; }; /* { dg-warning "qualifiers" "restrict defn" } */