diff options
author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-10-29 17:43:57 +0000 |
---|---|---|
committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-10-29 17:43:57 +0000 |
commit | b45dd3f3246a32b0075200134a86b2a399f772d4 (patch) | |
tree | 866bc0a0d9329f355ba4833ecdfb5908e7e5b5e4 /gcc/testsuite/gcc.dg/cpp/defined.c | |
parent | a5c5bf603aed687add695642f3d99db78ea92a0e (diff) | |
download | gcc-b45dd3f3246a32b0075200134a86b2a399f772d4.tar.gz |
* gcc.dg/cpp/defined.c, include1.c, paste11.c, skipping.c:
New tests.
* gcc.dg/cpp/macsyntx.c: Move test to defined.c.
* gcc.dg/cpp/mi3.c, mi3.h: New test for over-enthusiastic
optimisation.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37126 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/cpp/defined.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/defined.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/cpp/defined.c b/gcc/testsuite/gcc.dg/cpp/defined.c new file mode 100644 index 00000000000..0e82f7e1f50 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/defined.c @@ -0,0 +1,27 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Tests behaviour of the defined operator. */ + +/* Source: Neil Booth, 29 Oct 2000. */ + +/* No diagnostics, though you could argue there should be. */ +#if defined defined +#error defined is defined! +#endif + +#define defined /* { dg-error "defined" } */ + +#define is_Z_defined defined Z + +/* The behaviour of "defined" when it comes from a macro expansion is + now documented. */ +#if is_Z_defined /* { dg-warning "macro expansion" } */ +#error Macro expanding into defined operator test 1 +#endif + +#define Z +#if !is_Z_defined /* { dg-warning "macro expansion" } */ +#error Macro expanding into defined operator test 2 +#endif |