From: Mathieu Desnoyers Date: Mon, 27 Jun 2011 20:54:56 +0000 (-0400) Subject: uatomic: fix i386 support X-Git-Tag: v0.6.3~2 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=8c43fe7257db4d2d75bbf06066d10a3a414f061e;p=urcu.git uatomic: fix i386 support Fix: * Incorrect prototype for uatomic_and and uatomic_or in i386 compatibility code. * Missing $(COMPAT) code inclusion in wfq/lfq tests. * Silence gcc warnings about compat code (branch volountarily causing a linker error, which can never return). Signed-off-by: Mathieu Desnoyers --- diff --git a/compat_arch_x86.c b/compat_arch_x86.c index 9cbd3c8..e882a4a 100644 --- a/compat_arch_x86.c +++ b/compat_arch_x86.c @@ -152,6 +152,7 @@ unsigned long _compat_uatomic_xchg(void *addr, unsigned long _new, int len) * generate an illegal instruction. Cannot catch this with * linker tricks when optimizations are disabled. */ + retval = 0; /* silence gcc warnings */ __asm__ __volatile__("ud2"); } mutex_lock_signal_restore(&compat_mutex, &mask); @@ -195,6 +196,7 @@ unsigned long _compat_uatomic_cmpxchg(void *addr, unsigned long old, * generate an illegal instruction. Cannot catch this with * linker tricks when optimizations are disabled. */ + retval = 0; /* silence gcc warnings */ __asm__ __volatile__("ud2"); } mutex_lock_signal_restore(&compat_mutex, &mask); @@ -275,6 +277,7 @@ unsigned long _compat_uatomic_add_return(void *addr, unsigned long v, int len) * generate an illegal instruction. Cannot catch this with * linker tricks when optimizations are disabled. */ + result = 0; /* silence gcc warnings */ __asm__ __volatile__("ud2"); } mutex_lock_signal_restore(&compat_mutex, &mask); diff --git a/tests/Makefile.am b/tests/Makefile.am index 3800260..674260f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -160,7 +160,7 @@ test_urcu_lfq_dynlink_SOURCES = test_urcu_lfq.c $(URCU) test_urcu_lfq_dynlink_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS) test_urcu_lfq_dynlink_LDADD = $(URCU_CDS_LIB) -test_urcu_wfq_SOURCES = test_urcu_wfq.c +test_urcu_wfq_SOURCES = test_urcu_wfq.c $(COMPAT) test_urcu_wfq_dynlink_SOURCES = test_urcu_wfq.c test_urcu_wfq_dynlink_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS) test_urcu_wfq_dynlink_LDADD = $(URCU_CDS_LIB) @@ -170,7 +170,7 @@ test_urcu_lfs_dynlink_SOURCES = test_urcu_lfs.c $(URCU_DEFER) test_urcu_lfs_dynlink_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS) test_urcu_lfs_dynlink_LDADD = $(URCU_CDS_LIB) -test_urcu_wfs_SOURCES = test_urcu_wfs.c +test_urcu_wfs_SOURCES = test_urcu_wfs.c $(COMPAT) test_urcu_wfs_dynlink_SOURCES = test_urcu_wfs.c test_urcu_wfs_dynlink_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS) test_urcu_wfs_dynlink_LDADD = $(URCU_CDS_LIB) diff --git a/urcu/uatomic/x86.h b/urcu/uatomic/x86.h index b4c108f..e064b9e 100644 --- a/urcu/uatomic/x86.h +++ b/urcu/uatomic/x86.h @@ -536,26 +536,24 @@ extern unsigned long _compat_uatomic_cmpxchg(void *addr, unsigned long old, (unsigned long)(_new), \ sizeof(*(addr)))) -extern unsigned long _compat_uatomic_and(void *addr, - unsigned long _new, int len); +extern void _compat_uatomic_and(void *addr, unsigned long _new, int len); #define compat_uatomic_and(addr, v) \ - ((__typeof__(*(addr))) _compat_uatomic_and((addr), \ - (unsigned long)(v), \ - sizeof(*(addr)))) + (_compat_uatomic_and((addr), \ + (unsigned long)(v), \ + sizeof(*(addr)))) -extern unsigned long _compat_uatomic_or(void *addr, - unsigned long _new, int len); +extern void _compat_uatomic_or(void *addr, unsigned long _new, int len); #define compat_uatomic_or(addr, v) \ - ((__typeof__(*(addr))) _compat_uatomic_or((addr), \ - (unsigned long)(v), \ - sizeof(*(addr)))) + (_compat_uatomic_or((addr), \ + (unsigned long)(v), \ + sizeof(*(addr)))) extern unsigned long _compat_uatomic_add_return(void *addr, unsigned long _new, int len); -#define compat_uatomic_add_return(addr, v) \ - ((__typeof__(*(addr))) _compat_uatomic_add_return((addr), \ - (unsigned long)(v), \ - sizeof(*(addr)))) +#define compat_uatomic_add_return(addr, v) \ + ((__typeof__(*(addr))) _compat_uatomic_add_return((addr), \ + (unsigned long)(v), \ + sizeof(*(addr)))) #define compat_uatomic_add(addr, v) \ ((void)compat_uatomic_add_return((addr), (v)))