summaryrefslogtreecommitdiff
path: root/include
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 /include
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 'include')
-rw-r--r--include/openvswitch/automake.mk10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/openvswitch/automake.mk b/include/openvswitch/automake.mk
index eabeb1e97..6cb19b84e 100644
--- a/include/openvswitch/automake.mk
+++ b/include/openvswitch/automake.mk
@@ -41,10 +41,12 @@ if HAVE_CXX
# are acceptable as C++.
noinst_LTLIBRARIES += include/openvswitch/libcxxtest.la
nodist_include_openvswitch_libcxxtest_la_SOURCES = include/openvswitch/cxxtest.cc
-include/openvswitch/cxxtest.cc: include/openvswitch/automake.mk
- $(AM_V_GEN)for header in $(openvswitchinclude_HEADERS); do \
- echo $$header; \
- done | sed 's,^include/\(.*\)$$,#include <\1>,' > $@
+include/openvswitch/cxxtest.cc: \
+ include/openvswitch/automake.mk $(top_builddir)/config.status
+ $(AM_V_GEN){ echo "#include <config.h>"; \
+ for header in $(openvswitchinclude_HEADERS); do \
+ echo $$header; \
+ done | sed 's,^include/\(.*\)$$,#include <\1>,'; } > $@
endif
# OVS does not use C++ itself, but it provides public header files