From 13b380a3257189e5232010c982b8c691b348482c Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 19 Oct 2015 22:48:36 -0400 Subject: [PATCH] c-cppbuiltin.c (c_cpp_builtins): Define __cpp_enumerator_attributes... * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_enumerator_attributes, __cpp_fold_expressions, __cpp_unicode_characters. From-SVN: r229017 --- gcc/c-family/ChangeLog | 6 ++++++ gcc/c-family/c-cppbuiltin.c | 6 +++++- gcc/testsuite/g++.dg/cpp1z/attributes-enum-1.C | 9 +++++++++ gcc/testsuite/g++.dg/cpp1z/attributes-enum-1a.C | 5 +++++ gcc/testsuite/g++.dg/cpp1z/fold7.C | 9 +++++++++ gcc/testsuite/g++.dg/cpp1z/fold7a.C | 5 +++++ gcc/testsuite/g++.dg/cpp1z/utf8-2.C | 9 +++++++++ gcc/testsuite/g++.dg/cpp1z/utf8-2a.C | 5 +++++ 8 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp1z/attributes-enum-1.C create mode 100644 gcc/testsuite/g++.dg/cpp1z/attributes-enum-1a.C create mode 100644 gcc/testsuite/g++.dg/cpp1z/fold7.C create mode 100644 gcc/testsuite/g++.dg/cpp1z/fold7a.C create mode 100644 gcc/testsuite/g++.dg/cpp1z/utf8-2.C create mode 100644 gcc/testsuite/g++.dg/cpp1z/utf8-2a.C diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 4521a275b36..abcba2910dc 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2015-10-19 Jason Merrill + + * c-cppbuiltin.c (c_cpp_builtins): Define + __cpp_enumerator_attributes, __cpp_fold_expressions, + __cpp_unicode_characters. + 2015-10-13 Jakub Jelinek Aldy Hernandez diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index 35d246bb7b1..cd6fd51ba2f 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -833,7 +833,8 @@ c_cpp_builtins (cpp_reader *pfile) if (cxx_dialect >= cxx11) { /* Set feature test macros for C++11. */ - cpp_define (pfile, "__cpp_unicode_characters=200704"); + if (cxx_dialect <= cxx14) + cpp_define (pfile, "__cpp_unicode_characters=200704"); cpp_define (pfile, "__cpp_raw_strings=200710"); cpp_define (pfile, "__cpp_unicode_literals=200710"); cpp_define (pfile, "__cpp_user_defined_literals=200809"); @@ -869,9 +870,12 @@ c_cpp_builtins (cpp_reader *pfile) if (cxx_dialect > cxx14) { /* Set feature test macros for C++1z. */ + cpp_define (pfile, "__cpp_unicode_characters=201411"); cpp_define (pfile, "__cpp_static_assert=201411"); cpp_define (pfile, "__cpp_namespace_attributes=201411"); + cpp_define (pfile, "__cpp_enumerator_attributes=201411"); cpp_define (pfile, "__cpp_nested_namespace_definitions=201411"); + cpp_define (pfile, "__cpp_fold_expressions=201411"); } if (flag_concepts) /* Use a value smaller than the 201507 specified in diff --git a/gcc/testsuite/g++.dg/cpp1z/attributes-enum-1.C b/gcc/testsuite/g++.dg/cpp1z/attributes-enum-1.C new file mode 100644 index 00000000000..1f8f8486de8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/attributes-enum-1.C @@ -0,0 +1,9 @@ +// { dg-options "-std=c++1z" } + +#ifndef __cpp_enumerator_attributes +#error __cpp_enumerator_attributes not defined +#endif + +#if __cpp_enumerator_attributes != 201411 +#error Wrong value for __cpp_enumerator_attributes +#endif diff --git a/gcc/testsuite/g++.dg/cpp1z/attributes-enum-1a.C b/gcc/testsuite/g++.dg/cpp1z/attributes-enum-1a.C new file mode 100644 index 00000000000..f321ba1cd97 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/attributes-enum-1a.C @@ -0,0 +1,5 @@ +// This macro should not be defined without -std=c++1z. + +#ifdef __cpp_enumerator_attributes +#error __cpp_enumerator_attributes defined +#endif diff --git a/gcc/testsuite/g++.dg/cpp1z/fold7.C b/gcc/testsuite/g++.dg/cpp1z/fold7.C new file mode 100644 index 00000000000..3e6925ad2e1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/fold7.C @@ -0,0 +1,9 @@ +// { dg-options "-std=c++1z" } + +#ifndef __cpp_fold_expressions +#error __cpp_fold_expressions not defined +#endif + +#if __cpp_fold_expressions != 201411 +#error Wrong value for __cpp_fold_expressions +#endif diff --git a/gcc/testsuite/g++.dg/cpp1z/fold7a.C b/gcc/testsuite/g++.dg/cpp1z/fold7a.C new file mode 100644 index 00000000000..d56cefb1ec4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/fold7a.C @@ -0,0 +1,5 @@ +// This macro should not be defined without -std=c++1z. + +#ifdef __cpp_fold_expressions +#error __cpp_fold_expressions defined +#endif diff --git a/gcc/testsuite/g++.dg/cpp1z/utf8-2.C b/gcc/testsuite/g++.dg/cpp1z/utf8-2.C new file mode 100644 index 00000000000..152762f6d5a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/utf8-2.C @@ -0,0 +1,9 @@ +// { dg-options "-std=c++1z" } + +#ifndef __cpp_unicode_characters +#error __cpp_unicode_characters not defined +#endif + +#if __cpp_unicode_characters != 201411 +#error Wrong value for __cpp_unicode_characters +#endif diff --git a/gcc/testsuite/g++.dg/cpp1z/utf8-2a.C b/gcc/testsuite/g++.dg/cpp1z/utf8-2a.C new file mode 100644 index 00000000000..9985cd04140 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/utf8-2a.C @@ -0,0 +1,5 @@ +// This macro should not be 201411 without -std=c++1z. + +#if __cpp_unicode_characters == 201411 +#error Wrong value for __cpp_unicode_characters +#endif -- 2.30.2