$NetBSD: patch-ad,v 1.6 2018/02/21 23:59:33 maya Exp $

revision 1.2
date: 2009-01-31 21:05:57 +0100;  author: sketch;  state: Exp;  lines: +2 -2;
Sun Studio x86 implementation isn't quite good enough yet for e.g.
pulseaudio, so instead use the generic pthread implementation for now.

Check if AO_AO_TS_T is defined before testing it (PR pkg/53046)

--- src/atomic_ops.h.orig	2017-12-24 08:31:12.000000000 +0000
+++ src/atomic_ops.h
@@ -412,7 +412,10 @@
 # endif
 #endif
 
-#if !defined(__GNUC__) && (defined(sparc) || defined(__sparc)) \
+#if defined(__SUNPRO_C) && defined(__i386)
+#   include "atomic_ops/sysdeps/generic_pthread.h"
+#   define AO_CAN_EMUL_CAS
+#elif !defined(__GNUC__) && (defined(sparc) || defined(__sparc)) \
     && !defined(AO_USE_PTHREAD_DEFS)
 # include "atomic_ops/sysdeps/sunc/sparc.h"
 # define AO_CAN_EMUL_CAS
@@ -433,7 +436,7 @@
 
 /* The most common way to clear a test-and-set location         */
 /* at the end of a critical section.                            */
-#if AO_AO_TS_T && !defined(AO_HAVE_CLEAR)
+#if defined(AO_AO_TS_T) && AO_AO_TS_T && !defined(AO_HAVE_CLEAR)
 # define AO_CLEAR(addr) AO_store_release((AO_TS_t *)(addr), AO_TS_CLEAR)
 # define AO_HAVE_CLEAR
 #endif
