Debian Codegraph @

gcc/testsuite/gcc.dg/cpp/trad/builtins.c

raw
1 /* Test that builtin-macros are OK. */
2
3 /* { dg-do run } */
4
5 #include "builtins.h"
6
7 void abort (void);
8 char *strstr (const char *, const char *);
9 int strcmp (const char *, const char *);
10
11 #define LINE __LINE__
12
13 #if __LINE__ != 13
14 # error __LINE__ part 1 /* { dg-bogus "__LINE__" } */
15 #endif
16
17 #if \
18 __LINE__ != 18
19 # error __LINE__ part 2 /* { dg-bogus "__LINE__" } */
20 #endif
21
22 #if LINE != 22
23 # error __LINE__ part 3 /* { dg-bogus "__LINE__" } */
24 #endif
25
26 #if __INCLUDE_LEVEL != 0
27 # error __INCLUDE_LEVEL__ /* { dg-bogus "__INCLUDE_LEVEL__" } */
28 #endif
29
30 #if !defined (__TIME__)
31 # error __TIME__ /* { dg-bogus "__TIME__" } */
32 #endif
33
34 #if !defined (__DATE__)
35 # error __DATE__ /* { dg-bogus "__DATE__" } */
36 #endif
37
38
39 int main ()
40 {
41 /* level is defined in builtins.h. */
42 if (level != 1)
43 abort ();
44
45 if (!strstr (__FILE__, "builtins.c"))
46 abort ();
47
48 if (!strcmp (__BASE_FILE__, "builtins.c"))
49 abort ();
50
51 return 0;
52 }
53
54 /* { dg-require-host-local "" } */