diff --git a/freebsd/sys/cdefs.h b/freebsd/sys/cdefs.h index d11bee96e..daf1a4d6e 100644 --- a/freebsd/sys/cdefs.h +++ b/freebsd/sys/cdefs.h @@ -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__) && \ diff --git a/freebsd/sys/stdatomic.h b/freebsd/sys/stdatomic.h index 4dc6d680f..614e03293 100644 --- a/freebsd/sys/stdatomic.h +++ b/freebsd/sys/stdatomic.h @@ -35,7 +35,7 @@ #include #include -#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)))