diff --git a/libstdc++-v3/src/c++17/default_resource.h b/libstdc++-v3/src/c++17/default_resource.h deleted file mode 100644 index f8d03d7d3bcafb6662d25f70d760688aa0269d02..0000000000000000000000000000000000000000 --- a/libstdc++-v3/src/c++17/default_resource.h +++ /dev/null @@ -1,15 +0,0 @@ -// This is only in a header so we can use the system_header pragma, -// to suppress the warning caused by using a reserved init_priority. -#pragma GCC system_header - -#ifndef _GLIBCXX_HAS_GTHREADS -# error "This file should not be included for this build" -#elif ATOMIC_POINTER_LOCK_FREE == 2 -# error "This file should not be included for this build" -#elif defined __GTHREAD_MUTEX_INIT -# error "This file should not be included for this build" -#endif - -struct { - atomic_mem_res obj = &newdel_res.obj; -} default_res __attribute__ ((init_priority (100))); diff --git a/libstdc++-v3/src/c++17/memory_resource.cc b/libstdc++-v3/src/c++17/memory_resource.cc index 2b6bfbd4dd33c50f19b5c7e98e760297759f9d13..0e984f27b8273862f7d67cb34ada49a63c698eec 100644 --- a/libstdc++-v3/src/c++17/memory_resource.cc +++ b/libstdc++-v3/src/c++17/memory_resource.cc @@ -149,7 +149,10 @@ namespace pmr #ifdef _GLIBCXX_ATOMIC_MEM_RES_CAN_BE_CONSTANT_INITIALIZED __constinit constant_init<atomic_mem_res> default_res{&newdel_res.obj}; #else -# include "default_resource.h" +# pragma GCC diagnostic ignored "-Wprio-ctor-dtor" + struct { + atomic_mem_res obj = &newdel_res.obj; + } default_res __attribute__ ((init_priority (100))); #endif } // namespace diff --git a/libstdc++-v3/src/c++98/globals_io.cc b/libstdc++-v3/src/c++98/globals_io.cc index 6dc6bf40fe27f292f7bb9e07f74bca4a3dc703ac..e30edf7eae2fcc9bf35b96ab0201c81ca026e3c6 100644 --- a/libstdc++-v3/src/c++98/globals_io.cc +++ b/libstdc++-v3/src/c++98/globals_io.cc @@ -69,7 +69,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION fake_wostream wclog; #endif -#include "ios_base_init.h" +// If the target supports init priorities, set up a static object in the +// compiled library to perform the <iostream> initialization once and +// sufficiently early (so that it happens before any other global +// constructor when statically linking with libstdc++.a), instead of +// doing so in (each TU that includes) <iostream>. +// This needs to be done in the same TU that defines the stream objects. +#if _GLIBCXX_USE_INIT_PRIORITY_ATTRIBUTE +#pragma GCC diagnostic ignored "-Wprio-ctor-dtor" +static ios_base::Init __ioinit __attribute__((init_priority(90))); +#endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/src/c++98/ios_base_init.h b/libstdc++-v3/src/c++98/ios_base_init.h deleted file mode 100644 index f7edfc846258db6b3ad5a5f478bbc15182db0d8c..0000000000000000000000000000000000000000 --- a/libstdc++-v3/src/c++98/ios_base_init.h +++ /dev/null @@ -1,13 +0,0 @@ -// This is only in a header so we can use the system_header pragma, -// to suppress the warning caused by using a reserved init_priority. -#pragma GCC system_header - -// If the target supports init priorities, set up a static object in the -// compiled library to perform the <iostream> initialization once and -// sufficiently early (so that it happens before any other global -// constructor when statically linking with libstdc++.a), instead of -// doing so in (each TU that includes) <iostream>. -// This needs to be done in the same TU that defines the stream objects. -#if _GLIBCXX_USE_INIT_PRIORITY_ATTRIBUTE -static ios_base::Init __ioinit __attribute__((init_priority(90))); -#endif