The _Atomic keyword used in stdatomic.h is not supported in g++ [1]. This patch adds additional checks that make g++ to use the right header file.
[1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60932 Fixes: 9c463631e8145 ("ovs-atomic: Report error for contradictory configuration.") Reported-by: Shireesh Kumar Singh <[email protected]> Signed-off-by: Yi-Hung Wei <[email protected]> --- lib/ovs-atomic.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ovs-atomic.h b/lib/ovs-atomic.h index d1b4e09e70d4..cccffadb2a89 100644 --- a/lib/ovs-atomic.h +++ b/lib/ovs-atomic.h @@ -325,11 +325,12 @@ #include "ovs-atomic-pthreads.h" #elif __has_extension(c_atomic) #include "ovs-atomic-clang.h" - #elif HAVE_STDATOMIC_H + #elif !defined(__cplusplus) && HAVE_STDATOMIC_H #include "ovs-atomic-c11.h" - #elif __GNUC__ >= 5 + #elif !defined(__cplusplus) && __GNUC__ >= 5 #error "GCC 5+ should have <stdatomic.h>" - #elif __GNUC__ >= 4 && __GNUC_MINOR__ >= 7 + #elif (defined(__cplusplus) && __GNUC__ >= 5) || \ + (__GNUC__ >= 4 && __GNUC_MINOR__ >= 7) #include "ovs-atomic-gcc4.7+.h" #elif __GNUC__ && defined(__x86_64__) #include "ovs-atomic-x86_64.h" -- 2.7.4 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
