mirror of https://github.com/F-Stack/f-stack.git
Fix issue in Freebsd when building with GCC 14.1.0
Since GCC 14 now implements `__has_extension()` the build started to use Clang atomics, i.e. the `__c11_*` APIs only provided by Clang. Fix build to use GNUC atomics and include the upstream patch: https://reviews.freebsd.org/D16585 which enables C11 atomics when building with GCC >= 4.7.
This commit is contained in:
parent
30c7c4a391
commit
486200e57f
|
@ -795,7 +795,7 @@
|
|||
* Type Safety Checking
|
||||
*
|
||||
* Clang provides additional attributes to enable checking type safety
|
||||
* properties that cannot be enforced by the C type system.
|
||||
* properties that cannot be enforced by the C type system.
|
||||
*/
|
||||
|
||||
#if __has_attribute(__argument_with_type_tag__) && \
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include <sys/cdefs.h>
|
||||
#include <sys/_types.h>
|
||||
|
||||
#if __has_extension(c_atomic) || __has_extension(cxx_atomic)
|
||||
#if defined(__clang__) && (__has_extension(c_atomic) || __has_extension(cxx_atomic))
|
||||
#define __CLANG_ATOMICS
|
||||
#elif __GNUC_PREREQ__(4, 7)
|
||||
#define __GNUC_ATOMICS
|
||||
|
@ -87,6 +87,9 @@
|
|||
#if defined(__CLANG_ATOMICS)
|
||||
#define ATOMIC_VAR_INIT(value) (value)
|
||||
#define atomic_init(obj, value) __c11_atomic_init(obj, value)
|
||||
#elif defined(__GNUC_ATOMICS)
|
||||
#define ATOMIC_VAR_INIT(value) (value)
|
||||
#define atomic_init(obj, value) __atomic_init(obj, value)
|
||||
#else
|
||||
#define ATOMIC_VAR_INIT(value) { .__val = (value) }
|
||||
#define atomic_init(obj, value) ((void)((obj)->__val = (value)))
|
||||
|
|
Loading…
Reference in New Issue