Define OSATOMIC_USE_INLINED to get usable atomics on DARWIN

In Mac OS 10.12, legacy interfaces for atomic operations have been
deprecated. Defining OSATOMIC_USE_INLINED gets us inline implementations
of the OSAtomic interfaces in terms of the <stdatomic.h> primitives.
This is a transition convenience.

Also indent preprocessor directives within the main DARWIN block to
improve readability.

Change-Id: Id10ae007d5427486f1b0a307a04a90f263201150
Reviewed-on: https://gerrit.openafs.org/12433
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
Dave Botsch 2016-11-03 12:22:21 -04:00 committed by Benjamin Kaduk
parent f5f057ce81
commit 74f837fd94

View File

@ -184,14 +184,21 @@ rx_atomic_test_and_clear_bit(rx_atomic_t *atomic, int bit) {
#elif defined(AFS_DARWIN80_ENV) || defined(AFS_USR_DARWIN80_ENV)
#include <libkern/OSAtomic.h>
#if defined(KERNEL) && !defined(UKERNEL)
#define OSAtomicIncrement32 OSIncrementAtomic
#define OSAtomicAdd32 OSAddAtomic
#define OSAtomicDecrement32 OSDecrementAtomic
#define OSAtomicOr32 OSBitOrAtomic
#define OSAtomicAnd32 OSBitAndAtomic
#endif
# if defined (AFS_DARWIN160_ENV) || defined(AFS_USR_DARWIN160_ENV)
# define OSATOMIC_USE_INLINED 1
# else
# if defined(KERNEL) && !defined(UKERNEL)
# define OSAtomicIncrement32 OSIncrementAtomic
# define OSAtomicAdd32 OSAddAtomic
# define OSAtomicDecrement32 OSDecrementAtomic
# define OSAtomicOr32 OSBitOrAtomic
# define OSAtomicAnd32 OSBitAndAtomic
# endif
# endif /* end defined DARWIN160 */
# include <libkern/OSAtomic.h>
typedef struct {
volatile int var;