Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Unity-Technologies/libatomic_ops.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2013-08-11 11:33:12 +0400
committerIvan Maidanski <ivmai@mail.ru>2013-08-11 14:28:10 +0400
commit71e2004376e06303c182069546ebc80c51cb0ec5 (patch)
tree6534c533bf2980b9c9f08a2b89161ce99fdb476d
parent9e217ec3e527e5ff544a40049c33e3c8d3bb391b (diff)
list_atomic: Add makefile rule to test list_atomic.template syntax
* tests/Makefile.am (BUILT_SOURCES, CLEANFILES): Add "list_atomic.o". * tests/Makefile.am (list_atomic.o): New rule (to verify list_atomic.c is valid C code). * tests/list_atomic.template (list_atomicXX): Use "volatile" for "val" local variable. * tests/list_atomic.template (list_atomicXX): Define "oldval", "newval", "ts" and "incr" local variables only if used; cast string literals to void (to prevent compiler warnings). * tests/list_atomic.template (list_atomicXX): Use AO_t type for "incr" local variable instead of C long type. * tests/list_atomic.template (list_atomicXX): Define "oldval", "newval", "incr" as statitc local variables, and remove explicit initialization to zero (to void problems with initialization of these variables for AO_double_t case if the latter is a struct).
-rw-r--r--tests/Makefile.am10
-rw-r--r--tests/list_atomic.template69
2 files changed, 48 insertions, 31 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 66f83bb..88a43b9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,8 +3,8 @@ EXTRA_DIST=test_atomic_include.template list_atomic.template run_parallel.h \
# We distribute test_atomic_include.h and list_atomic.c, since it is hard
# to regenerate them on Windows without sed.
-BUILT_SOURCES = test_atomic_include.h list_atomic.i
-CLEANFILES = list_atomic.i
+BUILT_SOURCES = test_atomic_include.h list_atomic.i list_atomic.o
+CLEANFILES = list_atomic.i list_atomic.o
AM_CPPFLAGS = \
-I$(top_builddir)/src -I$(top_srcdir)/src \
@@ -56,4 +56,8 @@ list_atomic.c: list_atomic.template
sed -e s/XX/_acquire_read/ $? >> $@
list_atomic.i: list_atomic.c
- $(COMPILE) $? -E > list_atomic.i
+ $(COMPILE) $? -E > $@
+
+# Verify list_atomic.c syntax:
+list_atomic.o: list_atomic.c
+ $(COMPILE) -c -o $@ $?
diff --git a/tests/list_atomic.template b/tests/list_atomic.template
index 744cbc8..6cd6bed 100644
--- a/tests/list_atomic.template
+++ b/tests/list_atomic.template
@@ -13,63 +13,76 @@
void list_atomicXX(void)
{
- AO_t val;
- AO_t newval = 0, oldval = 0;
- AO_TS_t ts;
- long incr = 0;
+ volatile AO_t val;
+# if defined(AO_HAVE_compare_and_swapXX) \
+ || defined(AO_HAVE_fetch_compare_and_swapXX)
+ static AO_t oldval /* = 0 */;
+# endif
+# if defined(AO_HAVE_storeXX) || defined(AO_HAVE_compare_and_swapXX) \
+ || defined(AO_HAVE_fetch_compare_and_swapXX)
+ static AO_t newval /* = 0 */;
+# endif
+# if defined(AO_HAVE_test_and_setXX)
+ AO_TS_t ts;
+# endif
+# if defined(AO_HAVE_fetch_and_addXX)
+ static AO_t incr /* = 0 */;
+# endif
# if defined(AO_HAVE_nopXX)
- "AO_nopXX(): ";
+ (void)"AO_nopXX(): ";
AO_nopXX();
# else
- "No AO_nopXX";
+ (void)"No AO_nopXX";
# endif
+
# if defined(AO_HAVE_loadXX)
- "AO_loadXX(&val):";
+ (void)"AO_loadXX(&val):";
AO_loadXX(&val);
# else
- "No AO_loadXX";
+ (void)"No AO_loadXX";
# endif
# if defined(AO_HAVE_storeXX)
- "AO_storeXX(&val, newval):";
+ (void)"AO_storeXX(&val, newval):";
AO_storeXX(&val, newval);
# else
- "No AO_storeXX";
+ (void)"No AO_storeXX";
# endif
-# if defined(AO_HAVE_test_and_setXX)
- "AO_test_and_setXX(&ts):";
- AO_test_and_setXX(&ts);
+# if defined(AO_HAVE_fetch_and_addXX)
+ (void)"AO_fetch_and_addXX(&val, incr):";
+ AO_fetch_and_addXX(&val, incr);
# else
- "No AO_test_and_setXX";
+ (void)"No AO_fetch_and_addXX";
# endif
# if defined(AO_HAVE_fetch_and_add1XX)
- "AO_fetch_and_add1XX(&val):";
+ (void)"AO_fetch_and_add1XX(&val):";
AO_fetch_and_add1XX(&val);
# else
- "No AO_fetch_and_add1XX";
+ (void)"No AO_fetch_and_add1XX";
# endif
# if defined(AO_HAVE_fetch_and_sub1XX)
- "AO_fetch_and_sub1XX(&val):";
+ (void)"AO_fetch_and_sub1XX(&val):";
AO_fetch_and_sub1XX(&val);
# else
- "No AO_fetch_and_sub1XX";
-# endif
-# if defined(AO_HAVE_fetch_and_addXX)
- "AO_fetch_and_addXX(&val, incr):";
- AO_fetch_and_addXX(&val, incr);
-# else
- "No AO_fetch_and_addXX";
+ (void)"No AO_fetch_and_sub1XX";
# endif
# if defined(AO_HAVE_compare_and_swapXX)
- "AO_compare_and_swapXX(&val, oldval, newval):";
+ (void)"AO_compare_and_swapXX(&val, oldval, newval):";
AO_compare_and_swapXX(&val, oldval, newval);
# else
- "No AO_compare_and_swapXX";
+ (void)"No AO_compare_and_swapXX";
# endif
# if defined(AO_HAVE_fetch_compare_and_swapXX)
- "AO_fetch_compare_and_swapXX(&val, oldval, newval):";
+ (void)"AO_fetch_compare_and_swapXX(&val, oldval, newval):";
AO_fetch_compare_and_swapXX(&val, oldval, newval);
# else
- "No AO_fetch_compare_and_swapXX";
+ (void)"No AO_fetch_compare_and_swapXX";
+# endif
+
+# if defined(AO_HAVE_test_and_setXX)
+ (void)"AO_test_and_setXX(&ts):";
+ AO_test_and_setXX(&ts);
+# else
+ (void)"No AO_test_and_setXX";
# endif
}