]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c++/81852 define feature-test macro for -fthreadsafe-statics
authorJonathan Wakely <jwakely@redhat.com>
Mon, 11 Sep 2017 10:44:11 +0000 (11:44 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Mon, 11 Sep 2017 10:44:11 +0000 (11:44 +0100)
gcc/c-family:

PR c++/81852
* c-cppbuiltin.c (c_cpp_builtins): Define __cpp_threadsafe_static_init.

gcc/testsuite:

PR c++/81852
* g++.dg/cpp1y/feat-cxx11.C: Check __cpp_threadsafe_static_init.
* g++.dg/cpp1y/feat-cxx14.C: Likewise.
* g++.dg/cpp1y/feat-cxx98.C: Likewise.
* g++.dg/cpp1y/feat-neg.C: Likewise.

From-SVN: r251975

gcc/c-family/ChangeLog
gcc/c-family/c-cppbuiltin.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C
gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C
gcc/testsuite/g++.dg/cpp1y/feat-cxx98.C
gcc/testsuite/g++.dg/cpp1y/feat-neg.C

index f32254a5e03768e20310cf986ffc657ce079300e..1a22975acefe6839f1ff96e9930156fdfb8b5514 100644 (file)
@@ -1,3 +1,8 @@
+2017-09-11  Jonathan Wakely  <jwakely@redhat.com>
+
+       PR c++/81852
+       * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_threadsafe_static_init.
+
 2017-05-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
index 2ab7727b6b1ed745edfbf6f0e07770b26b6e83c5..f9365ace2ba5b32cd0dd099fd220985e2f3340fe 100644 (file)
@@ -879,6 +879,8 @@ c_cpp_builtins (cpp_reader *pfile)
        }
       if (flag_sized_deallocation)
        cpp_define (pfile, "__cpp_sized_deallocation=201309");
+      if (flag_threadsafe_statics)
+       cpp_define (pfile, "__cpp_threadsafe_static_init=200806");
     }
   /* Note that we define this for C as well, so that we know if
      __attribute__((cleanup)) will interface with EH.  */
index 8556eabccbcbb76e65495b05292305ac37b26a00..f229b5fb9c7032c36cbcab1c9b8f831d7b1b5330 100644 (file)
@@ -1,3 +1,11 @@
+2017-09-11  Jonathan Wakely  <jwakely@redhat.com>
+
+       PR c++/81852
+       * g++.dg/cpp1y/feat-cxx11.C: Check __cpp_threadsafe_static_init.
+       * g++.dg/cpp1y/feat-cxx14.C: Likewise.
+       * g++.dg/cpp1y/feat-cxx98.C: Likewise.
+       * g++.dg/cpp1y/feat-neg.C: Likewise.
+
 2017-09-06  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
        Backport from mainline:
index 53e7ded39ddb801bdea3debd57312b40a8f439d9..492df56a8b1591d45a5778345d90068cb336b6fe 100644 (file)
 #  error "__cpp_alias_templates != 200704"
 #endif
 
+#ifndef __cpp_threadsafe_static_init
+#  error "__cpp_threadsafe_static_init"
+#elif __cpp_threadsafe_static_init != 200806
+#  error "__cpp_threadsafe_static_init != 200806"
+#endif
+
 //  C++14 features allowed in C++11 in non-ANSI modes:
 
 #ifndef __cpp_binary_literals
index 29b07948fff1ca17197de17bdbc31e31375ed254..346433122eabd4be3bbc3c5a2ba8c5be61a400d6 100644 (file)
 #  error "__cpp_alias_templates != 200704"
 #endif
 
+#ifndef __cpp_threadsafe_static_init
+#  error "__cpp_threadsafe_static_init"
+#elif __cpp_threadsafe_static_init != 200806
+#  error "__cpp_threadsafe_static_init != 200806"
+#endif
+
 //  C++14 features:
 
 #ifndef __cpp_binary_literals
index d15e7aadcee1118e4bc0dac471f07803b2a7003f..4db499cc2f4688dd1bf7de23620e004cfd4314ca 100644 (file)
 #  error "__cpp_exceptions != 199711"
 #endif
 
+//  C++11 features allowed in C++98:
+
+#ifndef __cpp_threadsafe_static_init
+#  error "__cpp_threadsafe_static_init"
+#elif __cpp_threadsafe_static_init != 200806
+#  error "__cpp_threadsafe_static_init != 200806"
+#endif
+
 //  C++14 features allowed in C++98 in non-ANSI modes:
 
 #ifndef __cpp_binary_literals
index 9f4a0412403984dade8d47bc4ffdaa6ddeac3dfb..5e95418dfe48bd968df1c40d0152bd7fb54db3a3 100644 (file)
@@ -1,5 +1,5 @@
 // { dg-do compile }
-// { dg-options "-fno-rtti -fno-exceptions" }
+// { dg-options "-fno-rtti -fno-exceptions -fno-threadsafe-statics" }
 
 //  C++98 features with explicit opt-out:
 
@@ -10,3 +10,9 @@
 #ifndef __cpp_exceptions
 #  error "__cpp_exceptions" // { dg-error "error" }
 #endif
+
+//  C++11 features with explicit opt-out:
+
+#ifndef __cpp_threadsafe_static_init
+#  error "__cpp_threadsafe_static_init" // { dg-error "error" }
+#endif