Skip to content

Commit c3d0f4b

Browse files
committed
Update for gcc 8 C++ FE changes to global_namespace
1 parent 34e7266 commit c3d0f4b

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

gcc-python.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,22 @@ PyGcc_get_translation_units(PyObject *self, PyObject *args)
301301
add_translation_unit_decl_to_list)
302302
}
303303

304-
/* Weakly import global_namespace; it will be non-NULL for the C++ frontend: */
304+
305+
/* Weakly import global_namespace; it will be non-NULL for the C++ frontend.
306+
307+
GCC 8's r247599 (aka c99e91fe8d1191b348cbc1659fbfbac2fc07e154)
308+
converted it from:
309+
extern GTY(()) tree global_namespace;
310+
to:
311+
#define global_namespace cp_global_trees[CPTI_GLOBAL]
312+
so we have to access cp_global_trees instead. */
313+
314+
#if (GCC_VERSION >= 8000)
315+
__typeof__ (cp_global_trees) cp_global_trees __attribute__ ((weak));
316+
#else
305317
__typeof__ (global_namespace) global_namespace __attribute__ ((weak));
318+
#endif /* #if (GCC_VERSION >= 8000) */
319+
306320

307321
static PyObject *
308322
PyGcc_get_global_namespace(PyObject *self, PyObject *args)

0 commit comments

Comments
 (0)