From 505dd180fa93c15942be514aa8e9139bb024d5e8 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Thu, 11 May 2017 19:09:51 +0000 Subject: [PATCH] cp-lang.c (get_global_decls, [...]): Move to ... * cp-lang.c (get_global_decls, cxx_pushdecl, LANG_HOOK_GETDECLS) LANG_HOOKS_PUSHDECL): Move to ... * cp-objcp-common.c (cp_get_global_decls, cp_pushdec) LANG_HOOK_DECLS, LANG_HOOKS_PUSHDECL): ... here. * cp-objcp-common.h (cp_get_global_decls, cp_pushdecl): Declare. ((--This line, and those below, will be ignored-- M cp/ChangeLog M cp/cp-lang.c M cp/cp-objcp-common.c M cp/cp-objcp-common.h From-SVN: r247923 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/cp-lang.c | 21 --------------------- gcc/cp/cp-objcp-common.c | 16 ++++++++++++++++ gcc/cp/cp-objcp-common.h | 7 +++++++ 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a1770d17264..94ad0442d2d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@ 2017-05-11 Nathan Sidwell + * cp-lang.c (get_global_decls, cxx_pushdecl, LANG_HOOK_GETDECLS, + LANG_HOOKS_PUSHDECL): Move to ... + * cp-objcp-common.c (cp_get_global_decls, cp_pushdec, + LANG_HOOK_DECLS, LANG_HOOKS_PUSHDECL): ... here. + * cp-objcp-common.h (cp_get_global_decls, cp_pushdecl): Declare. + * name-lookup.h (pushdecl): Add default friend parm. (pushdecl_maybe_friend): Delete. (pushdecl_top_level): Add default friend parm. diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index b5f11e390fb..defcbdc79a9 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -35,8 +35,6 @@ static tree cp_eh_personality (void); static tree get_template_innermost_arguments_folded (const_tree); static tree get_template_argument_pack_elems_folded (const_tree); static tree cxx_enum_underlying_base_type (const_tree); -static tree get_global_decls (); -static tree cxx_pushdecl (tree); /* Lang hooks common to C++ and ObjC++ are declared in cp/cp-objcp-common.h; consequently, there should be very few hooks below. */ @@ -80,10 +78,6 @@ static tree cxx_pushdecl (tree); #define LANG_HOOKS_EH_RUNTIME_TYPE build_eh_type_type #undef LANG_HOOKS_ENUM_UNDERLYING_BASE_TYPE #define LANG_HOOKS_ENUM_UNDERLYING_BASE_TYPE cxx_enum_underlying_base_type -#undef LANG_HOOKS_GETDECLS -#define LANG_HOOKS_GETDECLS get_global_decls -#undef LANG_HOOKS_PUSHDECL -#define LANG_HOOKS_PUSHDECL cxx_pushdecl /* Each front end provides its own lang hook initializer. */ struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; @@ -235,21 +229,6 @@ tree cxx_enum_underlying_base_type (const_tree type) return underlying_type; } -/* Return the list of decls in the global namespace. */ - -static tree -get_global_decls () -{ - return NAMESPACE_LEVEL (global_namespace)->names; -} - -/* Push DECL into the current scope. */ - -static tree -cxx_pushdecl (tree decl) -{ - return pushdecl (decl); -} #include "gt-cp-cp-lang.h" #include "gtype-cp.h" diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c index 2c93252c4b6..86279780e42 100644 --- a/gcc/cp/cp-objcp-common.c +++ b/gcc/cp/cp-objcp-common.c @@ -336,6 +336,22 @@ cxx_block_may_fallthru (const_tree stmt) } } +/* Return the list of decls in the global namespace. */ + +tree +cp_get_global_decls () +{ + return NAMESPACE_LEVEL (global_namespace)->names; +} + +/* Push DECL into the current scope. */ + +tree +cp_pushdecl (tree decl) +{ + return pushdecl (decl); +} + void cp_common_init_ts (void) { diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h index 6692ca89bf4..0d752a7a20a 100644 --- a/gcc/cp/cp-objcp-common.h +++ b/gcc/cp/cp-objcp-common.h @@ -31,6 +31,8 @@ extern int cp_decl_dwarf_attribute (const_tree, int); extern int cp_type_dwarf_attribute (const_tree, int); extern void cp_common_init_ts (void); extern tree cp_unit_size_without_reusable_padding (tree); +extern tree cp_get_global_decls (); +extern tree cp_pushdecl (tree); /* Lang hooks that are shared between C++ and ObjC++ are defined here. Hooks specific to C++ or ObjC++ go in cp/cp-lang.c and objcp/objcp-lang.c, @@ -165,4 +167,9 @@ extern tree cp_unit_size_without_reusable_padding (tree); #undef LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS #define LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS cp_protect_cleanup_actions + +#undef LANG_HOOKS_GETDECLS +#define LANG_HOOKS_GETDECLS cp_get_global_decls +#undef LANG_HOOKS_PUSHDECL +#define LANG_HOOKS_PUSHDECL cp_pushdecl #endif /* GCC_CP_OBJCP_COMMON */ -- 2.30.2