Fiddle with linkage to make extra/gc.c valid C++ code
authorJay Krell <jaykrell@microsoft.com>
Sun, 18 Feb 2018 05:23:34 +0000 (21:23 -0800)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 26 Feb 2018 05:43:39 +0000 (08:43 +0300)
Issue #206 (bdwgc).

Specifically: int i; int i = 0; is not valid, but:
extern int i; int i = 0; is valid.  Adding static would also be
desirable here but requires a larger change.

* extra/gc.c (GC_INNER, GC_EXTERN): Do not define if __cplusplus; add
comment and TODO item.

extra/gc.c

index ea3648e..6cfc7d4 100644 (file)
 /* for GC and the client otherwise GC_thread_exit_proc() is not         */
 /* guaranteed to be invoked (see the comments in pthread_start.c).      */
 
-
-#define GC_INNER STATIC
-#define GC_EXTERN GC_INNER
+#ifndef __cplusplus
+  /* static is desirable here for more efficient linkage.               */
+  /* TODO: Enable this in case of the compilation as C++ code.          */
+# define GC_INNER STATIC
+# define GC_EXTERN GC_INNER
                 /* STATIC is defined in gcconfig.h. */
+#endif
 
 /* Small files go first... */
 #include "../backgraph.c"