Skip to content

Commit

Permalink
Fiddle with linkage to make extra/gc.c valid C++ code
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jaykrell authored and ivmai committed Feb 26, 2018
1 parent 72a2ada commit 514eb96
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions extra/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@
/* 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"
Expand Down

0 comments on commit 514eb96

Please sign in to comment.