[PATCH] PR libstdc++/86846 Alternative to pointer-width atomics
Jonathan Wakely
jwakely@redhat.com
Wed Aug 15 09:59:00 GMT 2018
On 15/08/18 10:40 +0100, Szabolcs Nagy wrote:
>On 14/08/18 14:13, Jonathan Wakely wrote:
>>Define a class using std::mutex for when std::atomic<memory_resource*>
>>cannot be used to implement the default memory resource.
>>
>>When std::mutex constructor is not constexpr the constant_init trick
>>won't work, so just define a global and use init_priority for it. The
>>compiler warns about using reserved priority, so put the definition in a
>>header file using #pragma GCC system_header to suppress the warning.
>>
>> Â Â Â Â PR libstdc++/86846
>> Â Â Â Â * src/c++17/default_resource.h: New file, defining default_res.
>> Â Â Â Â * src/c++17/memory_resource.cc [ATOMIC_POINTER_LOCK_FREE != 2]
>> Â Â Â Â (atomic_mem_res): Define alternative for atomic<memory_resource*>
>> Â Â Â Â using a mutex instead of atomics.
>>
>>Tested x86_64-linux, committed to trunk.
>>
>
>build fails with arm-none-eabi target:
>
>Making all in c++17
>make[4]: Entering directory '/B/arm-none-eabi/libstdc++-v3/src/c++17'
>/bin/sh ../../libtool --tag CXX --tag disable-shared --mode=compile
>/B/./gcc/xgcc -shared-libgcc -B/B/./gcc -nostdinc++
>-L/B/arm-none-eabi/libstdc++-v3/src
>-L/B/arm-none-eabi/libstdc++-v3/src/.libs
>-L/B/arm-none-eabi/libstdc++-v3/libsupc++/.libs
>-B/P/arm-none-eabi/bin/ -B/P/arm-none-eabi/lib/ -isystem
>/P/arm-none-eabi/include -isystem /P/arm-none-eabi/sys-include
>-I/S/libstdc++-v3/../libgcc
>-I/B/arm-none-eabi/libstdc++-v3/include/arm-none-eabi
>-I/B/arm-none-eabi/libstdc++-v3/include -I/S/libstdc++-v3/libsupc++
>-std=gnu++17 -fno-implicit-templates -Wall -Wextra -Wwrite-strings
>-Wcast-qual -Wabi=2 -fdiagnostics-show-location=once
>-ffunction-sections -fdata-sections -frandom-seed=memory_resource.lo
>-g -ffunction-sections -fdata-sections -O2 -c -o memory_resource.lo
>/S/libstdc++-v3/src/c++17/memory_resource.cc
>libtool: compile: /B/./gcc/xgcc -shared-libgcc -B/B/./gcc -nostdinc++
>-L/B/arm-none-eabi/libstdc++-v3/src
>-L/B/arm-none-eabi/libstdc++-v3/src/.libs
>-L/B/arm-none-eabi/libstdc++-v3/libsupc++/.libs
>-B/P/arm-none-eabi/bin/ -B/P/arm-none-eabi/lib/ -isystem
>/P/arm-none-eabi/include -isystem /P/arm-none-eabi/sys-include
>-I/S/libstdc++-v3/../libgcc
>-I/B/arm-none-eabi/libstdc++-v3/include/arm-none-eabi
>-I/B/arm-none-eabi/libstdc++-v3/include -I/S/libstdc++-v3/libsupc++
>-std=gnu++17 -fno-implicit-templates -Wall -Wextra -Wwrite-strings
>-Wcast-qual -Wabi=2 -fdiagnostics-show-location=once
>-ffunction-sections -fdata-sections -frandom-seed=memory_resource.lo
>-g -ffunction-sections -fdata-sections -O2 -c
>/S/libstdc++-v3/src/c++17/memory_resource.cc -o memory_resource.o
>/S/libstdc++-v3/src/c++17/memory_resource.cc:102:7: error: 'mutex' does not name a type
>102 | mutex mx;
Sorry about that, it should be fixed at r263554 by the commit of this
patch.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 1549 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20180815/b52736f2/attachment.bin>
More information about the Libstdc++
mailing list