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
     1.1 --- a/test/main.c	Mon Aug 05 14:38:37 2013 +0200
     1.2 +++ b/test/main.c	Tue Aug 06 10:22:03 2013 +0200
     1.3 @@ -41,39 +41,39 @@
     1.4  #include "prop_tests.h"
     1.5  #include "buffer_tests.h"
     1.6  
     1.7 -UCX_TEST_IMPLEMENT(testTestSuitePositive) {
     1.8 +UCX_EXTERN UCX_TEST_IMPLEMENT(testTestSuitePositive) {
     1.9      UCX_TEST_BEGIN
    1.10      UCX_TEST_ASSERT(2*2 == 4, "the test framework fails");
    1.11      UCX_TEST_END
    1.12  }
    1.13  
    1.14 -UCX_TEST_IMPLEMENT(testTestSuiteNegative) {
    1.15 +UCX_EXTERN UCX_TEST_IMPLEMENT(testTestSuiteNegative) {
    1.16      UCX_TEST_BEGIN
    1.17      UCX_TEST_ASSERT(2*(-2) == 4, "the test framework works");
    1.18      UCX_TEST_END
    1.19  }
    1.20  
    1.21 -UCX_TEST_SUBROUTINE(testTestSuiteRoutineRoutine, float f) {
    1.22 +UCX_EXTERN UCX_TEST_SUBROUTINE(testTestSuiteRoutineRoutine, float f) {
    1.23      UCX_TEST_ASSERT(f == 3.14f, "calling routine in a routine fails");
    1.24  }
    1.25  
    1.26 -UCX_TEST_SUBROUTINE(testTestSuiteRoutine2Param, int i, float f) {
    1.27 +UCX_EXTERN UCX_TEST_SUBROUTINE(testTestSuiteRoutine2Param, int i, float f) {
    1.28      UCX_TEST_ASSERT(i == 42, "two parameter routine fails");
    1.29      UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineRoutine, f);
    1.30  }
    1.31  
    1.32 -UCX_TEST_SUBROUTINE(testTestSuiteRoutineSuccess, int* i) {
    1.33 +UCX_EXTERN UCX_TEST_SUBROUTINE(testTestSuiteRoutineSuccess, int* i) {
    1.34      *i += 2;
    1.35      UCX_TEST_ASSERT(*i==4, "the test framework fails");
    1.36  }
    1.37  
    1.38 -UCX_TEST_SUBROUTINE(testTestSuiteRoutineFailure, int* i) {
    1.39 +UCX_EXTERN UCX_TEST_SUBROUTINE(testTestSuiteRoutineFailure, int* i) {
    1.40      *i += 2;
    1.41      // Next test shall fail!
    1.42      UCX_TEST_ASSERT(*i==4, "the test framework works");
    1.43  }
    1.44  
    1.45 -UCX_TEST_IMPLEMENT(testTestSuiteRoutinePositive) {
    1.46 +UCX_EXTERN UCX_TEST_IMPLEMENT(testTestSuiteRoutinePositive) {
    1.47      int i = 2;
    1.48      UCX_TEST_BEGIN
    1.49      UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineSuccess, &i);
    1.50 @@ -81,7 +81,7 @@
    1.51      UCX_TEST_END
    1.52  }
    1.53  
    1.54 -UCX_TEST_IMPLEMENT(testTestSuiteRoutineNegative) {
    1.55 +UCX_EXTERN UCX_TEST_IMPLEMENT(testTestSuiteRoutineNegative) {
    1.56      int i = 0;
    1.57      UCX_TEST_BEGIN
    1.58      UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutineFailure, &i);
    1.59 @@ -89,7 +89,7 @@
    1.60      UCX_TEST_END
    1.61  }
    1.62  
    1.63 -UCX_TEST_IMPLEMENT(testTestSuiteRoutineMultiparam) {
    1.64 +UCX_EXTERN UCX_TEST_IMPLEMENT(testTestSuiteRoutineMultiparam) {
    1.65      UCX_TEST_BEGIN
    1.66      UCX_TEST_CALL_SUBROUTINE(testTestSuiteRoutine2Param, 42, 3.14f);
    1.67      UCX_TEST_END
     2.1 --- a/test/mpool_tests.c	Mon Aug 05 14:38:37 2013 +0200
     2.2 +++ b/test/mpool_tests.c	Tue Aug 06 10:22:03 2013 +0200
     2.3 @@ -123,7 +123,7 @@
     2.4      ucx_mempool_destroy(pool);
     2.5  }
     2.6  
     2.7 -void test_setdestr(void* elem) {
     2.8 +UCX_EXTERN void test_setdestr(void* elem) {
     2.9      intptr_t *cb = (intptr_t*) ((intptr_t*) elem)[1];
    2.10      *cb = 42;
    2.11  }
     3.1 --- a/ucx/mempool.c	Mon Aug 05 14:38:37 2013 +0200
     3.2 +++ b/ucx/mempool.c	Tue Aug 06 10:22:03 2013 +0200
     3.3 @@ -46,7 +46,7 @@
     3.4      void           *ptr;
     3.5  } ucx_regdestr;
     3.6  
     3.7 -void ucx_mempool_shared_destr(void* ptr) {
     3.8 +UCX_EXTERN void ucx_mempool_shared_destr(void* ptr) {
     3.9      ucx_regdestr *rd = (ucx_regdestr*)ptr;
    3.10      rd->destructor(rd->ptr);
    3.11  }
     4.1 --- a/ucx/ucx.h	Mon Aug 05 14:38:37 2013 +0200
     4.2 +++ b/ucx/ucx.h	Tue Aug 06 10:22:03 2013 +0200
     4.3 @@ -53,7 +53,10 @@
     4.4  #define _Bool bool
     4.5  #define restrict
     4.6  #endif
     4.7 +#define UCX_EXTERN extern "C"
     4.8  extern "C" {
     4.9 +#else
    4.10 +#define UCX_EXTERN
    4.11  #endif
    4.12  
    4.13  /**

mercurial