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 <[email protected]>
Signed-off-by: Ilya Maximets <[email protected]>
Acked-by: Jakob Meng <[email protected]>
Signed-off-by: 0-day Robot <[email protected]>
  • Loading branch information
igsilya authored and ovsrobot committed Jan 18, 2024
1 parent 85ceed7 commit c942afa
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 @@ -328,7 +328,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 c942afa

Please sign in to comment.