Mercurial > hg > nginx
comparison 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 |
comparison
equal
deleted
inserted
replaced
9314:32a5186a2705 | 9315:d286426eab1a |
---|---|
151 /* the code in src/os/unix/ngx_sunpro_x86.il */ | 151 /* the code in src/os/unix/ngx_sunpro_x86.il */ |
152 | 152 |
153 #define ngx_memory_barrier() __asm (".volatile"); __asm (".nonvolatile") | 153 #define ngx_memory_barrier() __asm (".volatile"); __asm (".nonvolatile") |
154 | 154 |
155 | 155 |
156 #else /* ( __GNUC__ || __INTEL_COMPILER ) */ | 156 #else /* ( __GNUC__ || __clang__ || __INTEL_COMPILER ) */ |
157 | 157 |
158 #define NGX_HAVE_ATOMIC_OPS 1 | 158 #define NGX_HAVE_ATOMIC_OPS 1 |
159 | 159 |
160 #include "ngx_gcc_atomic_x86.h" | 160 #include "ngx_gcc_atomic_x86.h" |
161 | 161 |
192 /* the code in src/os/unix/ngx_sunpro_amd64.il */ | 192 /* the code in src/os/unix/ngx_sunpro_amd64.il */ |
193 | 193 |
194 #define ngx_memory_barrier() __asm (".volatile"); __asm (".nonvolatile") | 194 #define ngx_memory_barrier() __asm (".volatile"); __asm (".nonvolatile") |
195 | 195 |
196 | 196 |
197 #else /* ( __GNUC__ || __INTEL_COMPILER ) */ | 197 #else /* ( __GNUC__ || __clang__ || __INTEL_COMPILER ) */ |
198 | 198 |
199 #define NGX_HAVE_ATOMIC_OPS 1 | 199 #define NGX_HAVE_ATOMIC_OPS 1 |
200 | 200 |
201 #include "ngx_gcc_atomic_amd64.h" | 201 #include "ngx_gcc_atomic_amd64.h" |
202 | 202 |
227 #define NGX_HAVE_ATOMIC_OPS 1 | 227 #define NGX_HAVE_ATOMIC_OPS 1 |
228 | 228 |
229 #include "ngx_sunpro_atomic_sparc64.h" | 229 #include "ngx_sunpro_atomic_sparc64.h" |
230 | 230 |
231 | 231 |
232 #else /* ( __GNUC__ || __INTEL_COMPILER ) */ | 232 #else /* ( __GNUC__ || __clang__ || __INTEL_COMPILER ) */ |
233 | 233 |
234 #define NGX_HAVE_ATOMIC_OPS 1 | 234 #define NGX_HAVE_ATOMIC_OPS 1 |
235 | 235 |
236 #include "ngx_gcc_atomic_sparc64.h" | 236 #include "ngx_gcc_atomic_sparc64.h" |
237 | 237 |