]> granicus.if.org Git - gc/commitdiff
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 62c9a61c6ccbd7e9ef52e4fdc3471426f61b4f2a..95f74afdcf849d808b5ba77e440598db5ffe4125 100644 (file)
   /* 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 */
index a9b06ea979855024faf9cf28e5487d3ed7c6fa94..da18b1fbb7e12eac9cf29b40d1caed5086596500 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){