Commit 2aaeea19 by Jason Merrill Committed by Jason Merrill

expr.c (cpp_classify_number): Hex floats are new in C++1z.

	* 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.

From-SVN: r234213
parent 08da2581
2016-03-14 Jason Merrill <jason@redhat.com> 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. * c-cppbuiltin.c (c_cpp_builtins): Bump __cpp_range_based_for.
2016-03-09 Richard Biener <rguenther@suse.de> 2016-03-09 Richard Biener <rguenther@suse.de>
......
...@@ -818,6 +818,10 @@ c_cpp_builtins (cpp_reader *pfile) ...@@ -818,6 +818,10 @@ c_cpp_builtins (cpp_reader *pfile)
if (!pedantic || cxx_dialect > cxx11) if (!pedantic || cxx_dialect > cxx11)
cpp_define (pfile, "__cpp_binary_literals=201304"); 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 /* Arrays of runtime bound were removed from C++14, but we still
support GNU VLAs. Let's define this macro to a low number 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 (corresponding to the initial test release of GNU C++) if we won't
......
// { dg-do compile { target c++98_only } } // { dg-do compile { target c++98_only } }
/* { dg-options "-ansi -pedantic-errors" } */ /* { 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" }
...@@ -337,3 +337,9 @@ ...@@ -337,3 +337,9 @@
#elif __cpp_nontype_template_args != 201411 #elif __cpp_nontype_template_args != 201411
# error "__cpp_nontype_template_args != 201411" # error "__cpp_nontype_template_args != 201411"
#endif #endif
#ifndef __cpp_hex_float
# error "__cpp_hex_float"
#elif __cpp_hex_float != 201603
# error "__cpp_hex_float != 201603"
#endif
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> 2016-03-09 David Malcolm <dmalcolm@redhat.com>
PR c/68473 PR c/68473
......
...@@ -552,7 +552,7 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token, ...@@ -552,7 +552,7 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token,
{ {
if (CPP_OPTION (pfile, cplusplus)) if (CPP_OPTION (pfile, cplusplus))
cpp_error_with_line (pfile, CPP_DL_PEDWARN, virtual_location, 0, 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 else
cpp_error_with_line (pfile, CPP_DL_PEDWARN, virtual_location, 0, cpp_error_with_line (pfile, CPP_DL_PEDWARN, virtual_location, 0,
"use of C99 hexadecimal floating constant"); "use of C99 hexadecimal floating constant");
......
...@@ -105,9 +105,9 @@ static const struct lang_flags lang_defaults[] = ...@@ -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 }, /* 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 }, /* 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 }, /* 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 }, /* 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 }, /* 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 }, /* 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 } /* ASM */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
......
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