Commit 019bf9ad by Jonathan Wakely Committed by Jonathan Wakely

PR c++/81852 define feature-test macro for -fthreadsafe-statics

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
parent b40e0048
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> 2017-09-04 Marek Polacek <polacek@redhat.com>
PR c/81783 PR c/81783
......
...@@ -987,6 +987,8 @@ c_cpp_builtins (cpp_reader *pfile) ...@@ -987,6 +987,8 @@ c_cpp_builtins (cpp_reader *pfile)
} }
if (flag_new_ttp) if (flag_new_ttp)
cpp_define (pfile, "__cpp_template_template_args=201611"); 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 /* Note that we define this for C as well, so that we know if
__attribute__((cleanup)) will interface with EH. */ __attribute__((cleanup)) will interface with EH. */
......
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> 2017-09-09 Pierre-Marie de Rodat <derodat@adacore.com>
* gnat.dg/debug14.adb: New test. * gnat.dg/debug14.adb: New test.
......
...@@ -125,6 +125,12 @@ ...@@ -125,6 +125,12 @@
# error "__cpp_alias_templates != 200704" # error "__cpp_alias_templates != 200704"
#endif #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: // C++14 features allowed in C++11 in non-ANSI modes:
#ifndef __cpp_binary_literals #ifndef __cpp_binary_literals
......
...@@ -118,6 +118,12 @@ ...@@ -118,6 +118,12 @@
# error "__cpp_alias_templates != 200704" # error "__cpp_alias_templates != 200704"
#endif #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: // C++14 features:
#ifndef __cpp_binary_literals #ifndef __cpp_binary_literals
......
...@@ -15,6 +15,14 @@ ...@@ -15,6 +15,14 @@
# error "__cpp_exceptions != 199711" # error "__cpp_exceptions != 199711"
#endif #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: // C++14 features allowed in C++98 in non-ANSI modes:
#ifndef __cpp_binary_literals #ifndef __cpp_binary_literals
......
// { dg-do compile } // { 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: // C++98 features with explicit opt-out:
...@@ -10,3 +10,9 @@ ...@@ -10,3 +10,9 @@
#ifndef __cpp_exceptions #ifndef __cpp_exceptions
# error "__cpp_exceptions" // { dg-error "error" } # error "__cpp_exceptions" // { dg-error "error" }
#endif #endif
// C++11 features with explicit opt-out:
#ifndef __cpp_threadsafe_static_init
# error "__cpp_threadsafe_static_init" // { dg-error "error" }
#endif
...@@ -106,6 +106,12 @@ ...@@ -106,6 +106,12 @@
# error "__cpp_alias_templates != 200704" # error "__cpp_alias_templates != 200704"
#endif #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: // C++14 features:
#ifndef __cpp_binary_literals #ifndef __cpp_binary_literals
......
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