# HG changeset patch # User Olaf Wintermann # Date 1375777323 -7200 # Node ID fc3af16818a378c378520ce7cc770d8a7ba68ec4 # Parent 633f15ce2ee45c338dfaca722a3a265bc8632dac fixed some warnings when compiling with the sun C++ Compiler diff -r 633f15ce2ee4 -r fc3af16818a3 test/main.c --- 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 diff -r 633f15ce2ee4 -r fc3af16818a3 test/mpool_tests.c --- 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; } diff -r 633f15ce2ee4 -r fc3af16818a3 ucx/mempool.c --- 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); } diff -r 633f15ce2ee4 -r fc3af16818a3 ucx/ucx.h --- 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 /**