Put GC internal function prototypes in tests into extern 'C' block
authorIvan Maidanski <ivmai@mail.ru>
Thu, 8 Feb 2018 06:02:14 +0000 (09:02 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 8 Feb 2018 06:02:14 +0000 (09:02 +0300)
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
tests/test.c

index 62c9a61..95f74af 100644 (file)
 # 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 */
index a9b06ea..da18b1f 100644 (file)
@@ -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){