diff --git a/configure/os/CONFIG.Common.cygwin-x86 b/configure/os/CONFIG.Common.cygwin-x86 index ee3653b76..f19c5c789 100644 --- a/configure/os/CONFIG.Common.cygwin-x86 +++ b/configure/os/CONFIG.Common.cygwin-x86 @@ -23,6 +23,9 @@ POSIX_LDLIBS += -lpthread ARCH_DEP_CFLAGS += -m32 ARCH_DEP_LDFLAGS += -m32 +# default minimum target architecture is pentium +ARCH_DEP_CFLAGS += -march=i586 + # Compiler defines _X86_ 1 # Compiler defines __MSVCRT__ 1 # Compiler defines __CYGWIN__ 1 diff --git a/configure/os/CONFIG.Common.win32-x86-cygwin b/configure/os/CONFIG.Common.win32-x86-cygwin index 49029cf2e..2e2e18aec 100644 --- a/configure/os/CONFIG.Common.win32-x86-cygwin +++ b/configure/os/CONFIG.Common.win32-x86-cygwin @@ -23,6 +23,9 @@ POSIX_LDLIBS += -lpthread ARCH_DEP_CFLAGS += -m32 ARCH_DEP_LDFLAGS += -m32 +# default minimum target architecture is pentium +ARCH_DEP_CFLAGS += -march=i586 + # With no-cygwin option: # compiler defines _X86_ 1 # compiler defines __MSVCRT__ 1 diff --git a/configure/os/CONFIG.Common.win32-x86-mingw b/configure/os/CONFIG.Common.win32-x86-mingw index f4ee2c1ff..00bfd650d 100644 --- a/configure/os/CONFIG.Common.win32-x86-mingw +++ b/configure/os/CONFIG.Common.win32-x86-mingw @@ -19,6 +19,9 @@ LDLIBS_READLINE = -lreadline -lcurses ARCH_DEP_CFLAGS += -m32 ARCH_DEP_LDFLAGS += -m32 +# default minimum target architecture is pentium +ARCH_DEP_CFLAGS += -march=i586 + # Compiler defines _X86_ 1 # Compiler defines __MSVCRT__ 1 # Compiler defines __MINGW32__ 1 diff --git a/configure/os/CONFIG.linux-x86.linux-x86 b/configure/os/CONFIG.linux-x86.linux-x86 index 775680e11..6414b5ab0 100644 --- a/configure/os/CONFIG.linux-x86.linux-x86 +++ b/configure/os/CONFIG.linux-x86.linux-x86 @@ -16,8 +16,3 @@ STATIC_LDLIBS_NO= SHRLIB_LDFLAGS += -Wl,-h$@ LOADABLE_SHRLIB_LDFLAGS += -Wl,-h$@ - -# this means that atomic instrnsics are available, but that -# users with 486 processors and earlier will need specialized -# configure files -ARCH_DEP_CFLAGS += -march=i586 \ No newline at end of file diff --git a/configure/os/CONFIG.win32-x86-cygwin.win32-x86-cygwin b/configure/os/CONFIG.win32-x86-cygwin.win32-x86-cygwin index 5dca1b714..aa29f4d7a 100644 --- a/configure/os/CONFIG.win32-x86-cygwin.win32-x86-cygwin +++ b/configure/os/CONFIG.win32-x86-cygwin.win32-x86-cygwin @@ -23,11 +23,6 @@ SHRLIB_CFLAGS = SHRLIB_LDFLAGS = -shared -Wl,--out-implib,$(LIB_PREFIX)$*$(LIB_SUFFIX) LOADABLE_SHRLIB_LDFLAGS = -shared -Wl,--out-implib,$(LIB_PREFIX)$*$(LIB_SUFFIX) -# this means that atomic instrnsics are available, but that -# users with 486 processors and earlier will need specialized -# configure files -ARCH_DEP_CFLAGS += -march=i586 - # Override linking with gcc library from CONFIG.gnuCommon GNU_LDLIBS_YES = diff --git a/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw b/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw index 32a6733ad..8309f8b45 100644 --- a/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw +++ b/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw @@ -18,11 +18,6 @@ RANLIB = ranlib RES=.coff RCCMD = windres $(INCLUDES) $< $@ -# this means that atomic instrnsics are available, but that -# users with 486 processors and earlier will need specialized -# configure files -ARCH_DEP_CFLAGS += -march=i586 - # No -fPIC avoids "-fPIC ignored for target (all code is position independent)" SHRLIB_CFLAGS = SHRLIB_LDFLAGS = -shared -Wl,--out-implib,$(LIB_PREFIX)$*$(LIB_SUFFIX) diff --git a/src/libCom/osi/os/solaris/epicsAtomicOSD.h b/src/libCom/osi/os/solaris/epicsAtomicOSD.h index 36273d965..5248c24ce 100644 --- a/src/libCom/osi/os/solaris/epicsAtomicOSD.h +++ b/src/libCom/osi/os/solaris/epicsAtomicOSD.h @@ -48,46 +48,64 @@ OSD_ATOMIC_INLINE void epicsAtomicSetUIntT ( unsigned * pTarget, unsigned newVal OSD_ATOMIC_INLINE size_t epicsAtomicIncrSizeT ( size_t * pTarget ) { - return atomic_inc_uint_nv ( pTarget ); + unsigned * const pTarg = ( unsigned * ) ( pTarget ); + return atomic_inc_uint_nv ( pTarg ); } OSD_ATOMIC_INLINE size_t epicsAtomicDecrSizeT ( size_t * pTarget ) { - return atomic_dec_uint_nv ( pTarget ); + unsigned * const pTarg = ( unsigned * ) ( pTarget ); + return atomic_dec_uint_nv ( pTarg ); } OSD_ATOMIC_INLINE void epicsAtomicSetSizeT ( size_t * pTarget, size_t newVal ) { - atomic_swap_uint ( pTarget, newVal ); + unsigned * const pTarg = ( unsigned * ) ( pTarget ); + atomic_swap_uint ( pTarg, newVal ); } OSD_ATOMIC_INLINE size_t epicsAtomicGetSizeT ( const size_t * pTarget ) { - return atomic_or_uint_nv ( pTarget, 0U ); + /* + * we cast away const, but are careful not to modify + * the target + */ + unsigned * const pTarg = ( unsigned * ) ( pTarget ); + return atomic_or_uint_nv ( pTarg, 0U ); } -#else /* SIZE_MAX == UINT_MAX */ +#elif SIZE_MAX == ULONG_MAX OSD_ATOMIC_INLINE size_t epicsAtomicIncrSizeT ( size_t * pTarget ) { - return atomic_inc_ulong_nv ( pTarget ); + unsigned long * const pTarg = ( unsigned long * ) ( pTarget ); + return atomic_inc_ulong_nv ( pTarg ); } OSD_ATOMIC_INLINE size_t epicsAtomicDecrSizeT ( size_t * pTarget ) { - return atomic_dec_ulong_nv ( pTarget ); + unsigned long * const pTarg = ( unsigned long * ) ( pTarget ); + return atomic_dec_ulong_nv ( pTarg ); } OSD_ATOMIC_INLINE void epicsAtomicSetSizeT ( size_t * pTarget, size_t newVal ) { - atomic_swap_ulong ( pTarget, newval ); + unsigned long * const pTarg = ( unsigned long * ) ( pTarget ); + atomic_swap_ulong ( pTarg, newval ); } OSD_ATOMIC_INLINE size_t epicsAtomicGetSizeT ( const size_t * pTarget ) { - return atomic_or_ulong_nv ( pTarget, 0U ); + /* + * we cast away const, but are careful not to modify + * the target + */ + unsigned long * const pTarg = ( unsigned long * ) ( pTarget ); + return atomic_or_ulong_nv ( pTarg, 0UL ); } +#else +# error unsupported solaris architecture #endif /* SIZE_MAX == UINT_MAX */ #ifdef __cplusplus