This commit was manufactured by cvs2svn to create branch
[official-gcc.git] / gcc / testsuite / gcc.dg / pragma-darwin.c
blobda70c8918a0726ce6540fc3ffc3e2d767084b607
1 /* Darwin (Mac OS X) pragma exercises. */
3 /* { dg-do run { target powerpc-*-darwin* } } */
4 /* { dg-options "-O -Wunused" } */
6 /* The mark pragma is to help decorate IDEs. */
8 extern void abort(void);
10 #pragma mark hey hey ho
12 /* The options pragma used to do a lot, now it's only for emulating
13 m68k alignment rules in structs. */
15 #pragma options 23 /* { dg-error "malformed '#pragma options'" } */
16 #pragma options align /* { dg-error "malformed '#pragma options'" } */
17 #pragma options align mac68k /* { dg-error "malformed '#pragma options'" } */
18 #pragma options align=45 /* { dg-error "malformed '#pragma options'" } */
19 #pragma options align=foo /* { dg-error "malformed '#pragma options align" } */
21 #pragma options align=mac68k
22 struct s1 { short f1; int f2; };
23 #pragma options align=power
24 struct s2 { short f1; int f2; };
25 #pragma options align=mac68k
26 struct s3 { short f1; int f2; };
27 #pragma options align=reset
28 struct s4 { short f1; int f2; };
30 #pragma options align=mac68k foo /* { dg-warning "junk at end of '#pragma options'" } */
32 /* Segment pragmas don't do anything anymore. */
34 #pragma segment foo
36 int
37 main ()
39 int x, z; /* { dg-warning "unused variable" } */
40 #pragma unused (x, y)
42 if (sizeof (struct s1) != 6)
43 abort ();
44 if (sizeof (struct s2) != 8)
45 abort ();
46 if (sizeof (struct s3) != 6)
47 abort ();
48 if (sizeof (struct s4) != 8)
49 abort ();
50 return 0;
53 void
54 unused_err_test ()
56 int a, b;
57 /* Trying to match on '(' or ')' gives regexp headaches, use . instead. */
58 #pragma unused /* { dg-error "missing '.' after '#pragma unused" } */
59 #pragma unused (a /* { dg-error "missing '.' after '#pragma unused" } */
60 #pragma unused (b) foo /* { dg-warning "junk at end of '#pragma unused'" } */