fixed some warnings when compiling with the sun C++ Compiler

Tue, 06 Aug 2013 10:22:03 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 06 Aug 2013 10:22:03 +0200
changeset 131
fc3af16818a3
parent 130
633f15ce2ee4
child 132
c7d7e4eeb76b

fixed some warnings when compiling with the sun C++ Compiler

test/main.c file | annotate | diff | comparison | revisions
test/mpool_tests.c file | annotate | diff | comparison | revisions
ucx/mempool.c file | annotate | diff | comparison | revisions
ucx/ucx.h file | annotate | diff | comparison | revisions
--- a/test/main.c	Mon Aug 05 14:38:37 2013 +0200
+++ b/test/main.c	Tue Aug 06 10:22:03 2013 +0200
@@ -41,39 +41,39 @@
 #include "prop_tests.h"
 #include "buffer_tests.h"
 
-UCX_TEST_IMPLEMENT(testTestSuitePositive) {
+UCX_EXTERN UCX_TEST_IMPLEMENT(testTestSuitePositive) {
     UCX_TEST_BEGIN
     UCX_TEST_ASSERT(2*2 == 4, "the test framework fails");
     UCX_TEST_END
 }
 
-UCX_TEST_IMPLEMENT(testTestSuiteNegative) {
+UCX_EXTERN UCX_TEST_IMPLEMENT(testTestSuiteNegative) {
     UCX_TEST_BEGIN
     UCX_TEST_ASSERT(2*(-2) == 4, "the test framework works");
     UCX_TEST_END
 }
 
-UCX_TEST_SUBROUTINE(testTestSuiteRoutineRoutine, float f) {
+UCX_EXTERN UCX_TEST_SUBROUTINE(testTestSuiteRoutineRoutine, float f) {
     UCX_TEST_ASSERT(f == 3.14f, "calling routine in a routine fails");
 }
 
-UCX_TEST_SUBROUTINE(testTestSuiteRoutine2Param, int i, float f) {
+UCX_EXTERN UCX_TEST_SUBROUTINE(testTestSuiteRoutine2Param, int i, float f) {
     UCX_TEST_ASSERT(i == 42, "two parameter routine fails");
     UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineRoutine, f);
 }
 
-UCX_TEST_SUBROUTINE(testTestSuiteRoutineSuccess, int* i) {
+UCX_EXTERN UCX_TEST_SUBROUTINE(testTestSuiteRoutineSuccess, int* i) {
     *i += 2;
     UCX_TEST_ASSERT(*i==4, "the test framework fails");
 }
 
-UCX_TEST_SUBROUTINE(testTestSuiteRoutineFailure, int* i) {
+UCX_EXTERN UCX_TEST_SUBROUTINE(testTestSuiteRoutineFailure, int* i) {
     *i += 2;
     // Next test shall fail!
     UCX_TEST_ASSERT(*i==4, "the test framework works");
 }
 
-UCX_TEST_IMPLEMENT(testTestSuiteRoutinePositive) {
+UCX_EXTERN UCX_TEST_IMPLEMENT(testTestSuiteRoutinePositive) {
     int i = 2;
     UCX_TEST_BEGIN
     UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineSuccess, &i);
@@ -81,7 +81,7 @@
     UCX_TEST_END
 }
 
-UCX_TEST_IMPLEMENT(testTestSuiteRoutineNegative) {
+UCX_EXTERN UCX_TEST_IMPLEMENT(testTestSuiteRoutineNegative) {
     int i = 0;
     UCX_TEST_BEGIN
     UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineFailure, &i);
@@ -89,7 +89,7 @@
     UCX_TEST_END
 }
 
-UCX_TEST_IMPLEMENT(testTestSuiteRoutineMultiparam) {
+UCX_EXTERN UCX_TEST_IMPLEMENT(testTestSuiteRoutineMultiparam) {
     UCX_TEST_BEGIN
     UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutine2Param, 42, 3.14f);
     UCX_TEST_END
--- a/test/mpool_tests.c	Mon Aug 05 14:38:37 2013 +0200
+++ b/test/mpool_tests.c	Tue Aug 06 10:22:03 2013 +0200
@@ -123,7 +123,7 @@
     ucx_mempool_destroy(pool);
 }
 
-void test_setdestr(void* elem) {
+UCX_EXTERN void test_setdestr(void* elem) {
     intptr_t *cb = (intptr_t*) ((intptr_t*) elem)[1];
     *cb = 42;
 }
--- a/ucx/mempool.c	Mon Aug 05 14:38:37 2013 +0200
+++ b/ucx/mempool.c	Tue Aug 06 10:22:03 2013 +0200
@@ -46,7 +46,7 @@
     void           *ptr;
 } ucx_regdestr;
 
-void ucx_mempool_shared_destr(void* ptr) {
+UCX_EXTERN void ucx_mempool_shared_destr(void* ptr) {
     ucx_regdestr *rd = (ucx_regdestr*)ptr;
     rd->destructor(rd->ptr);
 }
--- a/ucx/ucx.h	Mon Aug 05 14:38:37 2013 +0200
+++ b/ucx/ucx.h	Tue Aug 06 10:22:03 2013 +0200
@@ -53,7 +53,10 @@
 #define _Bool bool
 #define restrict
 #endif
+#define UCX_EXTERN extern "C"
 extern "C" {
+#else
+#define UCX_EXTERN
 #endif
 
 /**

mercurial