Welcome! Log In Create A New Profile

Advanced

[nginx] Give GCC atomics precedence over deprecated Darwin atomic(3).

Sergey Kandaurov
August 30, 2021 08:50AM
details: https://hg.nginx.org/nginx/rev/09d15a2dbc6b
branches:
changeset: 7915:09d15a2dbc6b
user: Sergey Kandaurov <pluknet@nginx.com>
date: Mon Aug 30 14:45:21 2021 +0300
description:
Give GCC atomics precedence over deprecated Darwin atomic(3).

This allows to build nginx on macOS with -Wdeprecated-declarations.

diffstat:

src/os/unix/ngx_atomic.h | 66 ++++++++++++++++++++++++------------------------
1 files changed, 33 insertions(+), 33 deletions(-)

diffs (83 lines):

diff -r 9cf043a5d9ca -r 09d15a2dbc6b src/os/unix/ngx_atomic.h
--- a/src/os/unix/ngx_atomic.h Sun Aug 29 22:22:02 2021 +0300
+++ b/src/os/unix/ngx_atomic.h Mon Aug 30 14:45:21 2021 +0300
@@ -38,6 +38,39 @@ typedef volatile ngx_atomic_uint_t ngx_
#define ngx_cpu_pause()


+#elif (NGX_HAVE_GCC_ATOMIC)
+
+/* GCC 4.1 builtin atomic operations */
+
+#define NGX_HAVE_ATOMIC_OPS 1
+
+typedef long ngx_atomic_int_t;
+typedef unsigned long ngx_atomic_uint_t;
+
+#if (NGX_PTR_SIZE == 8)
+#define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
+#else
+#define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
+#endif
+
+typedef volatile ngx_atomic_uint_t ngx_atomic_t;
+
+
+#define ngx_atomic_cmp_set(lock, old, set) \
+ __sync_bool_compare_and_swap(lock, old, set)
+
+#define ngx_atomic_fetch_add(value, add) \
+ __sync_fetch_and_add(value, add)
+
+#define ngx_memory_barrier() __sync_synchronize()
+
+#if ( __i386__ || __i386 || __amd64__ || __amd64 )
+#define ngx_cpu_pause() __asm__ ("pause")
+#else
+#define ngx_cpu_pause()
+#endif
+
+
#elif (NGX_DARWIN_ATOMIC)

/*
@@ -88,39 +121,6 @@ typedef uint32_t ngx_
typedef volatile ngx_atomic_uint_t ngx_atomic_t;


-#elif (NGX_HAVE_GCC_ATOMIC)
-
-/* GCC 4.1 builtin atomic operations */
-
-#define NGX_HAVE_ATOMIC_OPS 1
-
-typedef long ngx_atomic_int_t;
-typedef unsigned long ngx_atomic_uint_t;
-
-#if (NGX_PTR_SIZE == 8)
-#define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
-#else
-#define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
-#endif
-
-typedef volatile ngx_atomic_uint_t ngx_atomic_t;
-
-
-#define ngx_atomic_cmp_set(lock, old, set) \
- __sync_bool_compare_and_swap(lock, old, set)
-
-#define ngx_atomic_fetch_add(value, add) \
- __sync_fetch_and_add(value, add)
-
-#define ngx_memory_barrier() __sync_synchronize()
-
-#if ( __i386__ || __i386 || __amd64__ || __amd64 )
-#define ngx_cpu_pause() __asm__ ("pause")
-#else
-#define ngx_cpu_pause()
-#endif
-
-
#elif ( __i386__ || __i386 )

typedef int32_t ngx_atomic_int_t;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Give GCC atomics precedence over deprecated Darwin atomic(3).

Sergey Kandaurov 320 August 30, 2021 08:50AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 241
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready