@@ -60,8 +60,16 @@ __typeof__ (lang_check_failed) lang_check_failed __attribute__ ((weak));
6060
6161__typeof__ (decl_as_string ) decl_as_string __attribute__ ((weak ));
6262
63- /* Similar for namespace_binding: */
63+ /* Similar for namespace_binding, though gcc 8's r247654 (aka
64+ f906dcc33dd818b71e16c88cef38f33c161070db) replaced it with
65+ get_namespace_value and reversed the order of the params
66+ and r247745 (aka 9d79db401edbb9665cde47ddea2702671c89e548)
67+ renamed it from get_namespace_value to get_namespace_binding. */
68+ #if (GCC_VERSION >= 8000 )
69+ __typeof__ (get_namespace_binding ) get_namespace_binding __attribute__ ((weak ));
70+ #else
6471__typeof__ (namespace_binding ) namespace_binding __attribute__ ((weak ));
72+ #endif
6573
6674/* And for cp_namespace_decls: */
6775__typeof__ (cp_namespace_decls ) cp_namespace_decls __attribute__ ((weak ));
@@ -931,13 +939,22 @@ PyGccNamespaceDecl_lookup(struct PyGccTree * self, PyObject *args, PyObject *kwa
931939 return NULL ;
932940 }
933941
942+ #if (GCC_VERSION >= 8000 )
943+ if (NULL == get_namespace_binding ) {
944+ #else
934945 if (NULL == namespace_binding ) {
946+ #endif
935947 return raise_cplusplus_only ("gcc.NamespaceDecl.lookup" );
936948 }
937949
938950 t_name = get_identifier (name );
939951
952+ #if (GCC_VERSION >= 8000 )
953+ t_result = get_namespace_binding (self -> t .inner , t_name );
954+ #else
940955 t_result = namespace_binding (t_name , self -> t .inner );
956+ #endif
957+
941958 return PyGccTree_New (gcc_private_make_tree (t_result ));
942959}
943960
0 commit comments