1 /* Copyright (C) 2000 Free Software Foundation, Inc. */
3 /* { dg-do preprocess } */
5 /* Tests behavior of the defined operator. */
7 /* Source: Neil Booth, 29 Oct 2000, Zack Weinberg 11 Dec 2000. */
9 #define defined /* { dg-error "defined" } */
11 /* No diagnostics, though you could argue there should be. */
13 #error defined is defined!
16 #define is_Z_defined defined Z
19 #error Z is not defined
22 /* The behavior of "defined" when it comes from a macro expansion is
25 #error Macro expanding into defined operator test 1
35 #error Macro expanding into defined operator test 2
41 /* Do all the tests over again with the () form of defined. */
43 /* No diagnostics, though you could argue there should be. */
45 #error defined is defined!
48 #define is_Z_defined defined ( Z )
51 #error Z is not defined
54 /* The behavior of "defined" when it comes from a macro expansion is
57 #error Macro expanding into defined operator test 1
67 #error Macro expanding into defined operator test 2
70 /* Use of defined in different contexts. */
73 #if !bad1 Z /* { dg-warning "may not be portable" } */
77 #if !bad1 (Z) /* { dg-warning "may not be portable" } */
81 #define bad2 defined (Z
82 #if !bad2) /* { dg-warning "may not be portable" } */