diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-03-15 12:08:31 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-03-15 12:08:31 +0000 |
commit | 14c36b1402b82304739e865a27cb1aed0d87ec73 (patch) | |
tree | 5ca057b6eafdc0abc79daff46e0295d6744dbbfd | |
parent | 381c9de17f162d254e184389963319019c763408 (diff) |
* libcpp/expr.c (cpp_classify_number): Hex floats are new in C++1z.
* 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
-rw-r--r-- | gcc/c-family/ChangeLog | 2 | ||||
-rw-r--r-- | gcc/c-family/c-cppbuiltin.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp/pr23827_cxx98_neg.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C | 6 | ||||
-rw-r--r-- | libcpp/ChangeLog | 5 | ||||
-rw-r--r-- | libcpp/expr.c | 2 | ||||
-rw-r--r-- | libcpp/init.c | 4 |
7 files changed, 21 insertions, 4 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 620c8069e0d..d00d9d90947 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -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> diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index dc1f426c7a8..ee953ca44c8 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -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 diff --git a/gcc/testsuite/g++.dg/cpp/pr23827_cxx98_neg.C b/gcc/testsuite/g++.dg/cpp/pr23827_cxx98_neg.C index 39d9fe4d1e0..a0e468c5e62 100644 --- a/gcc/testsuite/g++.dg/cpp/pr23827_cxx98_neg.C +++ b/gcc/testsuite/g++.dg/cpp/pr23827_cxx98_neg.C @@ -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" } diff --git a/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C b/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C index c25db24d214..3dc358f4e4b 100644 --- a/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C +++ b/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C @@ -337,3 +337,9 @@ #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 diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 19b9310bb86..a2cb02f68a5 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -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 diff --git a/libcpp/expr.c b/libcpp/expr.c index 5353bdeff0d..5cdca6f1bec 100644 --- a/libcpp/expr.c +++ b/libcpp/expr.c @@ -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"); diff --git a/libcpp/init.c b/libcpp/init.c index 6bc42960470..4343075ba85 100644 --- a/libcpp/init.c +++ b/libcpp/init.c @@ -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 } |