Merge lp:~epics-core/epics-base/fixatomiclinkage into lp:~epics-core/epics-base/3.16

Proposed by mdavidsaver
Status: Superseded
Proposed branch: lp:~epics-core/epics-base/fixatomiclinkage
Merge into: lp:~epics-core/epics-base/3.16
Diff against target: 1249 lines (+484/-201)
27 files modified
configure/RULES_BUILD (+5/-4)
src/libCom/osi/compiler/clang/compilerSpecific.h (+6/-0)
src/libCom/osi/compiler/clang/epicsAtomicCD.h (+1/-9)
src/libCom/osi/compiler/default/compilerSpecific.h (+8/-0)
src/libCom/osi/compiler/default/epicsAtomicCD.h (+3/-10)
src/libCom/osi/compiler/gcc/compilerSpecific.h (+6/-0)
src/libCom/osi/compiler/gcc/epicsAtomicCD.h (+5/-5)
src/libCom/osi/compiler/msvc/compilerSpecific.h (+6/-0)
src/libCom/osi/compiler/msvc/epicsAtomicCD.h (+8/-14)
src/libCom/osi/compiler/solStudio/compilerSpecific.h (+44/-0)
src/libCom/osi/compiler/solStudio/epicsAtomicCD.h (+1/-9)
src/libCom/osi/epicsAtomic.h (+41/-60)
src/libCom/osi/os/RTEMS/epicsAtomicOSD.h (+65/-0)
src/libCom/osi/os/WIN32/epicsAtomicOSD.cpp (+0/-22)
src/libCom/osi/os/WIN32/epicsAtomicOSD.h (+2/-0)
src/libCom/osi/os/posix/epicsAtomicOSD.cpp (+11/-36)
src/libCom/osi/os/posix/epicsAtomicOSD.h (+19/-0)
src/libCom/osi/os/solaris/epicsAtomicOSD.h (+11/-7)
src/libCom/osi/os/vxWorks/epicsAtomicOSD.cpp (+0/-21)
src/libCom/osi/os/vxWorks/epicsAtomicOSD.h (+8/-4)
src/libCom/test/Makefile (+8/-0)
src/libCom/test/epicsAtomicTest.cpp (+78/-0)
src/libCom/test/epicsInlineTest1.c (+64/-0)
src/libCom/test/epicsInlineTest2.c (+28/-0)
src/libCom/test/epicsInlineTest3.cpp (+27/-0)
src/libCom/test/epicsInlineTest4.cpp (+27/-0)
src/libCom/test/epicsRunLibComTests.c (+2/-0)
To merge this branch: bzr merge lp:~epics-core/epics-base/fixatomiclinkage
Reviewer Review Type Date Requested Status
Andrew Johnson Approve
Ralph Lange Approve
mdavidsaver Approve
Review via email: mp+250813@code.launchpad.net

This proposal has been superseded by a proposal from 2015-02-27.

Description of the change

To address lp:1425197 switch epicsAtomic functions to 'static inline', which should be consistent accross language and compiler.

Add EPICS_ALWAYS_INLINE macro to help with short wrappers like these.

Add an ISR safe defintion for epicsAtomicLock() for RTEMS.

Extend epicsAtomicTest to print some information about the conditionals effecting epicsAtomicCD and OSD

Add epicsInlineTest to check consistency of 'static inline'.

Also fix some empty argument lists.

To post a comment you must log in.
Revision history for this message
mdavidsaver (mdavidsaver) wrote :

I think this is complete. However, I can only test with GCC on Linux and RTEMS.

review: Approve
Revision history for this message
Ralph Lange (ralph-lange) wrote :

From looking at the code and running the test: yep.

I am even more restricted than Michael in testing envs, though.

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

I thought you talked about wanting to fix this in 3.15, but this is branched off 3.16.
Tested on RHEL6.6, built OK for VxWorks but not tested yet.

My solaris-sparc build printed this and died:

"../../../src/libCom/osi/compiler/solStudio/compilerSpecific.h", line 20: Error: #error Not Solaris Studio.

I'll investigate further tomorrow (and run tests on VxWorks, Darwin and Windows), I have this afternoon off.

review: Needs Fixing
Revision history for this message
mdavidsaver (mdavidsaver) wrote :

> I thought you talked about wanting to fix this in 3.15, but this is branched off 3.16.

I do want to target 3.15. If it works with the necessary vxWorks versions (5.5?) then I'll switch to the 3.15 branch.

> Error: #error Not Solaris Studio.

This was all sight unseen, so clearly __SUNPRO_C isn't the correct macro name.

> I have this afternoon off.

Talk to you tomorrow then.

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

The C++ compiler defines __SUNPRO_CC instead, the C builds were working fine. I committed a fix, assuming that C++ compiler has the same version restrictions on __attribute__((always_inline)).

Built and tested (libCom/test only) on VxWorks 6.9 and 5.5.2, OK.

Build on Windows-x64 failed at epicsAtomicTest.cpp due to a typo in testClassify(), now fixed but it does now output "# OS dependent impl name undefined" which you might want to look at.

I also ran a few tests from a cross-built MinGW with no issues; this correctly outputs "# OS dependent impl name WIN32"

I think you could move this to the 3.15 branch instead of 3.16.

review: Approve
12632. By mdavidsaver

add EPICS_ALWAYS_INLINE

12633. By mdavidsaver

libCom/test: Add epicsInlineTest

12634. By mdavidsaver

epicsAtomic: fix C linkage

With gcc -std=gnu99 (present default) functions qualified
with plain 'inline' emit strong public symbols (nm says 'T')
in every compilation unit the definition appears.
This causes linking to fail in all cases where executable
are statically linked, and many where dynamic linking is used.

12635. By mdavidsaver

epicsAtomicTest: include some information about build conditions

Give some idea which implementations are being used

12636. By mdavidsaver

epicsAtomic: RTEMS ISR safe impl. for epicsAtomicLock()

12637. By mdavidsaver

Fix for Solaris C++ compiler

12638. By mdavidsaver

