diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-07-10 03:06:05 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-10 03:06:05 -0400 |
| commit | b88151e0e1553607cbebc197e1111ec4bf53a595 (patch) | |
| tree | cd4f57feae521500fe4eb99a98a798241256d341 /lib/libcxx/src/experimental/memory_resource.cpp | |
| parent | 3f11d1d56d9747de974b00eab1c880bea7972c01 (diff) | |
| parent | f9bf4889264aee387639bb8a35fdf594236b1283 (diff) | |
| download | zig-b88151e0e1553607cbebc197e1111ec4bf53a595.tar.gz zig-b88151e0e1553607cbebc197e1111ec4bf53a595.zip | |
Merge pull request #12001 from ziglang/llvm14
Upgrade to LLVM 14
Diffstat (limited to 'lib/libcxx/src/experimental/memory_resource.cpp')
| -rw-r--r-- | lib/libcxx/src/experimental/memory_resource.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libcxx/src/experimental/memory_resource.cpp b/lib/libcxx/src/experimental/memory_resource.cpp index ffe8021514..018d015928 100644 --- a/lib/libcxx/src/experimental/memory_resource.cpp +++ b/lib/libcxx/src/experimental/memory_resource.cpp @@ -1,4 +1,4 @@ -//===------------------------ memory_resource.cpp -------------------------===// +//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -76,7 +76,9 @@ union ResourceInitHelper { ~ResourceInitHelper() {} }; -_LIBCPP_SAFE_STATIC ResourceInitHelper res_init _LIBCPP_INIT_PRIORITY_MAX; +// Pretend we're inside a system header so the compiler doesn't flag the use of the init_priority +// attribute with a value that's reserved for the implementation (we're the implementation). +#include "memory_resource_init_helper.h" } // end namespace @@ -95,8 +97,7 @@ static memory_resource * __default_memory_resource(bool set = false, memory_resource * new_res = nullptr) noexcept { #ifndef _LIBCPP_HAS_NO_ATOMIC_HEADER - _LIBCPP_SAFE_STATIC static atomic<memory_resource*> __res = - ATOMIC_VAR_INIT(&res_init.resources.new_delete_res); + _LIBCPP_SAFE_STATIC static atomic<memory_resource*> __res{&res_init.resources.new_delete_res}; if (set) { new_res = new_res ? new_res : new_delete_resource(); // TODO: Can a weaker ordering be used? |
