]> git.proxmox.com Git - mirror_ovs.git/commit
ovs-atomic: Add C++ compatible implementation.
authorBen Pfaff <blp@ovn.org>
Tue, 17 Oct 2017 23:51:42 +0000 (16:51 -0700)
committerBen Pfaff <blp@ovn.org>
Tue, 17 Oct 2017 23:53:58 +0000 (16:53 -0700)
commitadabd65ddd8217cf1a27f654136ff74d4fd544bf
treeabfa3a02f86187b1b26f770682c69cf5f0e9923f
parent7468ec78853e4c82865776c6c003a64b7b8b2a5e
ovs-atomic: Add C++ compatible implementation.

G++ 5 does not implement the _Atomic keyword, which is part of C11 but not
C++11, so the existing <stdatomic.h> based atomic implementation doesn't
work.  This commit adds a new implementation based on the C++11 <atomic>
header.

In this area, C++ is pickier about types than C, so a few of the
definitions in ovs-atomic.h have to be updated to use more precise types
for integer constants.

This updates the code that generates cxxtest.cc to #include <config.h>
(so that HAVE_ATOMIC is defined) and to automatically regenerate when the
program is reconfigured (because otherwise the #include <config.h>) won't
get added without a "make clean" step).

"ovs-atomic.h" is not a public header, but apparently some code was
using it anyway.

Fixes: 9c463631e8145 ("ovs-atomic: Report error for contradictory configuration.")
Reported-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
include/openvswitch/automake.mk
lib/automake.mk
lib/ovs-atomic-c++.h [new file with mode: 0644]
lib/ovs-atomic.h
m4/openvswitch.m4