1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-10 19:08:21 +01:00

(inline): Add #undef of "inline" before (re-)defining it.

Add support for atomic_ops.h.
	Add fetch_and_add1() and if it is supported, define
	HAVE_FETCH_AND_ADD1.

(Logical change 1.123)
This commit is contained in:
hp.com!davidm 2003-11-24 21:37:22 +00:00
parent 94f198b288
commit 90e8393da3

View file

@ -81,6 +81,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
# define dprintf(format...) \
fprintf (stderr, format)
# ifdef __GNUC__
# undef inline
# define inline __attribute__ ((unused))
# endif
#else
@ -103,8 +104,16 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#define mutex_lock(l) (pthread_mutex_lock ? pthread_mutex_lock (l) : 0)
#define mutex_unlock(l) (pthread_mutex_unlock ? pthread_mutex_unlock (l) : 0)
#ifdef HAVE_IA64INTRIN_H
#ifdef HAVE_ATOMIC_OPS_H
# include <atomic_ops.h>
# define cmpxchg_ptr(_ptr,_o,_n) AO_compare_and_swap((AO_T *)_ptr, \
(AO_T) (_o), \
(AO_T) (_n))
# define fetch_and_add1(_ptr) AO_fetch_and_add1(_ptr)
# define HAVE_CMPXCHG
# define HAVE_FETCH_AND_ADD1
#else
# ifdef HAVE_IA64INTRIN_H
# include <ia64intrin.h>
/*
* ecc v7.0 is broken: it's missing __sync_val_compare_and_swap()
@ -117,7 +126,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
# define cmpxchg_ptr(_ptr,_o,_n) \
((void *) __sync_val_compare_and_swap((volatile long *) (_ptr), \
(long) (_o), (long) (_n)))
(long) (_o), (long) (_n)) \
!= (_o))
# define fetch_and_add1(_ptr) __sync_fetch_and_add(_ptr, 1)
# define HAVE_CMPXCHG
# define HAVE_FETCH_AND_ADD1
# endif
#endif
#define UNWI_OBJ(fn) UNW_PASTE(UNW_PREFIX,UNW_PASTE(I,fn))