Allow use of gcc-style __atomic* builtins in older clang versions. Avoid use of const pointers with atomic_load because strictly C11 compliant compilers error on this. Using const became allowed in C17: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_459 --- lib/isc/include/isc/stdatomic.h.orig 2022-10-10 18:01:57.000000000 +1100 +++ lib/isc/include/isc/stdatomic.h 2022-11-03 20:54:26.000000000 +1100 @@ -21,7 +21,9 @@ #endif /* HAVE_UCHAR_H */ /* GCC 4.7.0 introduced __atomic builtins, but not the __GNUC_ATOMICS define */ -#if !defined(__GNUC_ATOMICS) && __GNUC__ == 4 && __GNUC_MINOR__ >= 7 +/* Clang 3.1 and later have the builtins but none define __GNUC_ATOMICS */ +#if !defined(__GNUC_ATOMICS) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 7) \ + || defined(__clang__)) #define __GNUC_ATOMICS #endif --- lib/isc/netmgr/netmgr-int.h.orig 2022-10-10 18:44:05.000000000 +1100 +++ lib/isc/netmgr/netmgr-int.h 2022-11-03 20:57:03.000000000 +1100 @@ -244,7 +244,7 @@ typedef struct isc__networker { #define NMHANDLE_MAGIC ISC_MAGIC('N', 'M', 'H', 'D') #define VALID_NMHANDLE(t) \ (ISC_MAGIC_VALID(t, NMHANDLE_MAGIC) && \ - atomic_load(&(t)->references) > 0) + atomic_load((isc_refcount_t *)&(t)->references) > 0) typedef void (*isc__nm_closecb)(isc_nmhandle_t *); typedef struct isc_nm_http_session isc_nm_http_session_t;