OSDN Git Service

Fix PR42205.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / declspec-3.c
1 /* Test declaration specifiers.  Test diagnosis of storage class
2    specifiers not at start.  */
3 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
4 /* { dg-do compile } */
5 /* { dg-options "-Wold-style-declaration" } */
6
7 static int x0;
8 int static x1; /* { dg-warning "not at beginning" } */
9
10 extern int x2;
11 int extern x3; /* { dg-warning "not at beginning" } */
12
13 typedef int x4;
14 int typedef x5; /* { dg-warning "not at beginning" } */
15
16 void g (int);
17
18 void
19 f (void)
20 {
21   auto int x6 = 0;
22   int auto x7 = 0; /* { dg-warning "not at beginning" } */
23   register int x8 = 0;
24   int register x9 = 0; /* { dg-warning "not at beginning" } */
25   g (x6 + x7 + x8 + x9);
26 }
27
28 const static int x10; /* { dg-warning "not at beginning" } */
29
30 /* Attributes are OK before storage class specifiers, since some
31    attributes are like such specifiers themselves.  */
32
33 __attribute__((format(printf, 1, 2))) static void h (const char *, ...);
34 __attribute__((format(printf, 1, 2))) void static i (const char *, ...); /* { dg-warning "not at beginning" } */