Fix typo in epicsAtomicTest.cpp testClassify()

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure/RULES_BUILD'
2--- configure/RULES_BUILD 2015-02-04 17:39:26 +0000
3+++ configure/RULES_BUILD 2015-02-27 22:36:36 +0000
4@@ -94,7 +94,7 @@
5 # Read dependency files
6
7 ifneq (,$(strip $(HDEPENDS_FILES)))
8-$(filter-out $(wildcard *$(DEP)), $(HDEPENDS_FILES)): $(COMMON_INC)
9+$(filter-out $(wildcard *$(DEP)), $(HDEPENDS_FILES)): | $(COMMON_INC)
10 -include $(HDEPENDS_FILES)
11 endif
12
13@@ -215,15 +215,16 @@
14 %.o : %.cc
15 %.o : %.cpp
16
17-%$(OBJ): %.c $(COMMON_INC) $(INSTALL_INC)
18+# Include files are order-only prerequisites for compilation:
19+%$(OBJ): %.c | $(COMMON_INC) $(INSTALL_INC)
20 @$(RM) $@
21 $(COMPILE.c) -c $<
22
23-%$(OBJ): %.cc $(COMMON_INC) $(INSTALL_INC)
24+%$(OBJ): %.cc | $(COMMON_INC) $(INSTALL_INC)
25 @$(RM) $@
26 $(COMPILE.cpp) -c $<
27
28-%$(OBJ): %.cpp $(COMMON_INC) $(INSTALL_INC)
29+%$(OBJ): %.cpp | $(COMMON_INC) $(INSTALL_INC)
30 @$(RM) $@
31 $(COMPILE.cpp) -c $<
32
33
34=== modified file 'src/libCom/osi/compiler/clang/compilerSpecific.h'
35--- src/libCom/osi/compiler/clang/compilerSpecific.h 2014-02-21 00:05:42 +0000
36+++ src/libCom/osi/compiler/clang/compilerSpecific.h 2015-02-27 22:36:36 +0000
37@@ -20,6 +20,12 @@
38 # error compiler/clang/compilerSpecific.h is only for use with the clang compiler
39 #endif
40
41+#if __has_attribute(always_inline)
42+#define EPICS_ALWAYS_INLINE __inline__ __attribute__((always_inline))
43+#else
44+#define EPICS_ALWAYS_INLINE __inline__
45+#endif
46+
47 #ifdef __cplusplus
48
49 /*
50
51=== modified file 'src/libCom/osi/compiler/clang/epicsAtomicCD.h'
52--- src/libCom/osi/compiler/clang/epicsAtomicCD.h 2011-09-01 17:25:53 +0000
53+++ src/libCom/osi/compiler/clang/epicsAtomicCD.h 2015-02-27 22:36:36 +0000
54@@ -16,16 +16,8 @@
55 #ifndef epicsAtomicCD_h
56 #define epicsAtomicCD_h
57
58-#if defined ( __cplusplus )
59-# define EPICS_ATOMIC_INLINE inline
60-#else
61-# define EPICS_ATOMIC_INLINE __inline__
62-#endif
63+#define EPICS_ATOMIC_CMPLR_NAME "CLANG"
64
65-/*
66- * we have an inline keyword so we can proceed
67- * with an os specific inline instantiation
68- */
69 #include "epicsAtomicOSD.h"
70
71 #endif /* epicsAtomicCD_h */
72
73=== modified file 'src/libCom/osi/compiler/default/compilerSpecific.h'
74--- src/libCom/osi/compiler/default/compilerSpecific.h 2011-08-31 22:35:18 +0000
75+++ src/libCom/osi/compiler/default/compilerSpecific.h 2015-02-27 22:36:36 +0000
76@@ -15,6 +15,14 @@
77
78 #ifndef compilerSpecific_h
79 #define compilerSpecific_h
80+
81+/* The 'inline' key work, possibily with compiler
82+ * dependent flags to force inlineing where it would
83+ * otherwise not be done.
84+ *
85+ * Warning: Second guessing the compiler may result in larger code size
86+ */
87+#define EPICS_ALWAYS_INLINE inline
88
89 #ifdef __cplusplus
90
91
92=== modified file 'src/libCom/osi/compiler/default/epicsAtomicCD.h'
93--- src/libCom/osi/compiler/default/epicsAtomicCD.h 2011-09-01 17:25:53 +0000
94+++ src/libCom/osi/compiler/default/epicsAtomicCD.h 2015-02-27 22:36:36 +0000
95@@ -16,15 +16,8 @@
96 #ifndef epicsAtomicCD_h
97 #define epicsAtomicCD_h
98
99-#if __STDC_VERSION__ >= 199901L || defined ( __cplusplus )
100-# define EPICS_ATOMIC_INLINE inline
101- /*
102- * We have already defined the public interface in epicsAtomic.h
103- * so there is nothing more to implement if there isnt an inline
104- * keyword available. Otherwise, if we have an inline keyword
105- * we will proceed with an os specific inline implementation.
106- */
107-# include "epicsAtomicOSD.h"
108-#endif
109+#define EPICS_ATOMIC_CMPLR_NAME "DEFAULT"
110+
111+#include "epicsAtomicOSD.h"
112
113 #endif /* epicsAtomicCD_h */
114
115=== modified file 'src/libCom/osi/compiler/gcc/compilerSpecific.h'
116--- src/libCom/osi/compiler/gcc/compilerSpecific.h 2014-02-21 00:05:42 +0000
117+++ src/libCom/osi/compiler/gcc/compilerSpecific.h 2015-02-27 22:36:36 +0000
118@@ -23,6 +23,12 @@
119 #ifdef __clang__
120 # error compiler/gcc/compilerSpecific.h is not for use with the clang compiler
121 #endif
122+
123+#if __GNUC__ > 2
124+# define EPICS_ALWAYS_INLINE __inline__ __attribute__((always_inline))
125+#else
126+# define EPICS_ALWAYS_INLINE __inline__
127+#endif
128
129 #ifdef __cplusplus
130
131
132=== modified file 'src/libCom/osi/compiler/gcc/epicsAtomicCD.h'
133--- src/libCom/osi/compiler/gcc/epicsAtomicCD.h 2013-11-21 00:55:44 +0000
134+++ src/libCom/osi/compiler/gcc/epicsAtomicCD.h 2015-02-27 22:36:36 +0000
135@@ -20,7 +20,7 @@
136 # error this header is only for use with the gnu compiler
137 #endif
138
139-#define EPICS_ATOMIC_INLINE __inline__
140+#define EPICS_ATOMIC_CMPLR_NAME "GCC"
141
142 #define GCC_ATOMIC_CONCAT( A, B ) GCC_ATOMIC_CONCATR(A,B)
143 #define GCC_ATOMIC_CONCATR( A, B ) ( A ## B )
144@@ -69,7 +69,7 @@
145
146 #ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER
147 #define EPICS_ATOMIC_READ_MEMORY_BARRIER
148-EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier ()
149+EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void)
150 {
151 __sync_synchronize ();
152 }
153@@ -77,7 +77,7 @@
154
155 #ifndef EPICS_ATOMIC_WRITE_MEMORY_BARRIER
156 #define EPICS_ATOMIC_WRITE_MEMORY_BARRIER
157-EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier ()
158+EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void)
159 {
160 __sync_synchronize ();
161 }
162@@ -88,7 +88,7 @@
163 #ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER
164 #if GCC_ATOMIC_INTRINSICS_MIN_X86
165 #define EPICS_ATOMIC_READ_MEMORY_BARRIER
166-EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier ()
167+EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void)
168 {
169 asm("mfence;");
170 }
171@@ -98,7 +98,7 @@
172 #ifndef EPICS_ATOMIC_WRITE_MEMORY_BARRIER
173 #if GCC_ATOMIC_INTRINSICS_MIN_X86
174 #define EPICS_ATOMIC_WRITE_MEMORY_BARRIER
175-EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier ()
176+EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void)
177 {
178 asm("mfence;");
179 }
180
181=== modified file 'src/libCom/osi/compiler/msvc/compilerSpecific.h'
182--- src/libCom/osi/compiler/msvc/compilerSpecific.h 2011-08-31 22:35:18 +0000
183+++ src/libCom/osi/compiler/msvc/compilerSpecific.h 2015-02-27 22:36:36 +0000
184@@ -20,6 +20,12 @@
185 # error compiler/msvc/compilerSpecific.h is only for use with the Microsoft compiler
186 #endif
187
188+#if _MSC_VER >= 1200
189+#define EPICS_ALWAYS_INLINE __forceinline
190+#else
191+#define EPICS_ALWAYS_INLINE __inline
192+#endif
193+
194 #ifdef __cplusplus
195
196 /*
197
198=== modified file 'src/libCom/osi/compiler/msvc/epicsAtomicCD.h'
199--- src/libCom/osi/compiler/msvc/epicsAtomicCD.h 2011-09-01 17:25:53 +0000
200+++ src/libCom/osi/compiler/msvc/epicsAtomicCD.h 2015-02-27 22:36:36 +0000
201@@ -24,18 +24,14 @@
202
203 #ifdef _MSC_EXTENSIONS
204
205+#define EPICS_ATOMIC_CMPLR_NAME "MSVC-INTRINSIC"
206+
207 #include <intrin.h>
208
209-#if _MSC_VER >= 1200
210-# define EPICS_ATOMIC_INLINE __forceinline
211-#else
212-# define EPICS_ATOMIC_INLINE __inline
213-#endif
214-
215 #if defined ( _M_IX86 )
216 # pragma warning( push )
217 # pragma warning( disable : 4793 )
218- EPICS_ATOMIC_INLINE void epicsAtomicMemoryBarrier ()
219+ EPICS_ATOMIC_INLINE void epicsAtomicMemoryBarrier (void)
220 {
221 long fence;
222 __asm { xchg fence, eax }
223@@ -44,14 +40,14 @@
224 #elif defined ( _M_X64 )
225 # define MS_ATOMIC_64
226 # pragma intrinsic ( __faststorefence )
227- EPICS_ATOMIC_INLINE void epicsAtomicMemoryBarrier ()
228+ EPICS_ATOMIC_INLINE void epicsAtomicMemoryBarrier (void)
229 {
230 __faststorefence ();
231 }
232 #elif defined ( _M_IA64 )
233 # define MS_ATOMIC_64
234 # pragma intrinsic ( __mf )
235- EPICS_ATOMIC_INLINE void epicsAtomicMemoryBarrier ()
236+ EPICS_ATOMIC_INLINE void epicsAtomicMemoryBarrier (void)
237 {
238 __mf ();
239 }
240@@ -88,13 +84,13 @@
241 #endif /* __cplusplus */
242
243 #define EPICS_ATOMIC_READ_MEMORY_BARRIER
244-EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier ()
245+EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void)
246 {
247 epicsAtomicMemoryBarrier ();
248 }
249
250 #define EPICS_ATOMIC_WRITE_MEMORY_BARRIER
251-EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier ()
252+EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void)
253 {
254 epicsAtomicMemoryBarrier ();
255 }
256@@ -108,9 +104,7 @@
257
258 #else /* ifdef _MSC_EXTENSIONS */
259
260-#if defined ( __cplusplus )
261-# define EPICS_ATOMIC_INLINE inline
262-#endif
263+#define EPICS_ATOMIC_CMPLR_NAME "MSVC-DIRECT"
264
265 /*
266 * if unavailable as an intrinsic we will try
267
268=== added file 'src/libCom/osi/compiler/solStudio/compilerSpecific.h'
269--- src/libCom/osi/compiler/solStudio/compilerSpecific.h 1970-01-01 00:00:00 +0000
270+++ src/libCom/osi/compiler/solStudio/compilerSpecific.h 2015-02-27 22:36:36 +0000
271@@ -0,0 +1,44 @@
272+/*************************************************************************\
273+* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
274+* National Laboratory.
275+* Copyright (c) 2002 The Regents of the University of California, as
276+* Operator of Los Alamos National Laboratory.
277+* EPICS BASE is distributed subject to a Software License Agreement found
278+* in file LICENSE that is included with this distribution.
279+\*************************************************************************/
280+
281+/*
282+ * Author:
283+ * Jeffrey O. Hill
284+ * johill@lanl.gov
285+ */
286+
287+#ifndef compilerSpecific_h
288+#define compilerSpecific_h
289+
290+#if !defined(__SUNPRO_C) && !defined (__SUNPRO_CC)
291+# error Not Solaris Studio
292+#endif
293+
294+#if (defined(__SUNPRO_C) && __SUNPRO_C < 0x590) || \
295+ (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
296+# define EPICS_ALWAYS_INLINE inline
297+#else
298+# define EPICS_ALWAYS_INLINE inline __attribute__((always_inline))
299+#endif
300+
301+#ifdef __cplusplus
302+
303+/*
304+ * CXX_PLACEMENT_DELETE - defined if compiler supports placement delete
305+ * CXX_THROW_SPECIFICATION - defined if compiler supports throw specification
306+ *
307+ * (our default guess is that the compiler implements the C++ 97 standard)
308+ */
309+#define CXX_THROW_SPECIFICATION
310+#define CXX_PLACEMENT_DELETE
311+
312+#endif /* __cplusplus */
313+
314+
315+#endif /* ifndef compilerSpecific_h */
316
317=== modified file 'src/libCom/osi/compiler/solStudio/epicsAtomicCD.h'
318--- src/libCom/osi/compiler/solStudio/epicsAtomicCD.h 2011-09-01 17:25:53 +0000
319+++ src/libCom/osi/compiler/solStudio/epicsAtomicCD.h 2015-02-27 22:36:36 +0000
320@@ -16,16 +16,8 @@
321 #ifndef epicsAtomicCD_h
322 #define epicsAtomicCD_h
323
324-#if defined ( __cplusplus )
325-# define EPICS_ATOMIC_INLINE inline
326-#else
327-# define EPICS_ATOMIC_INLINE __inline
328-#endif
329+#define EPICS_ATOMIC_CMPLR_NAME "SOLSTUDIO"
330
331-/*
332- * we have an inline keyword so we can proceed
333- * with an os specific inline instantiation
334- */
335 #include "epicsAtomicOSD.h"
336
337 #endif /* epicsAtomicCD_h */
338
339=== modified file 'src/libCom/osi/epicsAtomic.h'
340--- src/libCom/osi/epicsAtomic.h 2013-11-20 17:51:14 +0000
341+++ src/libCom/osi/epicsAtomic.h 2015-02-27 22:36:36 +0000
342@@ -17,7 +17,9 @@
343
344 #include <stdlib.h> /* define size_t */
345
346-#include "shareLib.h"
347+#include "compilerSpecific.h"
348+
349+#define EPICS_ATOMIC_INLINE static EPICS_ALWAYS_INLINE
350
351 #ifdef __cplusplus
352 extern "C" {
353@@ -26,10 +28,10 @@
354 typedef void * EpicsAtomicPtrT;
355
356 /* load target into cache */
357-epicsShareFunc void epicsAtomicReadMemoryBarrier ();
358+EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void);
359
360 /* push cache version of target into target */
361-epicsShareFunc void epicsAtomicWriteMemoryBarrier ();
362+EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void);
363
364 /*
365 * lock out other smp processors from accessing the target,
366@@ -37,8 +39,8 @@
367 * to target, allow other smp processors to access the target,
368 * return new value of target as modified by this operation
369 */
370-epicsShareFunc size_t epicsAtomicIncrSizeT ( size_t * pTarget );
371-epicsShareFunc int epicsAtomicIncrIntT ( int * pTarget );
372+EPICS_ATOMIC_INLINE size_t epicsAtomicIncrSizeT ( size_t * pTarget );
373+EPICS_ATOMIC_INLINE int epicsAtomicIncrIntT ( int * pTarget );
374
375 /*
376 * lock out other smp processors from accessing the target,
377@@ -46,8 +48,8 @@
378 * to target, allow out other smp processors to access the target,
379 * return new value of target as modified by this operation
380 */
381-epicsShareFunc size_t epicsAtomicDecrSizeT ( size_t * pTarget );
382-epicsShareFunc int epicsAtomicDecrIntT ( int * pTarget );
383+EPICS_ATOMIC_INLINE size_t epicsAtomicDecrSizeT ( size_t * pTarget );
384+EPICS_ATOMIC_INLINE int epicsAtomicDecrIntT ( int * pTarget );
385
386 /*
387 * lock out other smp processors from accessing the target,
388@@ -55,23 +57,23 @@
389 * to target, allow other smp processors to access the target,
390 * return new value of target as modified by this operation
391 */
392-epicsShareFunc size_t epicsAtomicAddSizeT ( size_t * pTarget, size_t delta );
393-epicsShareFunc size_t epicsAtomicSubSizeT ( size_t * pTarget, size_t delta );
394-epicsShareFunc int epicsAtomicAddIntT ( int * pTarget, int delta );
395+EPICS_ATOMIC_INLINE size_t epicsAtomicAddSizeT ( size_t * pTarget, size_t delta );
396+EPICS_ATOMIC_INLINE size_t epicsAtomicSubSizeT ( size_t * pTarget, size_t delta );
397+EPICS_ATOMIC_INLINE int epicsAtomicAddIntT ( int * pTarget, int delta );
398
399 /*
400 * set cache version of target, flush cache to target
401 */
402-epicsShareFunc void epicsAtomicSetSizeT ( size_t * pTarget, size_t newValue );
403-epicsShareFunc void epicsAtomicSetIntT ( int * pTarget, int newValue );
404-epicsShareFunc void epicsAtomicSetPtrT ( EpicsAtomicPtrT * pTarget, EpicsAtomicPtrT newValue );
405+EPICS_ATOMIC_INLINE void epicsAtomicSetSizeT ( size_t * pTarget, size_t newValue );
406+EPICS_ATOMIC_INLINE void epicsAtomicSetIntT ( int * pTarget, int newValue );
407+EPICS_ATOMIC_INLINE void epicsAtomicSetPtrT ( EpicsAtomicPtrT * pTarget, EpicsAtomicPtrT newValue );
408
409 /*
410 * fetch target into cache, return new value of target
411 */
412-epicsShareFunc size_t epicsAtomicGetSizeT ( const size_t * pTarget );
413-epicsShareFunc int epicsAtomicGetIntT ( const int * pTarget );
414-epicsShareFunc EpicsAtomicPtrT epicsAtomicGetPtrT ( const EpicsAtomicPtrT * pTarget );
415+EPICS_ATOMIC_INLINE size_t epicsAtomicGetSizeT ( const size_t * pTarget );
416+EPICS_ATOMIC_INLINE int epicsAtomicGetIntT ( const int * pTarget );
417+EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicGetPtrT ( const EpicsAtomicPtrT * pTarget );
418
419 /*
420 * lock out other smp processors from accessing the target,
421@@ -80,11 +82,11 @@
422 * to access the target, return the original value stored in the
423 * target
424 */
425-epicsShareFunc size_t epicsAtomicCmpAndSwapSizeT ( size_t * pTarget,
426+EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT ( size_t * pTarget,
427 size_t oldVal, size_t newVal );
428-epicsShareFunc int epicsAtomicCmpAndSwapIntT ( int * pTarget,
429+EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget,
430 int oldVal, int newVal );
431-epicsShareFunc EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT (
432+EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT (
433 EpicsAtomicPtrT * pTarget,
434 EpicsAtomicPtrT oldVal,
435 EpicsAtomicPtrT newVal );
436@@ -111,119 +113,98 @@
437 /*
438 * overloaded c++ interface
439 */
440-epicsShareFunc size_t increment ( size_t & v );
441-epicsShareFunc int increment ( int & v );
442-epicsShareFunc size_t decrement ( size_t & v );
443-epicsShareFunc int decrement ( int & v );
444-epicsShareFunc size_t add ( size_t & v, size_t delta );
445-epicsShareFunc int add ( int & v, int delta );
446-epicsShareFunc size_t subtract ( size_t & v, size_t delta );
447-epicsShareFunc int subtract ( int & v, int delta );
448-epicsShareFunc void set ( size_t & v , size_t newValue );
449-epicsShareFunc void set ( int & v, int newValue );
450-epicsShareFunc void set ( EpicsAtomicPtrT & v,
451- EpicsAtomicPtrT newValue );
452-epicsShareFunc size_t get ( const size_t & v );
453-epicsShareFunc int get ( const int & v );
454-epicsShareFunc EpicsAtomicPtrT get ( const EpicsAtomicPtrT & v );
455-epicsShareFunc size_t compareAndSwap ( size_t & v, size_t oldVal,
456- size_t newVal );
457-epicsShareFunc int compareAndSwap ( int & v, int oldVal, int newVal );
458-epicsShareFunc EpicsAtomicPtrT compareAndSwap ( EpicsAtomicPtrT & v,
459- EpicsAtomicPtrT oldVal,
460- EpicsAtomicPtrT newVal );
461
462 /************* incr ***************/
463-inline size_t increment ( size_t & v )
464+EPICS_ATOMIC_INLINE size_t increment ( size_t & v )
465 {
466 return epicsAtomicIncrSizeT ( & v );
467 }
468
469-inline int increment ( int & v )
470+EPICS_ATOMIC_INLINE int increment ( int & v )
471 {
472 return epicsAtomicIncrIntT ( & v );
473 }
474
475 /************* decr ***************/
476-inline size_t decrement ( size_t & v )
477+EPICS_ATOMIC_INLINE size_t decrement ( size_t & v )
478 {
479 return epicsAtomicDecrSizeT ( & v );
480 }
481
482-inline int decrement ( int & v )
483+EPICS_ATOMIC_INLINE int decrement ( int & v )
484 {
485 return epicsAtomicDecrIntT ( & v );
486 }
487
488 /************* add ***************/
489-inline size_t add ( size_t & v, size_t delta )
490+EPICS_ATOMIC_INLINE size_t add ( size_t & v, size_t delta )
491 {
492 return epicsAtomicAddSizeT ( & v, delta );
493 }
494
495-inline int add ( int & v, int delta )
496+EPICS_ATOMIC_INLINE int add ( int & v, int delta )
497 {
498 return epicsAtomicAddIntT ( & v, delta );
499 }
500
501 /************* sub ***************/
502-inline size_t subtract ( size_t & v, size_t delta )
503+EPICS_ATOMIC_INLINE size_t subtract ( size_t & v, size_t delta )
504 {
505 return epicsAtomicSubSizeT ( & v, delta );
506 }
507
508-inline int subtract ( int & v, int delta )
509+EPICS_ATOMIC_INLINE int subtract ( int & v, int delta )
510 {
511 return epicsAtomicAddIntT ( & v, -delta );
512 }
513
514 /************* set ***************/
515-inline void set ( size_t & v , size_t newValue )
516+EPICS_ATOMIC_INLINE void set ( size_t & v , size_t newValue )
517 {
518 epicsAtomicSetSizeT ( & v, newValue );
519 }
520
521-inline void set ( int & v, int newValue )
522+EPICS_ATOMIC_INLINE void set ( int & v, int newValue )
523 {
524 epicsAtomicSetIntT ( & v, newValue );
525 }
526
527-inline void set ( EpicsAtomicPtrT & v, EpicsAtomicPtrT newValue )
528+EPICS_ATOMIC_INLINE void set ( EpicsAtomicPtrT & v, EpicsAtomicPtrT newValue )
529 {
530 epicsAtomicSetPtrT ( & v, newValue );
531 }
532
533 /************* get ***************/
534-inline size_t get ( const size_t & v )
535+EPICS_ATOMIC_INLINE size_t get ( const size_t & v )
536 {
537 return epicsAtomicGetSizeT ( & v );
538 }
539
540-inline int get ( const int & v )
541+EPICS_ATOMIC_INLINE int get ( const int & v )
542 {
543 return epicsAtomicGetIntT ( & v );
544 }
545
546-inline EpicsAtomicPtrT get ( const EpicsAtomicPtrT & v )
547+EPICS_ATOMIC_INLINE EpicsAtomicPtrT get ( const EpicsAtomicPtrT & v )
548 {
549 return epicsAtomicGetPtrT ( & v );
550 }
551
552 /************* cas ***************/
553-inline size_t compareAndSwap ( size_t & v,
554- size_t oldVal, size_t newVal )
555+EPICS_ATOMIC_INLINE size_t compareAndSwap ( size_t & v,
556+ size_t oldVal, size_t newVal )
557 {
558 return epicsAtomicCmpAndSwapSizeT ( & v, oldVal, newVal );
559 }
560
561-inline int compareAndSwap ( int & v, int oldVal, int newVal )
562+EPICS_ATOMIC_INLINE int compareAndSwap ( int & v, int oldVal, int newVal )
563 {
564 return epicsAtomicCmpAndSwapIntT ( & v, oldVal, newVal );
565 }
566
567-inline EpicsAtomicPtrT compareAndSwap ( EpicsAtomicPtrT & v,
568- EpicsAtomicPtrT oldVal,
569- EpicsAtomicPtrT newVal )
570+EPICS_ATOMIC_INLINE EpicsAtomicPtrT compareAndSwap ( EpicsAtomicPtrT & v,
571+ EpicsAtomicPtrT oldVal,
572+ EpicsAtomicPtrT newVal )
573 {
574 return epicsAtomicCmpAndSwapPtrT ( & v, oldVal, newVal );
575 }
576
577=== added file 'src/libCom/osi/os/RTEMS/epicsAtomicOSD.h'
578--- src/libCom/osi/os/RTEMS/epicsAtomicOSD.h 1970-01-01 00:00:00 +0000
579+++ src/libCom/osi/os/RTEMS/epicsAtomicOSD.h 2015-02-27 22:36:36 +0000
580@@ -0,0 +1,65 @@
581+
582+/*************************************************************************\
583+* Copyright (c) 2011 LANS LLC, as Operator of
584+* Los Alamos National Laboratory.
585+* Copyright (c) 2011 UChicago Argonne LLC, as Operator of Argonne
586+* National Laboratory.
587+* EPICS BASE is distributed subject to a Software License Agreement found
588+* in file LICENSE that is included with this distribution.
589+\*************************************************************************/
590+
591+/*
592+ * Author Jeffrey O. Hill
593+ * johill@lanl.gov
594+ */
595+
596+#ifndef epicsAtomicOSD_h
597+#define epicsAtomicOSD_h
598+
599+#include <shareLib.h>
600+#include "epicsMMIO.h"
601+#include "compilerSpecific.h"
602+#include "epicsInterrupt.h"
603+
604+#define EPICS_ATOMIC_OS_NAME "RTEMS"
605+
606+typedef struct EpicsAtomicLockKey {
607+ int key;
608+} EpicsAtomicLockKey;
609+
610+#ifdef __cplusplus
611+extern "C" {
612+#endif /* __cplusplus */
613+
614+#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER
615+EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void)
616+{
617+ epicsAtomicMemoryBarrierFallback();
618+}
619+#endif
620+
621+#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER
622+EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void)
623+{
624+ rwbarr();
625+}
626+#endif
627+
628+EPICS_ATOMIC_INLINE void epicsAtomicLock ( struct EpicsAtomicLockKey * pkey )
629+{
630+ pkey->key = epicsInterruptLock();
631+}
632+
633+EPICS_ATOMIC_INLINE void epicsAtomicUnlock ( struct EpicsAtomicLockKey * pkey )
634+{
635+ epicsInterruptUnlock(pkey->key);
636+}
637+
638+#ifdef __cplusplus
639+} /* end of extern "C" */
640+#endif /* __cplusplus */
641+
642+#include "epicsAtomicDefault.h"
643+
644+#endif /* epicsAtomicOSD_h */
645+
646
647=== removed file 'src/libCom/osi/os/WIN32/epicsAtomicOSD.cpp'
648--- src/libCom/osi/os/WIN32/epicsAtomicOSD.cpp 2011-09-01 17:25:53 +0000
649+++ src/libCom/osi/os/WIN32/epicsAtomicOSD.cpp 1970-01-01 00:00:00 +0000
650@@ -1,22 +0,0 @@
651-
652-/*************************************************************************\
653-* Copyright (c) 2011 LANS LLC, as Operator of
654-* Los Alamos National Laboratory.
655-* EPICS BASE is distributed subject to a Software License Agreement found
656-* in file LICENSE that is included with this distribution.
657-\*************************************************************************/
658-
659-/*
660- * Author Jeffrey O. Hill
661- * johill@lanl.gov
662- */
663-
664-#define epicsExportSharedSymbols
665-#include "epicsAtomic.h"
666-
667-// if the compiler is unable to inline then instantiate out-of-line
668-#ifndef EPICS_ATOMIC_INLINE
669-# define EPICS_ATOMIC_INLINE
670-# include "epicsAtomicOSD.h"
671-#endif
672-
673
674=== modified file 'src/libCom/osi/os/WIN32/epicsAtomicOSD.h'
675--- src/libCom/osi/os/WIN32/epicsAtomicOSD.h 2014-11-19 19:16:56 +0000
676+++ src/libCom/osi/os/WIN32/epicsAtomicOSD.h 2015-02-27 22:36:36 +0000
677@@ -16,6 +16,8 @@
678 #ifndef epicsAtomicOSD_h
679 #define epicsAtomicOSD_h
680
681+#define EPICS_ATOMIC_OS_NAME "WIN32"
682+
683 #ifdef VC_EXTRALEAN
684 # define VC_EXTRALEAN_DETECTED_epicsAtomicOSD_h
685 #else
686
687=== added file 'src/libCom/osi/os/default/epicsAtomicOSD.c'
688=== modified file 'src/libCom/osi/os/posix/epicsAtomicOSD.cpp'
689--- src/libCom/osi/os/posix/epicsAtomicOSD.cpp 2013-11-20 17:51:14 +0000
690+++ src/libCom/osi/os/posix/epicsAtomicOSD.cpp 2015-02-27 22:36:36 +0000
691@@ -19,14 +19,6 @@
692 #include "epicsAssert.h"
693 #include "epicsAtomic.h"
694
695-// if the compiler is unable to inline then instantiate out-of-line
696-#ifndef EPICS_ATOMIC_INLINE
697-# define EPICS_ATOMIC_INLINE
698-# include "epicsAtomicOSD.h"
699-#endif
700-
701-#ifndef EPICS_ATOMIC_LOCK
702-
703 /*
704 * Slow, but probably correct on all systems.
705 * Useful only if something more efficient isn`t
706@@ -69,31 +61,14 @@
707 assert ( status == 0 );
708 }
709
710-#endif // ifndef EPICS_ATOMIC_LOCK
711-
712-#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER
713-// Slow, but probably correct on all systems.
714-// Useful only if something more efficient isn`t
715-// provided based on knowledge of the compiler
716-// or OS
717-void epicsAtomicReadMemoryBarrier ()
718-{
719- EpicsAtomicLockKey key;
720- epicsAtomicLock ( & key );
721- epicsAtomicUnlock ( & key );
722-}
723-#endif
724-
725-#ifndef EPICS_ATOMIC_WRITE_MEMORY_BARRIER
726-// Slow, but probably correct on all systems.
727-// Useful only if something more efficient isn`t
728-// provided based on knowledge of the compiler
729-// or OS
730-void epicsAtomicWriteMemoryBarrier ()
731-{
732- EpicsAtomicLockKey key;
733- epicsAtomicLock ( & key );
734- epicsAtomicUnlock ( & key );
735-}
736-#endif
737-
738+
739+// Slow, but probably correct on all systems.
740+// Useful only if something more efficient isn`t
741+// provided based on knowledge of the compiler
742+// or OS
743+void epicsAtomicMemoryBarrierFallback (void)
744+{
745+ EpicsAtomicLockKey key;
746+ epicsAtomicLock ( & key );
747+ epicsAtomicUnlock ( & key );
748+}
749
750=== modified file 'src/libCom/osi/os/posix/epicsAtomicOSD.h'
751--- src/libCom/osi/os/posix/epicsAtomicOSD.h 2014-07-25 20:05:58 +0000
752+++ src/libCom/osi/os/posix/epicsAtomicOSD.h 2015-02-27 22:36:36 +0000
753@@ -16,14 +16,33 @@
754 #ifndef epicsAtomicOSD_h
755 #define epicsAtomicOSD_h
756
757+#include <shareLib.h>
758+
759+#define EPICS_ATOMIC_OS_NAME "POSIX"
760+
761 typedef struct EpicsAtomicLockKey {} EpicsAtomicLockKey;
762
763 #ifdef __cplusplus
764 extern "C" {
765 #endif /* __cplusplus */
766
767+#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER
768+EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void)
769+{
770+ epicsAtomicMemoryBarrierFallback();
771+}
772+#endif
773+
774+#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER
775+EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void)
776+{
777+ epicsAtomicMemoryBarrierFallback();
778+}
779+#endif
780+
781 epicsShareFunc void epicsAtomicLock ( struct EpicsAtomicLockKey * );
782 epicsShareFunc void epicsAtomicUnlock ( struct EpicsAtomicLockKey * );
783+epicsShareFunc void epicsAtomicMemoryBarrierFallback ( void );
784
785 #ifdef __cplusplus
786 } /* end of extern "C" */
787
788=== modified file 'src/libCom/osi/os/solaris/epicsAtomicOSD.h'
789--- src/libCom/osi/os/solaris/epicsAtomicOSD.h 2014-09-11 14:10:44 +0000
790+++ src/libCom/osi/os/solaris/epicsAtomicOSD.h 2015-02-27 22:36:36 +0000
791@@ -13,9 +13,13 @@
792 * johill@lanl.gov
793 */
794
795+#include "shareLib.h"
796+
797 #ifndef epicsAtomicOSD_h
798 #define epicsAtomicOSD_h
799
800+#define EPICS_ATOMIC_OS_NAME "Solaris"
801+
802 #if defined ( __SunOS_5_10 )
803
804 /*
805@@ -31,7 +35,7 @@
806
807 #ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER
808 #define EPICS_ATOMIC_READ_MEMORY_BARRIER
809-EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier ()
810+EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void)
811 {
812 membar_consumer ();
813 }
814@@ -39,7 +43,7 @@
815
816 #ifndef EPICS_ATOMIC_WRITE_MEMORY_BARRIER
817 #define EPICS_ATOMIC_WRITE_MEMORY_BARRIER
818-EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier ()
819+EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void)
820 {
821 membar_producer ();
822 }
823@@ -47,7 +51,7 @@
824
825 #ifndef EPICS_ATOMIC_CAS_INTT
826 #define EPICS_ATOMIC_CAS_INTT
827-EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget,
828+EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget,
829 int oldVal, int newVal )
830 {
831 STATIC_ASSERT ( sizeof ( int ) == sizeof ( unsigned ) );
832@@ -59,7 +63,7 @@
833
834 #ifndef EPICS_ATOMIC_CAS_SIZET
835 #define EPICS_ATOMIC_CAS_SIZET
836-EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT (
837+EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT (
838 size_t * pTarget,
839 size_t oldVal, size_t newVal )
840 {
841@@ -71,7 +75,7 @@
842
843 #ifndef EPICS_ATOMIC_CAS_PTRT
844 #define EPICS_ATOMIC_CAS_PTRT
845-EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT (
846+EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT (
847 EpicsAtomicPtrT * pTarget,
848 EpicsAtomicPtrT oldVal,
849 EpicsAtomicPtrT newVal )
850@@ -132,7 +136,7 @@
851
852 #ifndef EPICS_ATOMIC_ADD_SIZET
853 #define EPICS_ATOMIC_ADD_SIZET
854-EPICS_ATOMIC_INLINE size_t epicsAtomicAddSizeT ( size_t * pTarget,
855+EPICS_ATOMIC_INLINE size_t epicsAtomicAddSizeT ( size_t * pTarget,
856 size_t delta )
857 {
858 STATIC_ASSERT ( sizeof ( ulong_t ) == sizeof ( size_t ) );
859@@ -143,7 +147,7 @@
860
861 #ifndef EPICS_ATOMIC_SUB_SIZET
862 #define EPICS_ATOMIC_SUB_SIZET
863-EPICS_ATOMIC_INLINE size_t epicsAtomicSubSizeT ( size_t * pTarget,
864+EPICS_ATOMIC_INLINE size_t epicsAtomicSubSizeT ( size_t * pTarget,
865 size_t delta )
866 {
867 STATIC_ASSERT ( sizeof ( ulong_t ) == sizeof ( size_t ) );
868
869=== removed file 'src/libCom/osi/os/vxWorks/epicsAtomicOSD.cpp'
870--- src/libCom/osi/os/vxWorks/epicsAtomicOSD.cpp 2011-09-01 17:25:53 +0000
871+++ src/libCom/osi/os/vxWorks/epicsAtomicOSD.cpp 1970-01-01 00:00:00 +0000
872@@ -1,21 +0,0 @@
873-
874-/*************************************************************************\
875-* Copyright (c) 2011 LANS LLC, as Operator of
876-* Los Alamos National Laboratory.
877-* EPICS BASE is distributed subject to a Software License Agreement found
878-* in file LICENSE that is included with this distribution.
879-\*************************************************************************/
880-
881-/*
882- * Author Jeffrey O. Hill
883- * johill@lanl.gov
884- */
885-
886-#define epicsExportSharedSymbols
887-#include "epicsAtomic.h"
888-
889-// if the compiler is unable to inline then instantiate out-of-line
890-#ifndef EPICS_ATOMIC_INLINE
891-# define EPICS_ATOMIC_INLINE
892-# include "epicsAtomicOSD.h"
893-#endif
894
895=== modified file 'src/libCom/osi/os/vxWorks/epicsAtomicOSD.h'
896--- src/libCom/osi/os/vxWorks/epicsAtomicOSD.h 2011-09-07 15:59:11 +0000
897+++ src/libCom/osi/os/vxWorks/epicsAtomicOSD.h 2015-02-27 22:36:36 +0000
898@@ -32,13 +32,15 @@
899 #include <limits.h>
900 #include <vxAtomicLib.h>
901
902+#define EPICS_ATOMIC_OS_NAME "VX-ATOMICLIB"
903+
904 #ifdef __cplusplus
905 extern "C" {
906 #endif /* __cplusplus */
907
908 #ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER
909 #define EPICS_ATOMIC_READ_MEMORY_BARRIER
910-EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier ()
911+EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void)
912 {
913 VX_MEM_BARRIER_R ();
914 }
915@@ -46,7 +48,7 @@
916
917 #ifndef EPICS_ATOMIC_WRITE_MEMORY_BARRIER
918 #define EPICS_ATOMIC_WRITE_MEMORY_BARRIER
919-EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier ()
920+EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void)
921 {
922 VX_MEM_BARRIER_W ();
923 }
924@@ -206,6 +208,8 @@
925 #include "vxLib.h"
926 #include "intLib.h"
927
928+#define EPICS_ATOMIC_OS_NAME "VX-INTLIB"
929+
930 #ifdef __cplusplus
931 extern "C" {
932 #endif /* __cplusplus */
933@@ -232,7 +236,7 @@
934 * no need for memory barrior since prior to vxWorks 6.6 it is a single cpu system
935 * (we are not protecting against multiple access to memory mapped IO)
936 */
937-EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier () {}
938+EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void) {}
939 #endif
940
941 #ifndef EPICS_ATOMIC_WRITE_MEMORY_BARRIER
942@@ -241,7 +245,7 @@
943 * no need for memory barrior since prior to vxWorks 6.6 it is a single cpu system
944 * (we are not protecting against multiple access to memory mapped IO)
945 */
946-EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier () {}
947+EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void) {}
948 #endif
949
950 #ifdef __cplusplus
951
952=== modified file 'src/libCom/test/Makefile'
953--- src/libCom/test/Makefile 2014-10-07 04:39:23 +0000
954+++ src/libCom/test/Makefile 2015-02-27 22:36:36 +0000
955@@ -22,6 +22,14 @@
956 testHarness_SRCS += epicsTypesTest.cpp
957 TESTS += epicsTypesTest
958
959+TESTPROD_HOST += epicsInlineTest
960+epicsInlineTest_SRCS += epicsInlineTest1.c
961+epicsInlineTest_SRCS += epicsInlineTest2.c
962+epicsInlineTest_SRCS += epicsInlineTest3.cpp
963+epicsInlineTest_SRCS += epicsInlineTest4.cpp
964+testHarness_SRCS += $(epicsInlineTest_SRCS)
965+TESTS += epicsInlineTest
966+
967 TESTPROD_HOST += epicsCalcTest
968 epicsCalcTest_SRCS += epicsCalcTest.cpp
969 testHarness_SRCS += epicsCalcTest.cpp
970
971=== modified file 'src/libCom/test/epicsAtomicTest.cpp'
972--- src/libCom/test/epicsAtomicTest.cpp 2012-06-07 18:38:11 +0000
973+++ src/libCom/test/epicsAtomicTest.cpp 2015-02-27 22:36:36 +0000
974@@ -248,11 +248,89 @@
975 # pragma warning ( pop )
976 #endif
977
978+static void testClassify()
979+{
980+ testDiag("Classify Build conditions");
981+#ifdef EPICS_ATOMIC_CMPLR_NAME
982+ testDiag("Compiler dependent impl name %s", EPICS_ATOMIC_CMPLR_NAME);
983+#else
984+ testDiag("Compiler dependent impl name undefined");
985+#endif
986+#ifdef EPICS_ATOMIC_OS_NAME
987+ testDiag("OS dependent impl name %s", EPICS_ATOMIC_OS_NAME);
988+#else
989+ testDiag("OS dependent impl name undefined");
990+#endif
991+
992+#ifdef __GNUC__
993+#if GCC_ATOMIC_INTRINSICS_GCC4_OR_BETTER
994+ testDiag("GCC using atomic builtin memory barrier");
995+#else
996+ testDiag("GCC using asm memory barrier");
997+#endif
998+#if GCC_ATOMIC_INTRINSICS_AVAIL_INT_T || GCC_ATOMIC_INTRINSICS_AVAIL_EARLIER
999+ testDiag("GCC use builtin for int");
1000+#endif
1001+#if GCC_ATOMIC_INTRINSICS_AVAIL_SIZE_T || GCC_ATOMIC_INTRINSICS_AVAIL_EARLIER
1002+ testDiag("GCC use builtin for size_t");
1003+#endif
1004+
1005+#ifndef EPICS_ATOMIC_INCR_INTT
1006+ testDiag("Use default epicsAtomicIncrIntT()");
1007+#endif
1008+#ifndef EPICS_ATOMIC_INCR_SIZET
1009+ testDiag("Use default epicsAtomicIncrSizeT()");
1010+#endif
1011+#ifndef EPICS_ATOMIC_DECR_INTT
1012+ testDiag("Use default epicsAtomicDecrIntT()");
1013+#endif
1014+#ifndef EPICS_ATOMIC_DECR_SIZET
1015+ testDiag("Use default epicsAtomicDecrSizeT()");
1016+#endif
1017+#ifndef EPICS_ATOMIC_ADD_INTT
1018+ testDiag("Use default epicsAtomicAddIntT()");
1019+#endif
1020+#ifndef EPICS_ATOMIC_ADD_SIZET
1021+ testDiag("Use default epicsAtomicAddSizeT()");
1022+#endif
1023+#ifndef EPICS_ATOMIC_SUB_SIZET
1024+ testDiag("Use default epicsAtomicSubSizeT()");
1025+#endif
1026+#ifndef EPICS_ATOMIC_SET_INTT
1027+ testDiag("Use default epicsAtomicSetIntT()");
1028+#endif
1029+#ifndef EPICS_ATOMIC_SET_SIZET
1030+ testDiag("Use default epicsAtomicSetSizeT()");
1031+#endif
1032+#ifndef EPICS_ATOMIC_SET_PTRT
1033+ testDiag("Use default epicsAtomicSetPtrT()");
1034+#endif
1035+#ifndef EPICS_ATOMIC_GET_INTT
1036+ testDiag("Use default epicsAtomicGetIntT()");
1037+#endif
1038+#ifndef EPICS_ATOMIC_GET_SIZET
1039+ testDiag("Use default epicsAtomicGetSizeT()");
1040+#endif
1041+#ifndef EPICS_ATOMIC_GET_PTRT
1042+ testDiag("Use default epicsAtomicGetPtrT()");
1043+#endif
1044+#ifndef EPICS_ATOMIC_CAS_INTT
1045+ testDiag("Use default epicsAtomicCmpAndSwapIntT()");
1046+#endif
1047+#ifndef EPICS_ATOMIC_CAS_SIZET
1048+ testDiag("Use default epicsAtomicCmpAndSwapSizeT()");
1049+#endif
1050+#ifndef EPICS_ATOMIC_CAS_PTRT
1051+ testDiag("Use default epicsAtomicCmpAndSwapPtrT()");
1052+#endif
1053+#endif /* __GNUC__ */
1054+}
1055
1056 MAIN ( epicsAtomicTest )
1057 {
1058
1059 testPlan ( 31 );
1060+ testClassify ();
1061
1062 testIncrDecr < int > ();
1063 testIncrDecr < size_t > ();
1064
1065=== added file 'src/libCom/test/epicsInlineTest1.c'
1066--- src/libCom/test/epicsInlineTest1.c 1970-01-01 00:00:00 +0000
1067+++ src/libCom/test/epicsInlineTest1.c 2015-02-27 22:36:36 +0000
1068@@ -0,0 +1,64 @@
1069+/*************************************************************************\
1070+* Copyright (c) 2015 Brookhaven Science Associates, as Operator of
1071+* Brookhaven National Laboratory.
1072+* EPICS BASE is distributed subject to a Software License Agreement found
1073+* in file LICENSE that is included with this distribution.
1074+\*************************************************************************/
1075+
1076+/* This test checks the variations on inline function defintions.
1077+ *
1078+ * "static inline int func(void) {...}"
1079+ *
1080+ * Consistent meaning in C89, C99, and C++ (98 and 11).
1081+ * If not inline'd results in a private symbol in each compilation unit.
1082+ * Thus the non-inline'd version is duplicated in each compilation unit.
1083+ * However, definitions in different compilation units may be different.
1084+ *
1085+ * "inline int func(void) {...}"
1086+ * Warning: Not consistent, avoid use in headers meant for C or C++
1087+ *
1088+ * In C++ this may be safely defined in more than one compilation unit.
1089+ * Where not inlined it will result in a weak public symbol.
1090+ * Thus non-inline'd version isn't duplicated, but must be the same
1091+ * in all compilation units.
1092+ *
1093+ */
1094+
1095+#include "compilerSpecific.h"
1096+#include "epicsUnitTest.h"
1097+
1098+#include "testMain.h"
1099+
1100+static EPICS_ALWAYS_INLINE int epicsInlineTestFn1(void)
1101+{
1102+ return 1;
1103+}
1104+
1105+/* Fails to link in C99
1106+inline int epicsInlineTestFn2(void)
1107+{
1108+ return 42;
1109+}
1110+*/
1111+
1112+void epicsInlineTest1(void)
1113+{
1114+ testDiag("epicsInlineTest1()");
1115+ testOk1(epicsInlineTestFn1()==1);
1116+ /*testOk1(epicsInlineTestFn2()==42);*/
1117+}
1118+
1119+void epicsInlineTest2(void);
1120+void epicsInlineTest3(void);
1121+void epicsInlineTest4(void);
1122+
1123+MAIN(epicsInlineTest)
1124+{
1125+ testPlan(6);
1126+ testDiag("Test variation on inline int func()");
1127+ epicsInlineTest1();
1128+ epicsInlineTest2();
1129+ epicsInlineTest3();
1130+ epicsInlineTest4();
1131+ return testDone();
1132+}
1133
1134=== added file 'src/libCom/test/epicsInlineTest2.c'
1135--- src/libCom/test/epicsInlineTest2.c 1970-01-01 00:00:00 +0000
1136+++ src/libCom/test/epicsInlineTest2.c 2015-02-27 22:36:36 +0000
1137@@ -0,0 +1,28 @@
1138+/*************************************************************************\
1139+* Copyright (c) 2015 Brookhaven Science Associates, as Operator of
1140+* Brookhaven National Laboratory.
1141+* EPICS BASE is distributed subject to a Software License Agreement found
1142+* in file LICENSE that is included with this distribution.
1143+\*************************************************************************/
1144+
1145+#include "compilerSpecific.h"
1146+#include "epicsUnitTest.h"
1147+
1148+static EPICS_ALWAYS_INLINE int epicsInlineTestFn1(void)
1149+{
1150+ return 2;
1151+}
1152+
1153+/* Fails to link in C99
1154+inline int epicsInlineTestFn2(void)
1155+{
1156+ return 42;
1157+}
1158+*/
1159+
1160+void epicsInlineTest2(void)
1161+{
1162+ testDiag("epicsInlineTest2()");
1163+ testOk1(epicsInlineTestFn1()==2);
1164+ /*testOk1(epicsInlineTestFn2()==42);*/
1165+}
1166
1167=== added file 'src/libCom/test/epicsInlineTest3.cpp'
1168--- src/libCom/test/epicsInlineTest3.cpp 1970-01-01 00:00:00 +0000
1169+++ src/libCom/test/epicsInlineTest3.cpp 2015-02-27 22:36:36 +0000
1170@@ -0,0 +1,27 @@
1171+/*************************************************************************\
1172+* Copyright (c) 2015 Brookhaven Science Associates, as Operator of
1173+* Brookhaven National Laboratory.
1174+* EPICS BASE is distributed subject to a Software License Agreement found
1175+* in file LICENSE that is included with this distribution.
1176+\*************************************************************************/
1177+
1178+#include "compilerSpecific.h"
1179+#include "epicsUnitTest.h"
1180+
1181+static EPICS_ALWAYS_INLINE int epicsInlineTestFn1(void)
1182+{
1183+ return 3;
1184+}
1185+
1186+inline int epicsInlineTestFn2(void)
1187+{
1188+ return 42;
1189+}
1190+
1191+extern "C"
1192+void epicsInlineTest3(void)
1193+{
1194+ testDiag("epicsInlineTest3()");
1195+ testOk1(epicsInlineTestFn1()==3);
1196+ testOk1(epicsInlineTestFn2()==42);
1197+}
1198
1199=== added file 'src/libCom/test/epicsInlineTest4.cpp'
1200--- src/libCom/test/epicsInlineTest4.cpp 1970-01-01 00:00:00 +0000
1201+++ src/libCom/test/epicsInlineTest4.cpp 2015-02-27 22:36:36 +0000
1202@@ -0,0 +1,27 @@
1203+/*************************************************************************\
1204+* Copyright (c) 2015 Brookhaven Science Associates, as Operator of
1205+* Brookhaven National Laboratory.
1206+* EPICS BASE is distributed subject to a Software License Agreement found
1207+* in file LICENSE that is included with this distribution.
1208+\*************************************************************************/
1209+
1210+#include "compilerSpecific.h"
1211+#include "epicsUnitTest.h"
1212+
1213+static EPICS_ALWAYS_INLINE int epicsInlineTestFn1(void)
1214+{
1215+ return 4;
1216+}
1217+
1218+inline int epicsInlineTestFn2(void)
1219+{
1220+ return 42;
1221+}
1222+
1223+extern "C"
1224+void epicsInlineTest4(void)
1225+{
1226+ testDiag("epicsInlineTest4()");
1227+ testOk1(epicsInlineTestFn1()==4);
1228+ testOk1(epicsInlineTestFn2()==42);
1229+}
1230
1231=== modified file 'src/libCom/test/epicsRunLibComTests.c'
1232--- src/libCom/test/epicsRunLibComTests.c 2014-10-07 04:39:23 +0000
1233+++ src/libCom/test/epicsRunLibComTests.c 2015-02-27 22:36:36 +0000
1234@@ -44,6 +44,7 @@
1235 int epicsTimerTest(void);
1236 int epicsTimeTest(void);
1237 int epicsTypesTest(void);
1238+int epicsInlineTest(void);
1239 int macDefExpandTest(void);
1240 int macLibTest(void);
1241 int ringBytesTest(void);
1242@@ -92,6 +93,7 @@
1243 runTest(epicsThreadPrivateTest);
1244 runTest(epicsTimeTest);
1245 runTest(epicsTypesTest);
1246+ runTest(epicsInlineTest);
1247 runTest(macDefExpandTest);
1248 runTest(macLibTest);
1249 runTest(ringBytesTest);

Subscribers

People subscribed via source and target branches