summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2017-10-17 16:51:42 -0700
committerBen Pfaff <blp@ovn.org>2017-10-17 16:53:58 -0700
commitadabd65ddd8217cf1a27f654136ff74d4fd544bf (patch)
treeabfa3a02f86187b1b26f770682c69cf5f0e9923f /m4
parent7468ec78853e4c82865776c6c003a64b7b8b2a5e (diff)
downloadopenvswitch-adabd65ddd8217cf1a27f654136ff74d4fd544bf.tar.gz
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>
Diffstat (limited to 'm4')
-rw-r--r--m4/openvswitch.m43
1 files changed, 3 insertions, 0 deletions
diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index 00ffad35f..59e1352e3 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -632,6 +632,9 @@ AC_DEFUN([OVS_CHECK_CXX],
AX_CXX_COMPILE_STDCXX([11], [], [optional])
if test $enable_Werror = yes && test $HAVE_CXX11 = 1; then
enable_cxx=:
+ AC_LANG_PUSH([C++])
+ AC_CHECK_HEADERS([atomic])
+ AC_LANG_POP([C++])
else
enable_cxx=false
fi