OSDN Git Service

libcpp/
authorjanis <janis@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 14 May 2007 23:45:40 +0000 (23:45 +0000)
committerjanis <janis@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 14 May 2007 23:45:40 +0000 (23:45 +0000)
        * expr.c (cpp_classify_number): Warn about dfp constant for -pedantic.
gcc/testsuite/
        * gcc.dg/fltconst-pedantic-dfp.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124731 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/fltconst-pedantic-dfp.c [new file with mode: 0644]
libcpp/ChangeLog
libcpp/expr.c

index b195815..159cee5 100644 (file)
@@ -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 (file)
index 0000000..d0d1c4c
--- /dev/null
@@ -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" } */
index 5b941ff..31d96e8 100644 (file)
@@ -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.
 
index 8401dae..2009019 100644 (file)
@@ -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