mirror of
https://gcc.gnu.org/git/gcc.git
synced 2025-01-10 21:13:46 +08:00
cppexp.c (eval_token): Permit true and false even if pedantic.
* 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. From-SVN: r65811
This commit is contained in:
parent
bf805def61
commit
4e1f0f8e1f
@ -1,3 +1,7 @@
|
||||
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.
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -1,3 +1,8 @@
|
||||
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.
|
||||
|
@ -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.
|
||||
|
17
gcc/testsuite/gcc.dg/cpp/truefalse.cpp
Normal file
17
gcc/testsuite/gcc.dg/cpp/truefalse.cpp
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user