Mercurial > hg > nginx
diff src/os/unix/ngx_atomic.h @ 9315:d286426eab1a
Support for Clang with "-fgnuc-version=0".
Previously, the code assumed that Clang pretends to be GCC and defines
the __GNUC__ macro, which might not be the case if the "-fgnuc-version=0"
flag is used. Fix is to explicitly check for __clang__ as well.
In practice, with this change ngx_cpuinfo() is now available on Linux
with "-fgnuc-version=0".
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 07 Aug 2024 03:58:30 +0300 |
parents | 09d15a2dbc6b |
children |
line wrap: on
line diff
--- a/src/os/unix/ngx_atomic.h +++ b/src/os/unix/ngx_atomic.h @@ -153,7 +153,7 @@ ngx_cpu_pause(void); #define ngx_memory_barrier() __asm (".volatile"); __asm (".nonvolatile") -#else /* ( __GNUC__ || __INTEL_COMPILER ) */ +#else /* ( __GNUC__ || __clang__ || __INTEL_COMPILER ) */ #define NGX_HAVE_ATOMIC_OPS 1 @@ -194,7 +194,7 @@ ngx_cpu_pause(void); #define ngx_memory_barrier() __asm (".volatile"); __asm (".nonvolatile") -#else /* ( __GNUC__ || __INTEL_COMPILER ) */ +#else /* ( __GNUC__ || __clang__ || __INTEL_COMPILER ) */ #define NGX_HAVE_ATOMIC_OPS 1 @@ -229,7 +229,7 @@ typedef volatile ngx_atomic_uint_t ngx_ #include "ngx_sunpro_atomic_sparc64.h" -#else /* ( __GNUC__ || __INTEL_COMPILER ) */ +#else /* ( __GNUC__ || __clang__ || __INTEL_COMPILER ) */ #define NGX_HAVE_ATOMIC_OPS 1