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
This commit is contained in:
parent
30e0492187
commit
5a6bb57eb9
4 changed files with 14 additions and 0 deletions
|
@ -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.
|
||||
|
||||
|
|
6
gcc/testsuite/gcc.dg/fltconst-pedantic-dfp.c
Normal file
6
gcc/testsuite/gcc.dg/fltconst-pedantic-dfp.c
Normal file
|
@ -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" } */
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue