From 00220df760963723b756e28c52d19894ac930e60 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 8 Feb 2018 09:02:14 +0300 Subject: [PATCH] Put GC internal function prototypes in tests into extern 'C' block Issue #201 (bdwgc). * tests/disclaim_test.c [__cplusplus] (GC_random): Wrap the function declaration into extern "C". * tests/test.c [__cplusplus] [GC_AMIGA_FASTALLOC && AMIGA] (GC_amiga_free_all_mem): Likewise. --- tests/disclaim_test.c | 6 ++++++ tests/test.c | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/tests/disclaim_test.c b/tests/disclaim_test.c index 62c9a61c..95f74afd 100644 --- a/tests/disclaim_test.c +++ b/tests/disclaim_test.c @@ -32,8 +32,14 @@ /* Avoid include gc_priv.h. */ # ifndef GC_API_PRIV # define GC_API_PRIV GC_API +# endif +# ifdef __cplusplus + extern "C" { # endif GC_API_PRIV long GC_random(void); +# ifdef __cplusplus + } /* extern "C" */ +# endif # undef rand # define rand() (int)GC_random() #endif /* LINT2 */ diff --git a/tests/test.c b/tests/test.c index a9b06ea9..da18b1fb 100644 --- a/tests/test.c +++ b/tests/test.c @@ -220,7 +220,14 @@ volatile AO_t extra_count = 0; /* Amount of space wasted in cons node; */ #if defined(GC_AMIGA_FASTALLOC) && defined(AMIGA) +# ifdef __cplusplus + extern "C" { +# endif void GC_amiga_free_all_mem(void); +# ifdef __cplusplus + } /* extern "C" */ +# endif + void Amiga_Fail(void){GC_amiga_free_all_mem();abort();} # define FAIL Amiga_Fail() void *GC_amiga_gctest_malloc_explicitly_typed(size_t lb, GC_descr d){ -- 2.40.0