c-cppbuiltin.c (c_cpp_builtins): Define __cpp_enumerator_attributes...
authorJason Merrill <jason@redhat.com>
Tue, 20 Oct 2015 02:48:36 +0000 (22:48 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 20 Oct 2015 02:48:36 +0000 (22:48 -0400)
* c-cppbuiltin.c (c_cpp_builtins): Define
__cpp_enumerator_attributes, __cpp_fold_expressions,
__cpp_unicode_characters.

From-SVN: r229017

gcc/c-family/ChangeLog
gcc/c-family/c-cppbuiltin.c
gcc/testsuite/g++.dg/cpp1z/attributes-enum-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/attributes-enum-1a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/fold7.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/fold7a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/utf8-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/utf8-2a.C [new file with mode: 0644]

index 4521a275b36b5a910c52ce1bf84b21017e8f64a8..abcba2910dcfb38bb6df16e1ab1c487c75f5c944 100644 (file)
@@ -1,3 +1,9 @@
+2015-10-19  Jason Merrill  <jason@redhat.com>
+
+       * c-cppbuiltin.c (c_cpp_builtins): Define
+       __cpp_enumerator_attributes, __cpp_fold_expressions,
+       __cpp_unicode_characters.
+
 2015-10-13  Jakub Jelinek  <jakub@redhat.com>
            Aldy Hernandez  <aldyh@redhat.com>
 
index 35d246bb7b1729c15531dd334a88fa0a09bb733d..cd6fd51ba2f2d0566b3114ab45f49f4bfa6b1010 100644 (file)
@@ -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 (file)
index 0000000..1f8f848
--- /dev/null
@@ -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 (file)
index 0000000..f321ba1
--- /dev/null
@@ -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 (file)
index 0000000..3e6925a
--- /dev/null
@@ -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 (file)
index 0000000..d56cefb
--- /dev/null
@@ -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 (file)
index 0000000..152762f
--- /dev/null
@@ -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 (file)
index 0000000..9985cd0
--- /dev/null
@@ -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