111
|
1 // { dg-do run }
|
|
2 // { dg-options "-fshort-enums" }
|
|
3
|
|
4 // On ARM EABI targets this testcase will cause a warning to be emitted
|
|
5 // whilst EABI attributes are being merged at link time unless
|
|
6 // the --no-enum-size-warning option is passed to the linker. Whilst the
|
|
7 // enum-size attributes should only be emitted if there are values of
|
|
8 // enum type that can escape the compilation unit, gcc cannot currently
|
|
9 // detect this; if this facility is added then this linker option should
|
|
10 // not be needed.
|
|
11 // { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm_eabi } }
|
|
12
|
|
13 #include <limits.h>
|
|
14
|
|
15 enum A { a1 = 0x7fffffff };
|
|
16 enum B { b1 = 0x80000000 };
|
|
17 enum C { c1 = -1, c2 = 0x80000000 };
|
|
18 enum D { d1 = CHAR_MIN, d2 = CHAR_MAX };
|
|
19 enum E { e1 = CHAR_MIN, e2 = CHAR_MIN };
|
|
20
|
131
|
21 int
|
111
|
22 main()
|
|
23 {
|
|
24 return (sizeof (A) != 4 || sizeof (B) != 4 || sizeof (C) != 8
|
|
25 || sizeof (D) != 1 || sizeof (E) != 1);
|
|
26 }
|