PR c/64856
[official-gcc.git] / gcc / testsuite / gcc.dg / c99-predef-1.c
blobb907764579e33f0c6d56a6258e26bd1089bcde95
1 /* Verify that predefined macros for properties of the compiler and
2 library together are the same before and after system headers are
3 included. This is broken with older glibc versions. */
4 /* { dg-do compile } */
5 /* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
7 #ifdef __STDC_IEC_559__
8 #define IEC_559_DEFINED_BEFORE 1
9 #else
10 #define IEC_559_DEFINED_BEFORE 0
11 #endif
13 #ifdef __STDC_IEC_559_COMPLEX__
14 #define IEC_559_COMPLEX_DEFINED_BEFORE 1
15 #else
16 #define IEC_559_COMPLEX_DEFINED_BEFORE 0
17 #endif
19 #ifdef __STDC_ISO_10646__
20 #define ISO_10646_DEFINED_BEFORE 1
21 #else
22 #define ISO_10646_DEFINED_BEFORE 0
23 #endif
25 #include <stdio.h>
27 #ifdef __STDC_IEC_559__
28 #define IEC_559_DEFINED_AFTER 1
29 #else
30 #define IEC_559_DEFINED_AFTER 0
31 #endif
33 #ifdef __STDC_IEC_559_COMPLEX__
34 #define IEC_559_COMPLEX_DEFINED_AFTER 1
35 #else
36 #define IEC_559_COMPLEX_DEFINED_AFTER 0
37 #endif
39 #ifdef __STDC_ISO_10646__
40 #define ISO_10646_DEFINED_AFTER 1
41 #else
42 #define ISO_10646_DEFINED_AFTER 0
43 #endif
45 #if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 16))
46 #define BROKEN
47 #endif
49 #ifndef BROKEN
51 #if IEC_559_DEFINED_BEFORE != IEC_559_DEFINED_AFTER
52 #error "__STDC_IEC_559__ definition inconsistency"
53 #endif
55 #if IEC_559_COMPLEX_DEFINED_BEFORE != IEC_559_COMPLEX_DEFINED_AFTER
56 #error "__STDC_IEC_559_COMPLEX__ definition inconsistency"
57 #endif
59 #if ISO_10646_DEFINED_BEFORE != ISO_10646_DEFINED_AFTER
60 #error "__STDC_ISO_10646__ definition inconsistency"
61 #endif
63 #endif