<pre style='margin:0'>
Rainer Müller (raimue) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/4c439bc70d4ce4f50b4f35a9bc701d8189d01c20">https://github.com/macports/macports-base/commit/4c439bc70d4ce4f50b4f35a9bc701d8189d01c20</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 4c439bc70d4ce4f50b4f35a9bc701d8189d01c20
</span>Author: Rainer Müller <raimue@macports.org>
AuthorDate: Wed Jul 12 01:37:47 2017 +0200
<span style='display:block; white-space:pre;color:#404040;'> Prefer stdatomic over deprecated OSAtomic*
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Fixes compilation warnings:
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> darwintrace.c:330:12: warning: 'OSAtomicCompareAndSwapPtr' is deprecated:
</span><span style='display:block; white-space:pre;color:#404040;'> first deprecated in macOS 10.12 - Use atomic_compare_exchange_strong_explicit(memory_order_relaxed)
</span><span style='display:block; white-space:pre;color:#404040;'> from <stdatomic.h> instead [-Wdeprecated-declarations]
</span>---
configure | 17 +++++++++++++++--
configure.ac | 6 ++++--
src/config.h.in | 7 +++++++
src/darwintracelib1.0/darwintrace.c | 21 ++++++++++++++++-----
4 files changed, 42 insertions(+), 9 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/configure b/configure
</span><span style='display:block; white-space:pre;color:#808080;'>index 09ce459..8c494c8 100755
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/configure
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/configure
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -7439,8 +7439,8 @@ done
</span>
for ac_header in crt_externs.h err.h fcntl.h libkern/OSAtomic.h libproc.h limits.h paths.h pwd.h \
<span style='display:block; white-space:pre;background:#ffe0e0;'>- readline/history.h readline/readline.h spawn.h sys/cdefs.h sys/event.h sys/fcntl.h sys/file.h \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- sys/paths.h sys/socket.h sys/sysctl.h utime.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ readline/history.h readline/readline.h stdatomic.h spawn.h sys/cdefs.h sys/event.h \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sys/fcntl.h sys/file.h sys/paths.h sys/socket.h sys/sysctl.h utime.h
</span> do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -7472,6 +7472,19 @@ done
</span>
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ac_fn_c_check_decl "$LINENO" "atomic_compare_exchange_strong_explicit" "ac_cv_have_decl_atomic_compare_exchange_strong_explicit" "#include <stdatomic.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if test "x$ac_cv_have_decl_atomic_compare_exchange_strong_explicit" = xyes; then :
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ac_have_decl=1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ac_have_decl=0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+cat >>confdefs.h <<_ACEOF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define HAVE_DECL_ATOMIC_COMPARE_EXCHANGE_STRONG_EXPLICIT $ac_have_decl
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+_ACEOF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span>
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if readlink conforms to POSIX 1003.1a" >&5
$as_echo_n "checking if readlink conforms to POSIX 1003.1a... " >&6; }
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/configure.ac b/configure.ac
</span><span style='display:block; white-space:pre;color:#808080;'>index 18384ee..b59cd02 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/configure.ac
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/configure.ac
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -240,8 +240,8 @@ AC_HEADER_STDC
</span> AC_HEADER_DIRENT
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([crt_externs.h err.h fcntl.h libkern/OSAtomic.h libproc.h limits.h paths.h pwd.h \
<span style='display:block; white-space:pre;background:#ffe0e0;'>- readline/history.h readline/readline.h spawn.h sys/cdefs.h sys/event.h sys/fcntl.h sys/file.h \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- sys/paths.h sys/socket.h sys/sysctl.h utime.h])
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ readline/history.h readline/readline.h stdatomic.h spawn.h sys/cdefs.h sys/event.h \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sys/fcntl.h sys/file.h sys/paths.h sys/socket.h sys/sysctl.h utime.h])
</span>
# Checks for library functions.
AC_CHECK_FUNCS([OSAtomicCompareAndSwap32 OSAtomicCompareAndSwap64 \
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -250,6 +250,8 @@ AC_CHECK_FUNCS([OSAtomicCompareAndSwap32 OSAtomicCompareAndSwap64 \
</span> strlcpy strncasecmp sysctlbyname])
AC_SUBST([ac_cv_func_strlcat])
<span style='display:block; white-space:pre;background:#e0ffe0;'>+AC_CHECK_DECLS([atomic_compare_exchange_strong_explicit], [], [], [[#include <stdatomic.h>]])
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> MP_CHECK_READLINK_IS_P1003_1A
# Check for md5 implementation
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/config.h.in b/src/config.h.in
</span><span style='display:block; white-space:pre;color:#808080;'>index a470e5f..e7c3798 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/config.h.in
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/config.h.in
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -19,6 +19,10 @@
</span> /* Define to 1 if you have the <crt_externs.h> header file. */
#undef HAVE_CRT_EXTERNS_H
<span style='display:block; white-space:pre;background:#e0ffe0;'>+/* Define to 1 if you have the declaration of
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ `atomic_compare_exchange_strong_explicit', and to 0 if you don't. */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#undef HAVE_DECL_ATOMIC_COMPARE_EXCHANGE_STRONG_EXPLICIT
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> /* Define to 1 if you have the declaration of `completion_matches', and to 0
if you don't. */
#undef HAVE_DECL_COMPLETION_MATCHES
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -174,6 +178,9 @@
</span> /* Define to 1 if you have the <sqlite3ext.h> header file. */
#undef HAVE_SQLITE3EXT_H
<span style='display:block; white-space:pre;background:#e0ffe0;'>+/* Define to 1 if you have the <stdatomic.h> header file. */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#undef HAVE_STDATOMIC_H
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> /* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/darwintracelib1.0/darwintrace.c b/src/darwintracelib1.0/darwintrace.c
</span><span style='display:block; white-space:pre;color:#808080;'>index db9d530..644b924 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/darwintracelib1.0/darwintrace.c
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/darwintracelib1.0/darwintrace.c
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -37,6 +37,10 @@
</span> #include "darwintrace.h"
#include "sandbox_actions.h"
<span style='display:block; white-space:pre;background:#e0ffe0;'>+#ifdef HAVE_STDATOMIC_H
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#include <stdatomic.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> #ifdef HAVE_LIBKERN_OSATOMIC_H
#include <libkern/OSAtomic.h>
#endif
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -129,7 +133,11 @@ pthread_key_t sock_key;
</span> * 2: check for a dependency using the socket
* 3: deny access to the path and stop processing
*/
<span style='display:block; white-space:pre;background:#e0ffe0;'>+#ifdef HAVE_STDATOMIC_H
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+static _Atomic(char *) filemap;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#else
</span> static char *filemap;
<span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif
</span>
static void __darwintrace_sock_destructor(FILE *dtsock) {
__darwintrace_close_sock = fileno(dtsock);
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -286,17 +294,19 @@ static void __darwintrace_get_filemap() {
</span> char *path, command;
#endif
<span style='display:block; white-space:pre;background:#ffe0e0;'>-#if defined(HAVE_OSATOMICCOMPAREANDSWAPPTR)
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# define CAS(old, new, mem) OSAtomicCompareAndSwapPtr(old, new, (void * volatile *) (mem))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#if HAVE_DECL_ATOMIC_COMPARE_EXCHANGE_STRONG_EXPLICIT /* HAVE_DECL_* is always defined and set to 1 or 0 */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# define CAS(old, new, mem) atomic_compare_exchange_strong_explicit(mem, old, new, memory_order_relaxed, memory_order_relaxed)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#elif defined(HAVE_OSATOMICCOMPAREANDSWAPPTR)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# define CAS(old, new, mem) OSAtomicCompareAndSwapPtr(*old, new, (void * volatile *) (mem))
</span> #elif defined(__LP64__)
# ifdef HAVE_OSATOMICCOMPAREANDSWAP64
<span style='display:block; white-space:pre;background:#ffe0e0;'>-# define CAS(old, new, mem) OSAtomicCompareAndSwap64((int64_t) (old), (int64_t) (new), (volatile int64_t *) (mem))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# define CAS(old, new, mem) OSAtomicCompareAndSwap64((int64_t) (*old), (int64_t) (new), (volatile int64_t *) (mem))
</span> # else
# error "No 64-bit compare and swap primitive available on 64-bit OS."
# endif
#else
# ifdef HAVE_OSATOMICCOMPAREANDSWAP32
<span style='display:block; white-space:pre;background:#ffe0e0;'>-# define CAS(old, new, mem) OSAtomicCompareAndSwap32((int32_t) (old), (int32_t) (new), (volatile int32_t *) (mem))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# define CAS(old, new, mem) OSAtomicCompareAndSwap32((int32_t) (*old), (int32_t) (new), (volatile int32_t *) (mem))
</span> # else
# error "No 32-bit compare and swap primitive available."
# endif
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -311,12 +321,13 @@ static void __darwintrace_get_filemap() {
</span> * code is actually called in an application.
*/
newfilemap = NULL;
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ char *nullpointer = NULL;
</span> do {
free(newfilemap);
if (filemap != NULL)
break;
newfilemap = __send("filemap\t", 8, 1);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- } while (!CAS(NULL, newfilemap, &filemap));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } while (!CAS(&nullpointer, newfilemap, &filemap));
</span>
#if DARWINTRACE_DEBUG && 0
for (__darwintrace_filemap_iterator_init(&it);
</pre><pre style='margin:0'>
</pre>