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