Message ID | 1508179393-118866-1-git-send-email-yihung.wei@gmail.com |
---|---|
State | Superseded |
Headers | show |
Series | [ovs-dev] ovs-atmoic: Fix C++ compilation issue | expand |
On Mon, Oct 16, 2017 at 11:43:13AM -0700, Yi-Hung Wei wrote: > 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 <shireeshkum@vmware.com> > Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Hmm, this is interesting, but I think that we can do a little better. How about this? https://mail.openvswitch.org/pipermail/ovs-dev/2017-October/339767.html
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"
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 <shireeshkum@vmware.com> Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> --- lib/ovs-atomic.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)