PR c/64856
[official-gcc.git] / gcc / testsuite / gcc.dg / pragma-darwin.c
blobf64095b0f0ebe0472c9d50fc35907a6ce9e48405
1 /* Darwin (Mac OS X) pragma exercises. */
3 /* { dg-do run { target *-*-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-warning "malformed '#pragma options'" } */
16 #pragma options align /* { dg-warning "malformed '#pragma options'" } */
17 #pragma options align natural /* { dg-warning "malformed '#pragma options'" } */
18 #pragma options align=45 /* { dg-warning "malformed '#pragma options'" } */
19 #pragma options align=foo /* { dg-warning "malformed '#pragma options align" } */
21 #ifndef __LP64__
22 #pragma options align=mac68k
23 struct s1 { short f1; int f2; };
24 #endif
25 #pragma options align=power
26 struct s2 { short f1; int f2; };
27 #ifndef __LP64__
28 #pragma options align=mac68k
29 struct s3 { short f1; int f2; };
30 #endif
31 #pragma options align=reset
32 struct s4 { short f1; int f2; };
34 #pragma options align=natural foo /* { dg-warning "junk at end of '#pragma options'" } */
35 /* { dg-warning "malformed '#pragma options align={mac68k|power|reset}', ignoring" "ignoring" { target *-*-* } 34 } */
37 /* Segment pragmas don't do anything anymore. */
39 #pragma segment foo
41 int
42 main ()
44 int x, z; /* { dg-warning "unused variable 'z'" } */
45 #pragma unused (x, y)
47 #ifndef __LP64__
48 if (sizeof (struct s1) != 6)
49 abort ();
50 #endif
51 if (sizeof (struct s2) != 8)
52 abort ();
53 #ifndef __LP64__
54 if (sizeof (struct s3) != 6)
55 abort ();
56 #endif
57 if (sizeof (struct s4) != 8)
58 abort ();
59 return 0;
62 void
63 unused_err_test ()
65 int a, b;
66 /* Trying to match on '(' or ')' gives regexp headaches, use . instead. */
67 #pragma unused /* { dg-warning "missing '.' after '#pragma unused" } */
68 #pragma unused (a /* { dg-warning "missing '.' after '#pragma unused" } */
69 #pragma unused (b) foo /* { dg-warning "junk at end of '#pragma unused'" } */