diff options
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r-- | gcc/cp/name-lookup.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index b31742c669c..5a92dc6ed89 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -813,9 +813,6 @@ pushdecl_maybe_friend (tree x, bool is_friend) } } - if (TREE_CODE (x) == FUNCTION_DECL || DECL_FUNCTION_TEMPLATE_P (x)) - check_default_args (x); - check_template_shadow (x); /* If this is a function conjured up by the back end, massage it @@ -826,11 +823,10 @@ pushdecl_maybe_friend (tree x, bool is_friend) SET_DECL_LANGUAGE (x, lang_c); } + t = x; if (DECL_NON_THUNK_FUNCTION_P (x) && ! DECL_FUNCTION_MEMBER_P (x)) { t = push_overloaded_decl (x, PUSH_LOCAL, is_friend); - if (t != x) - POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t); if (!namespace_bindings_p ()) /* We do not need to create a binding for this name; push_overloaded_decl will have already done so if @@ -842,9 +838,14 @@ pushdecl_maybe_friend (tree x, bool is_friend) t = push_overloaded_decl (x, PUSH_GLOBAL, is_friend); if (t == x) add_decl_to_level (x, NAMESPACE_LEVEL (CP_DECL_CONTEXT (t))); - POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t); } + if (TREE_CODE (x) == FUNCTION_DECL || DECL_FUNCTION_TEMPLATE_P (x)) + check_default_args (x); + + if (t != x || DECL_FUNCTION_TEMPLATE_P (t)) + POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t); + /* If declaring a type as a typedef, copy the type (unless we're at line 0), and install this TYPE_DECL as the new type's typedef name. See the extensive comment in ../c-decl.c (pushdecl). */ @@ -1031,7 +1032,10 @@ pushdecl_maybe_friend (tree x, bool is_friend) } } - if (warn_shadow && !err) + if (warn_shadow && !err + /* Don't complain about the parms we push and then pop + while tentatively parsing a function declarator. */ + && !(TREE_CODE (x) == PARM_DECL && DECL_CONTEXT (x) == NULL_TREE)) { warning (OPT_Wshadow, "declaration of %q#D shadows a parameter", x); warning (OPT_Wshadow, "%Jshadowed declaration is here", oldlocal); @@ -3337,7 +3341,8 @@ do_namespace_alias (tree alias, tree name_space) pushdecl (alias); /* Emit debug info for namespace alias. */ - (*debug_hooks->global_decl) (alias); + if (!building_stmt_tree ()) + (*debug_hooks->global_decl) (alias); } /* Like pushdecl, only it places X in the current namespace, @@ -5386,7 +5391,12 @@ cp_emit_debug_info_for_using (tree t, tree context) /* FIXME: Handle TEMPLATE_DECLs. */ for (t = OVL_CURRENT (t); t; t = OVL_NEXT (t)) if (TREE_CODE (t) != TEMPLATE_DECL) - (*debug_hooks->imported_module_or_decl) (t, NULL_TREE, context, false); + { + if (building_stmt_tree ()) + add_stmt (build_stmt (USING_STMT, t)); + else + (*debug_hooks->imported_module_or_decl) (t, NULL_TREE, context, false); + } } #include "gt-cp-name-lookup.h" |