diff options
author | Janis Johnson <janis187@us.ibm.com> | 2007-05-14 23:45:40 +0000 |
---|---|---|
committer | Janis Johnson <janis@gcc.gnu.org> | 2007-05-14 23:45:40 +0000 |
commit | 5a6bb57eb9ad3397408aedca5c362ef36340a907 (patch) | |
tree | df0bccc33a1c52f690ba0aed1805effa9212b0ad | |
parent | 30e04921873057fd9c85458127e51862d0cf2304 (diff) | |
download | gcc-5a6bb57eb9ad3397408aedca5c362ef36340a907.zip gcc-5a6bb57eb9ad3397408aedca5c362ef36340a907.tar.gz gcc-5a6bb57eb9ad3397408aedca5c362ef36340a907.tar.bz2 |
expr.c (cpp_classify_number): Warn about dfp constant for -pedantic.
libcpp/
* expr.c (cpp_classify_number): Warn about dfp constant for -pedantic.
gcc/testsuite/
* gcc.dg/fltconst-pedantic-dfp.c: New test.
From-SVN: r124731
-rw-r--r-- | gcc/testsuite/ChangeLog | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/fltconst-pedantic-dfp.c | 6 | ||||
-rw-r--r-- | libcpp/ChangeLog | 2 | ||||
-rw-r--r-- | libcpp/expr.c | 4 |
4 files changed, 14 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b195815..159cee5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2007-05-14 Janis Johnson <janis187@us.ibm.com> + * expr.c (cpp_classify_number): Warn about dfp constant for -pedantic. + PR c/31924 * gcc.dg/fltconst-1.c: New test. diff --git a/gcc/testsuite/gcc.dg/fltconst-pedantic-dfp.c b/gcc/testsuite/gcc.dg/fltconst-pedantic-dfp.c new file mode 100644 index 0000000..d0d1c4c --- /dev/null +++ b/gcc/testsuite/gcc.dg/fltconst-pedantic-dfp.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-pedantic" } */ + +double a = 1.dl; /* { dg-warning "decimal float" } */ +double b = 1.df; /* { dg-warning "decimal float" } */ +double c = 1.dd; /* { dg-warning "decimal float" } */ diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 5b941ff..31d96e8 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,5 +1,7 @@ 2007-05-14 Janis Johnson <janis187@us.ibm.com> + * expr.c (cpp_classify_number): Warn about dfp constant for -pedantic. + PR c/31924 * expr.c (interpret_float_suffix): Check for invalid suffix. diff --git a/libcpp/expr.c b/libcpp/expr.c index 8401dae..2009019 100644 --- a/libcpp/expr.c +++ b/libcpp/expr.c @@ -273,6 +273,10 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token) return CPP_N_INVALID; } + if ((result & CPP_N_DFLOAT) && CPP_PEDANTIC (pfile)) + cpp_error (pfile, CPP_DL_PEDWARN, + "decimal float constants are a GCC extension"); + result |= CPP_N_FLOATING; } else |