OSDN Git Service

* c-common.c (c_common_init): Override cpplib's default
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / cpp / defined_trad.c
1 /* Copyright (C) 2000 Free Software Foundation, Inc.  */
2
3 /* { dg-do preprocess } */
4 /* { dg-options "-traditional" } */
5
6 /* Tests tradcpp0 with defined.  The defined operator in traditional C
7    works just the same as the defined operator in Standard C.  */
8
9 /* Source: Zack Weinberg, glibc, Neil Booth 11 Dec 2000.  */
10
11 #if defined REGPARMS
12 #error REGPARMS should not be defined
13 #endif
14
15 #define REGPARMS 1
16 #if !defined REGPARMS
17 #error REGPARMS should be defined
18 #endif
19
20 #define defined                 /* { dg-error "defined" } */
21
22 /* No diagnostics, though you could argue there should be.  */
23 #if defined defined
24 #error defined is defined!
25 #endif
26
27 #define is_Z_defined defined Z
28
29 #if defined Z
30 #error Z is not defined
31 #endif
32
33 /* The behaviour of "defined" when it comes from a macro expansion is
34    now documented.  */
35 #if is_Z_defined
36 #error Macro expanding into defined operator test 1
37 #endif
38
39 #define Z
40
41 #if !defined Z
42 #error Z is defined
43 #endif
44
45 #if !is_Z_defined
46 #error Macro expanding into defined operator test 2
47 #endif
48
49 #undef is_Z_defined
50 #undef Z
51
52 /* Do all the tests over again with the () form of defined.  */
53
54 /* No diagnostics, though you could argue there should be.  */
55 #if defined(defined)
56 #error defined is defined!
57 #endif
58
59 #define is_Z_defined defined ( Z )
60
61 #if defined(Z)
62 #error Z is not defined
63 #endif
64
65 /* The behaviour of "defined" when it comes from a macro expansion is
66    now documented.  */
67 #if is_Z_defined
68 #error Macro expanding into defined operator test 1
69 #endif
70
71 #define Z
72
73 #if !defined(Z)
74 #error Z is defined
75 #endif
76
77 #if !is_Z_defined
78 #error Macro expanding into defined operator test 2
79 #endif