2013-10-21 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / declspec-3.c
blob95052a9860fc4fc084c6ecd4014301302276d6b4
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" } */
7 static int x0;
8 int static x1; /* { dg-warning "not at beginning" } */
10 extern int x2;
11 int extern x3; /* { dg-warning "not at beginning" } */
13 typedef int x4;
14 int typedef x5; /* { dg-warning "not at beginning" } */
16 void g (int);
18 void
19 f (void)
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);
28 const static int x10; /* { dg-warning "not at beginning" } */
30 /* Attributes are OK before storage class specifiers, since some
31 attributes are like such specifiers themselves. */
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" } */