annotate gcc/testsuite/gcc.dg/declspec-9.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Test declaration specifiers. Test various checks on storage class
kono
parents:
diff changeset
2 and function specifiers that depend on information about the
kono
parents:
diff changeset
3 declaration, not just the specifiers. Test with no special
kono
parents:
diff changeset
4 options. */
kono
parents:
diff changeset
5 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
kono
parents:
diff changeset
6 /* { dg-do compile } */
kono
parents:
diff changeset
7 /* { dg-options "" } */
kono
parents:
diff changeset
8
kono
parents:
diff changeset
9 auto void f0 (void) {} /* { dg-warning "function definition declared 'auto'" } */
kono
parents:
diff changeset
10 register void f1 (void) {} /* { dg-error "function definition declared 'register'" } */
kono
parents:
diff changeset
11 typedef void f2 (void) {} /* { dg-error "function definition declared 'typedef'" } */
kono
parents:
diff changeset
12
kono
parents:
diff changeset
13 void f3 (auto int); /* { dg-error "storage class specified for unnamed parameter" } */
kono
parents:
diff changeset
14 void f4 (extern int); /* { dg-error "storage class specified for unnamed parameter" } */
kono
parents:
diff changeset
15 void f5 (register int);
kono
parents:
diff changeset
16 void f6 (static int); /* { dg-error "storage class specified for unnamed parameter" } */
kono
parents:
diff changeset
17 void f7 (typedef int); /* { dg-error "storage class specified for unnamed parameter" } */
kono
parents:
diff changeset
18
kono
parents:
diff changeset
19 auto int x; /* { dg-error "file-scope declaration of 'x' specifies 'auto'" } */
kono
parents:
diff changeset
20 register int y; /* { dg-error "register name not specified for 'y'" } */
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 void h (void) { extern void x (void) {} } /* { dg-error "nested function 'x' declared 'extern'" } */
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 void
kono
parents:
diff changeset
25 g (void)
kono
parents:
diff changeset
26 {
kono
parents:
diff changeset
27 void a; /* { dg-error "variable or field 'a' declared void" } */
kono
parents:
diff changeset
28 const void b; /* { dg-error "variable or field 'b' declared void" } */
kono
parents:
diff changeset
29 static void c; /* { dg-error "variable or field 'c' declared void" } */
kono
parents:
diff changeset
30 }
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 void p;
kono
parents:
diff changeset
33 const void p1;
kono
parents:
diff changeset
34 extern void q;
kono
parents:
diff changeset
35 extern const void q1;
kono
parents:
diff changeset
36 static void r; /* { dg-error "variable or field 'r' declared void" } */
kono
parents:
diff changeset
37 static const void r1; /* { dg-error "variable or field 'r1' declared void" } */
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 register void f8 (void); /* { dg-error "invalid storage class for function 'f8'" } */
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 void i (void) { auto void y (void) {} }
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 inline int main (void) { return 0; } /* { dg-warning "cannot inline function 'main'" } */