diff options
author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-04-19 10:04:47 +0000 |
---|---|---|
committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-04-19 10:04:47 +0000 |
commit | 74f1f30f2ebe5731fd1ae6b153fadaa737eeea83 (patch) | |
tree | 95f32f4463e62cdb21c1f10503cffc8f1bba5e93 | |
parent | 97db25e7cfe7c489b31ce5c005ef52513a7d9e9d (diff) | |
download | gcc-74f1f30f2ebe5731fd1ae6b153fadaa737eeea83.tar.gz |
* cppexp.c (eval_token): Permit true and false even if pedantic.
testsuite:
* gcc.dg/cpp/truefalse.cpp: New test.
* gcc.dg/cpp/cpp.exp: Update.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65811 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cppexp.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/cpp.exp | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/truefalse.cpp | 17 |
5 files changed, 27 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2ff09ffacad..5be40867c90 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2003-04-19 Neil Booth <neil@daikokuya.co.uk> + * cppexp.c (eval_token): Permit true and false even if pedantic. + +2003-04-19 Neil Booth <neil@daikokuya.co.uk> + * cpplex.c (skip_whitespace): Rearrange to avoid stage1 ICE. 2003-04-19 Neil Booth <neil@daikokuya.co.uk> diff --git a/gcc/cppexp.c b/gcc/cppexp.c index 59a08e90a67..9ab7b5fa14b 100644 --- a/gcc/cppexp.c +++ b/gcc/cppexp.c @@ -590,14 +590,6 @@ eval_token (pfile, token) { result.high = 0; result.low = (token->val.node == pfile->spec_nodes.n_true); - - /* Warn about use of true or false in #if when pedantic - and stdbool.h has not been included. */ - if (CPP_PEDANTIC (pfile) - && ! cpp_defined (pfile, DSC("__bool_true_false_are_defined"))) - cpp_error (pfile, DL_PEDWARN, - "ISO C++ does not permit \"%s\" in #if", - NODE_NAME (token->val.node)); } else { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fc71e0cf9c3..0eae036feb3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2003-04-19 Neil Booth <neil@daikokuya.co.uk> + * gcc.dg/cpp/truefalse.cpp: New test. + * gcc.dg/cpp/cpp.exp: Update. + +2003-04-19 Neil Booth <neil@daikokuya.co.uk> + * gcc.dg/cpp/_Pragma4.c: Remove stray space. * gcc.dg/cpp/trad/escaped-eof.c: Correct line number. diff --git a/gcc/testsuite/gcc.dg/cpp/cpp.exp b/gcc/testsuite/gcc.dg/cpp/cpp.exp index d477433c3b2..47c20ffb201 100644 --- a/gcc/testsuite/gcc.dg/cpp/cpp.exp +++ b/gcc/testsuite/gcc.dg/cpp/cpp.exp @@ -36,7 +36,7 @@ if ![info exists DEFAULT_CFLAGS] then { dg-init # Main loop. -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \ +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{c,cpp,S} ]] \ "" $DEFAULT_CFLAGS # All done. diff --git a/gcc/testsuite/gcc.dg/cpp/truefalse.cpp b/gcc/testsuite/gcc.dg/cpp/truefalse.cpp new file mode 100644 index 00000000000..d852d4e2f21 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/truefalse.cpp @@ -0,0 +1,17 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. */ + +/* Source: Neil Booth, 18 Apr 2003. */ + +/* { dg-do preprocess } */ +/* { dg-options "-ansi -pedantic -Wundef" } */ + +/* Check that for C++ we handle true and false correctly, and do not + treat them as undefined identifiers. */ + +#if true /* { dg-bogus "is not defined" } */ +#error foo /* { dg-error "foo" } */ +#endif + +#if false /* { dg-bogus "is not defined" } */ +#error foo /* { dg-bogus "foo" } */ +#endif |