libstdc++: Use Clang attribute instead of __constinit
Clang doesn't support the __constinit extension that we use pre-C++20, but it does have its own equivalent attribute that can be used instead. This makes it a little easier to use Clang to build libstdc++ (which isn't supported. but is sometimes attempted for esoteric targets). libstdc++-v3/ChangeLog: * src/c++11/cxx11-ios_failure.cc (__constinit): Define as equivalent attribute for Clang. * src/c++11/future.cc (__constinit): Likewise. * src/c++11/system_error.cc (__constinit): Likewise. * src/c++17/memory_resource.cc (__constinit): Likewise.
This commit is contained in:
parent
5929f253fc
commit
109f8af3d3
4 changed files with 16 additions and 0 deletions
|
@ -42,6 +42,10 @@
|
|||
# error This file should not be compiled for this configuration.
|
||||
#endif
|
||||
|
||||
#if __has_cpp_attribute(clang::require_constant_initialization)
|
||||
# define __constinit [[clang::require_constant_initialization]]
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
struct io_error_category final : std::error_category
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
#include <future>
|
||||
#include <bits/functexcept.h>
|
||||
|
||||
#if __has_cpp_attribute(clang::require_constant_initialization)
|
||||
# define __constinit [[clang::require_constant_initialization]]
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
struct future_error_category final : public std::error_category
|
||||
|
|
|
@ -37,6 +37,10 @@
|
|||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if __has_cpp_attribute(clang::require_constant_initialization)
|
||||
# define __constinit [[clang::require_constant_initialization]]
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
using std::string;
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
# include <bits/move.h> // std::__exchange
|
||||
#endif
|
||||
|
||||
#if __has_cpp_attribute(clang::require_constant_initialization)
|
||||
# define __constinit [[clang::require_constant_initialization]]
|
||||
#endif
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
|
Loading…
Add table
Reference in a new issue