Commit 5a6bb57e by Janis Johnson Committed by Janis Johnson

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
parent 30e04921
2007-05-14 Janis Johnson <janis187@us.ibm.com> 2007-05-14 Janis Johnson <janis187@us.ibm.com>
* expr.c (cpp_classify_number): Warn about dfp constant for -pedantic.
PR c/31924 PR c/31924
* gcc.dg/fltconst-1.c: New test. * gcc.dg/fltconst-1.c: New test.
/* { 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" } */
2007-05-14 Janis Johnson <janis187@us.ibm.com> 2007-05-14 Janis Johnson <janis187@us.ibm.com>
* expr.c (cpp_classify_number): Warn about dfp constant for -pedantic.
PR c/31924 PR c/31924
* expr.c (interpret_float_suffix): Check for invalid suffix. * expr.c (interpret_float_suffix): Check for invalid suffix.
......
...@@ -273,6 +273,10 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token) ...@@ -273,6 +273,10 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token)
return CPP_N_INVALID; 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; result |= CPP_N_FLOATING;
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment