libstdc++: Remove workaround for reserved init_priority warnings
Since r15-7511-g4e7f74225116e7 we can disable the warnings for using a reserved priority using a diagnostic pragma. That means we no longer need to put globals using that attribute into separate files that get included. This replaces the two uses of such separate files by moving the variable definition into the source file and adding the diagnostic pragma. libstdc++-v3/ChangeLog: * src/c++17/memory_resource.cc (default_res): Define here instead of including default_resource.h. * src/c++98/globals_io.cc (__ioinit): Define here instead of including ios_base_init.h. * src/c++17/default_resource.h: Removed. * src/c++98/ios_base_init.h: Removed.
This commit is contained in:
parent
99f57446e6
commit
29eb6f8f41
4 changed files with 14 additions and 30 deletions
|
@ -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)));
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
Loading…
Add table
Reference in a new issue