Code review comment for lp:~epics-core/epics-base/rebased-atomics

Revision history for this message
Andrew Johnson (anj) wrote :

Hi Jeff,

I get this build failure on solaris-sparc:

/opt/SUNWspro/bin/CC -c -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -DUNIX -DSOLARIS=10 -mt -D__EXTENSIONS__ -O +w -xcode=pic32 -I. -I../O.Common -I. -I../../../src/libCom/osi/compiler/solStudio -I../../../src/libCom/osi/compiler/default -I. -I../../../src/libCom/osi/os/solaris -I../../../src/libCom/osi/os/posix -I../../../src/libCom/osi/os/default -I.. -I../../../src/libCom/as -I../../../src/libCom/bucketLib -I../../../src/libCom/calc -I../../../src/libCom/cvtFast -I../../../src/libCom/cppStd -I../../../src/libCom/cxxTemplates -I../../../src/libCom/dbmf -I../../../src/libCom/ellLib -I../../../src/libCom/env -I../../../src/libCom/error -I../../../src/libCom/fdmgr -I../../../src/libCom/flex -I../../../src/libCom/freeList -I../../../src/libCom/gpHash -I../../../src/libCom/iocsh -I../../../src/libCom/log -I../../../src/libCom/macLib -I../../../src/libCom/misc -I../../../src/libCom/osi -I../../../src/libCom/ring -I../../../src/libCom/taskwd -I../../../src/libCom/timer -I../../../src/libCom/tsDefs -I../../../src/libCom/yacc -I../../../include/compiler/solStudio -I../../../include/os/solaris -I../../../include ../../../src/libCom/osi/epicsAtomicLocked.cpp
"../../../src/libCom/osi/os/solaris/epicsAtomicOSD.h", line 99: Error: The function "atomic_inc_ptr_nv" must have a prototype.
"../../../src/libCom/osi/os/solaris/epicsAtomicOSD.h", line 119: Error: The function "atomic_dec_ptr_nv" must have a prototype.
"../../../src/libCom/osi/epicsAtomicLocked.cpp", line 69: Warning (Anachronism): Formal argument 2 of type extern "C" void(*)(void*) in call to epicsThreadOnce(epicsThreadOSD**, extern "C" void(*)(void*), void*) is being passed void(*)(void*).
2 Error(s) and 1 Warning(s) detected.
make[3]: *** [epicsAtomicLocked.o] Error 2

The sys/atomic.h file on solaris-sparc only contains the atomic_inc_* functions below. I'm also including a comment that appears about using the _nv versions:

/*
 * As above, but return the new value. Note that these _nv() variants are
 * substantially more expensive on some platforms than the no-return-value
 * versions above, so don't use them unless you really need to know the
 * new value *atomically* (e.g. when decrementing a reference count and
 * checking whether it went to zero).
 */

/*
 * Increment target and return new value.
 */
extern uint8_t atomic_inc_8_nv(volatile uint8_t *);
extern uchar_t atomic_inc_uchar_nv(volatile uchar_t *);
extern uint16_t atomic_inc_16_nv(volatile uint16_t *);
extern ushort_t atomic_inc_ushort_nv(volatile ushort_t *);
extern uint32_t atomic_inc_32_nv(volatile uint32_t *);
extern uint_t atomic_inc_uint_nv(volatile uint_t *);
extern ulong_t atomic_inc_ulong_nv(volatile ulong_t *);
#if defined(_KERNEL) || defined(_INT64_TYPE)
extern uint64_t atomic_inc_64_nv(volatile uint64_t *);
#endif

- Andrew

review: Needs Fixing

« Back to merge proposal