PR c++/81852 define feature-test macro for -fthreadsafe-statics
authorJonathan Wakely <jwakely@redhat.com>
Sat, 9 Sep 2017 14:32:25 +0000 (15:32 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Sat, 9 Sep 2017 14:32:25 +0000 (15:32 +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.
* g++.dg/cpp1z/feat-cxx1z.C: Likewise.

From-SVN: r251939

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
gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C

index 9886dcd86b29f06a6b76d726a93e088c90087885..3d959492d11762421b6106848d66ef9995ea1388 100644 (file)
@@ -1,3 +1,8 @@
+2017-09-09  Jonathan Wakely  <jwakely@redhat.com>
+
+       PR c++/81852
+       * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_threadsafe_static_init.
+
 2017-09-04  Marek Polacek  <polacek@redhat.com>
 
        PR c/81783
index 8f377f698a63c0ee38f2295184c7c6f480a852b9..4330c9102d9fedab7894efcd2024987577e165e5 100644 (file)
@@ -987,6 +987,8 @@ c_cpp_builtins (cpp_reader *pfile)
        }
       if (flag_new_ttp)
        cpp_define (pfile, "__cpp_template_template_args=201611");
+      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 35aadc7952de4bab6a13bec72f4992284845e359..fdd128c58cf26327d762177a21e33f0a049d37b0 100644 (file)
@@ -1,3 +1,12 @@
+2017-09-09  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.
+       * g++.dg/cpp1z/feat-cxx1z.C: Likewise.
+
 2017-09-09  Pierre-Marie de Rodat  <derodat@adacore.com>
 
        * gnat.dg/debug14.adb: New test.
index 98112218d8ff0e7b29fa30db3b158d1ffd33741c..b18fcfabad4ac504be46add2944b050f83520f4c 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 3b141ef67c452bf5d9bfb98f7e97526b1c74c1ea..412b9a33b8f46456b0ebec369a2167d645754e44 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
index e424e1c0ff01a2abe59033efe95029eaad1e27e4..a7c6cfe516945bdd10d42471d58f805fd25f570b 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