-
Notifications
You must be signed in to change notification settings - Fork 909
Closed
Description
When running cmake
on the cpp_master
branch on Ubuntu 18.04 I get a
-- Performing Test MSGPACK_ENABLE_GCC_CXX_ATOMIC
-- Performing Test MSGPACK_ENABLE_GCC_CXX_ATOMIC - Failed
The test code in CMakeLists.txt
reads
#include <bits/atomicity.h>
int atomic_sub(int i) { return __gnu_cxx::__exchange_and_add(&i, -1) - 1; }
int atomic_add(int i) { return __gnu_cxx::__exchange_and_add(&i, 1) + 1; }
int main(int argc, char * argv[])
{
atomic_sub(1);
atomic_add(1);
}
The culprit is that since quite some time the header is under
#include <ext/atomicity.h>
Looking through some old systems is see that
- up to gcc 4.1.1 I find
bits/atomicity.h
- after gcc 4.6.3 I find
ext/atomicity.h
so the transition was somewhere between gcc 4.1.1 and 4.6.3. Ubuntu 18.04 has gcc version 7.5.0
The code compiles and tests without atomicity.h
, hard to judge whether there are performance impacts.
In case atomic actions are important, it seems to me that std::atomic
is the natural choice these days.
In closing the steps to reproduce (on an Ubuntu 18.04 system, likely on all current Ubuntu/Debian systems):
git clone https://github.com/msgpack/msgpack-c.git
cd msgpack-c
git checkout cpp_master
git checkout 70912ff
mkdir build
cd build
cmake -DMSGPACK_CXX17=ON ..
Metadata
Metadata
Assignees
Labels
No labels