From 2a3dbebf6cae67ee70ac0e290421a2681e041a3d Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Sun, 28 Feb 2010 17:07:54 +0000 Subject: [PATCH] re PR c++/42748 (warnings about 'mangling of 'va_list' has changed in GCC 4.4' not suppressed in sytem headers) 2010-02-27 Mark Mitchell PR c++/42748 * cp-tree.h (push_tinst_level): Declare. (pop_tinst_level): Likewise. * pt.c (push_tinst_level): Give it external linkage. (pop_tinst_level): Likewise. * mangle.c (mangle_decl_string): Set the source location to that of the decl while mangling. 2010-02-27 Mark Mitchell PR c++/42748 * g++.dg/abi/mangle11.C: Adjust mangling warning locations. * g++.dg/abi/mangle12.C: Likewise. * g++.dg/abi/mangle20-2.C: Likewise. * g++.dg/abi/mangle17.C: Likewise. * g++.dg/template/cond2.C: Likewise. * g++.dg/template/pr35240.C: Likewise. From-SVN: r157124 --- gcc/cp/ChangeLog | 10 ++++++++++ gcc/cp/cp-tree.h | 2 ++ gcc/cp/mangle.c | 24 ++++++++++++++++++++++++ gcc/cp/pt.c | 6 ++---- gcc/testsuite/ChangeLog | 10 ++++++++++ gcc/testsuite/g++.dg/abi/mangle11.C | 4 ++-- gcc/testsuite/g++.dg/abi/mangle12.C | 4 ++-- gcc/testsuite/g++.dg/abi/mangle17.C | 8 ++++---- gcc/testsuite/g++.dg/abi/mangle20-2.C | 4 ++-- gcc/testsuite/g++.dg/template/cond2.C | 4 ++-- gcc/testsuite/g++.dg/template/pr35240.C | 4 ++-- 11 files changed, 62 insertions(+), 18 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d814469..5c2725f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2010-02-27 Mark Mitchell + + PR c++/42748 + * cp-tree.h (push_tinst_level): Declare. + (pop_tinst_level): Likewise. + * pt.c (push_tinst_level): Give it external linkage. + (pop_tinst_level): Likewise. + * mangle.c (mangle_decl_string): Set the source location to that + of the decl while mangling. + 2010-02-27 Simon Martin PR c++/42054 diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index aff3f91..4e1815f 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4965,6 +4965,8 @@ extern void make_args_non_dependent (VEC(tree,gc) *); extern bool reregister_specialization (tree, tree, tree); extern tree fold_non_dependent_expr (tree); extern bool explicit_class_specialization_p (tree); +extern int push_tinst_level (tree); +extern void pop_tinst_level (void); extern struct tinst_level *outermost_tinst_level(void); extern bool parameter_of_template_p (tree, tree); extern void init_template_processing (void); diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index e6d7934..6196ae2 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -3008,6 +3008,22 @@ static tree mangle_decl_string (const tree decl) { tree result; + location_t saved_loc = input_location; + tree saved_fn = NULL_TREE; + bool template_p = false; + + if (DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl)) + { + struct tinst_level *tl = current_instantiation (); + if (!tl || tl->decl != decl) + { + template_p = true; + saved_fn = current_function_decl; + push_tinst_level (decl); + current_function_decl = NULL_TREE; + } + } + input_location = DECL_SOURCE_LOCATION (decl); start_mangling (decl); @@ -3020,6 +3036,14 @@ mangle_decl_string (const tree decl) if (DEBUG_MANGLE) fprintf (stderr, "mangle_decl_string = '%s'\n\n", IDENTIFIER_POINTER (result)); + + if (template_p) + { + pop_tinst_level (); + current_function_decl = saved_fn; + } + input_location = saved_loc; + return result; } diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 6ec002b..ef76573 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -119,8 +119,6 @@ static int try_one_overload (tree, tree, tree, tree, tree, unification_kind_t, int, bool); static int unify (tree, tree, tree, tree, int); static void add_pending_template (tree); -static int push_tinst_level (tree); -static void pop_tinst_level (void); static tree reopen_tinst_level (struct tinst_level *); static tree tsubst_initializer_list (tree, tree); static tree get_class_bindings (tree, tree, tree); @@ -7013,7 +7011,7 @@ static int last_template_error_tick; /* We're starting to instantiate D; record the template instantiation context for diagnostics and to restore it later. */ -static int +int push_tinst_level (tree d) { struct tinst_level *new_level; @@ -7056,7 +7054,7 @@ push_tinst_level (tree d) /* We're done instantiating this template; return to the instantiation context. */ -static void +void pop_tinst_level (void) { /* Restore the filename and line number stashed away when we started diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bf0b7ce8..d6d79c4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2010-02-27 Mark Mitchell + + PR c++/42748 + * g++.dg/abi/mangle11.C: Adjust mangling warning locations. + * g++.dg/abi/mangle12.C: Likewise. + * g++.dg/abi/mangle20-2.C: Likewise. + * g++.dg/abi/mangle17.C: Likewise. + * g++.dg/template/cond2.C: Likewise. + * g++.dg/template/pr35240.C: Likewise. + 2010-02-27 Richard Guenther PR tree-optimization/43186 diff --git a/gcc/testsuite/g++.dg/abi/mangle11.C b/gcc/testsuite/g++.dg/abi/mangle11.C index a049a95..3152c25 100644 --- a/gcc/testsuite/g++.dg/abi/mangle11.C +++ b/gcc/testsuite/g++.dg/abi/mangle11.C @@ -1,10 +1,10 @@ // { dg-options "-Wabi -fabi-version=1" } template -void f (typename Q::X) {} +void f (typename Q::X) {} // { dg-warning "mangle" } struct S { typedef int X; }; -template void f (int); // { dg-warning "mangle" } +template void f (int); // { dg-message "instantiated" } diff --git a/gcc/testsuite/g++.dg/abi/mangle12.C b/gcc/testsuite/g++.dg/abi/mangle12.C index 7176fcd..3910cfc 100644 --- a/gcc/testsuite/g++.dg/abi/mangle12.C +++ b/gcc/testsuite/g++.dg/abi/mangle12.C @@ -1,11 +1,11 @@ // { dg-options "-Wabi -fabi-version=1" } template