]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* libcpp/expr.c (cpp_classify_number): Hex floats are new in C++1z.
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 15 Mar 2016 12:08:31 +0000 (12:08 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 15 Mar 2016 12:08:31 +0000 (12:08 +0000)
* libcpp/init.c (lang_defaults): Likewise.
* gcc/c-family/c-cppbuiltin.c (c_cpp_builtins): Set __cpp_hex_float.

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

gcc/c-family/ChangeLog
gcc/c-family/c-cppbuiltin.c
gcc/testsuite/g++.dg/cpp/pr23827_cxx98_neg.C
gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C
libcpp/ChangeLog
libcpp/expr.c
libcpp/init.c

index 620c8069e0d94cae13ff49d1c778e3c0b8009093..d00d9d90947dbf736fbf2d9e16c6299349da3db0 100644 (file)
@@ -1,5 +1,7 @@
 2016-03-14  Jason Merrill  <jason@redhat.com>
 
+       * c-cppbuiltin.c (c_cpp_builtins): Set __cpp_hex_float.
+
        * c-cppbuiltin.c (c_cpp_builtins): Bump __cpp_range_based_for.
 
 2016-03-09  Richard Biener  <rguenther@suse.de>
index dc1f426c7a87b0a5dcc00d241270d24d8d46a744..ee953ca44c82abf9f79c3551dd61685957b36ac5 100644 (file)
@@ -818,6 +818,10 @@ c_cpp_builtins (cpp_reader *pfile)
       if (!pedantic || cxx_dialect > cxx11)
        cpp_define (pfile, "__cpp_binary_literals=201304");
 
+      /* Similarly for hexadecimal floating point literals and C++17.  */
+      if (!pedantic || cpp_get_options (parse_in)->extended_numbers)
+       cpp_define (pfile, "__cpp_hex_float=201603");
+
       /* Arrays of runtime bound were removed from C++14, but we still
         support GNU VLAs.  Let's define this macro to a low number
         (corresponding to the initial test release of GNU C++) if we won't
index 39d9fe4d1e02058fcba806c1642f9e2774fe8c2a..a0e468c5e62735166582e797a88ac6619099acb9 100644 (file)
@@ -1,4 +1,4 @@
 // { dg-do compile { target c++98_only } }
 /* { dg-options "-ansi -pedantic-errors" }  */
 
-double x = 0x3.1415babep0; // { dg-error "use of C..11 hexadecimal floating constant" }
+double x = 0x3.1415babep0; // { dg-error "use of C..1z hexadecimal floating constant" }
index c25db24d214018675fdc601cdf41b0f7c99777fe..3dc358f4e4bf8ab23cfd4a49bf390a9f7c3f89ff 100644 (file)
 #elif __cpp_nontype_template_args != 201411
 #  error "__cpp_nontype_template_args != 201411"
 #endif
+
+#ifndef __cpp_hex_float
+#  error "__cpp_hex_float"
+#elif __cpp_hex_float != 201603
+#  error "__cpp_hex_float != 201603"
+#endif
index 19b9310bb8647feec1098bf94069979cadbc3ebc..a2cb02f68a5623bba48d2f8990ae7af2911e8900 100644 (file)
@@ -1,3 +1,8 @@
+2016-03-14  Jason Merrill  <jason@redhat.com>
+
+       * expr.c (cpp_classify_number): Hex floats are new in C++1z.
+       * init.c (lang_defaults): Likewise.
+
 2016-03-09  David Malcolm  <dmalcolm@redhat.com>
 
        PR c/68473
index 5353bdeff0d540b5835c7b98f70097f7a7284551..5cdca6f1bec6453cfd494fc4d8b39ed207246714 100644 (file)
@@ -552,7 +552,7 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token,
        {
          if (CPP_OPTION (pfile, cplusplus))
            cpp_error_with_line (pfile, CPP_DL_PEDWARN, virtual_location, 0,
-                                "use of C++11 hexadecimal floating constant");
+                                "use of C++1z hexadecimal floating constant");
          else
            cpp_error_with_line (pfile, CPP_DL_PEDWARN, virtual_location, 0,
                                 "use of C99 hexadecimal floating constant");
index 6bc429604703f39a3584d44ad9b3da28621c9d2b..4343075ba85246a6c87c487107ecec91156c16ac 100644 (file)
@@ -105,9 +105,9 @@ static const struct lang_flags lang_defaults[] =
   /* GNUCXX   */  { 0,  1,  1,  1,  0,  0,  1,   0,   0,   0,    0,     0,     0,   0 },
   /* CXX98    */  { 0,  1,  0,  1,  0,  1,  1,   0,   0,   0,    0,     0,     1,   0 },
   /* GNUCXX11 */  { 1,  1,  1,  1,  1,  0,  1,   1,   1,   1,    0,     0,     0,   0 },
-  /* CXX11    */  { 1,  1,  1,  1,  1,  1,  1,   1,   1,   1,    0,     0,     1,   0 },
+  /* CXX11    */  { 1,  1,  0,  1,  1,  1,  1,   1,   1,   1,    0,     0,     1,   0 },
   /* GNUCXX14 */  { 1,  1,  1,  1,  1,  0,  1,   1,   1,   1,    1,     1,     0,   0 },
-  /* CXX14    */  { 1,  1,  1,  1,  1,  1,  1,   1,   1,   1,    1,     1,     1,   0 },
+  /* CXX14    */  { 1,  1,  0,  1,  1,  1,  1,   1,   1,   1,    1,     1,     1,   0 },
   /* GNUCXX1Z */  { 1,  1,  1,  1,  1,  0,  1,   1,   1,   1,    1,     1,     0,   1 },
   /* CXX1Z    */  { 1,  1,  1,  1,  1,  1,  1,   1,   1,   1,    1,     1,     0,   1 },
   /* ASM      */  { 0,  0,  1,  0,  0,  0,  0,   0,   0,   0,    0,     0,     0,   0 }