Skip to content

Commit

Permalink
ovs-atomic: Fix inclusion of Clang header by GCC 14.
Browse files Browse the repository at this point in the history
GCC 14 started to advertise c_atomic extension, older versions didn't
do that.  Add check for __clang__, so GCC doesn't include headers
designed for Clang.

Another option would be to prefer stdatomic implementation instead,
but some older versions of Clang are not able to use stdatomic.h
supplied by GCC as described in commit:
  07ece36 ("ovs-atomic: Prefer Clang intrinsics over <stdatomic.h>.")

This change fixes OVS build with GCC on Fedora Rawhide (40).

Reported-by: Jakob Meng <code@jakobmeng.de>
Acked-by: Jakob Meng <jmeng@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Simon Horman <horms@ovn.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
  • Loading branch information
igsilya committed Jan 19, 2024
1 parent dd3f062 commit bd5b5d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ovs-atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@
#if __CHECKER__
/* sparse doesn't understand some GCC extensions we use. */
#include "ovs-atomic-pthreads.h"
#elif __has_extension(c_atomic)
#elif __clang__ && __has_extension(c_atomic)
#include "ovs-atomic-clang.h"
#elif HAVE_ATOMIC && __cplusplus >= 201103L
#include "ovs-atomic-c++.h"
Expand Down

0 comments on commit bd5b5d3

Please sign in to comment.