diff options
author | Mark Mitchell <mark@codesourcery.com> | 2010-02-28 17:07:54 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2010-02-28 17:07:54 +0000 |
commit | 2a3dbebf6cae67ee70ac0e290421a2681e041a3d (patch) | |
tree | f2b4f7ef00102ad7b366dd23023b43367f88b2df | |
parent | dfd65514fec4a88783219dca811b2db1adce5f69 (diff) | |
download | gcc-2a3dbebf6cae67ee70ac0e290421a2681e041a3d.zip gcc-2a3dbebf6cae67ee70ac0e290421a2681e041a3d.tar.gz gcc-2a3dbebf6cae67ee70ac0e290421a2681e041a3d.tar.bz2 |
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 <mark@codesourcery.com>
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 <mark@codesourcery.com>
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
-rw-r--r-- | gcc/cp/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 2 | ||||
-rw-r--r-- | gcc/cp/mangle.c | 24 | ||||
-rw-r--r-- | gcc/cp/pt.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/abi/mangle11.C | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/abi/mangle12.C | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/abi/mangle17.C | 8 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/abi/mangle20-2.C | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/cond2.C | 4 | ||||
-rw-r--r-- | 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 <mark@codesourcery.com> + + 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 <simartin@users.sourceforge.net> 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 <mark@codesourcery.com> + + 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 <rguenther@suse.de> 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 <typename Q> -void f (typename Q::X) {} +void f (typename Q::X) {} // { dg-warning "mangle" } struct S { typedef int X; }; -template void f<S> (int); // { dg-warning "mangle" } +template void f<S> (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 <template <typename> class Q> -void f (typename Q<int>::X) {} +void f (typename Q<int>::X) {} // { dg-warning "mangle" } template <typename Q> struct S { typedef int X; }; -template void f<S> (int); // { dg-warning "mangle" } +template void f<S> (int); // { dg-message "instantiated" } diff --git a/gcc/testsuite/g++.dg/abi/mangle17.C b/gcc/testsuite/g++.dg/abi/mangle17.C index 0a5fe9a..57f1a04 100644 --- a/gcc/testsuite/g++.dg/abi/mangle17.C +++ b/gcc/testsuite/g++.dg/abi/mangle17.C @@ -4,8 +4,8 @@ enum E { e = 3 }; template <int I> struct S {}; -template <int I> void f (S<I + e + int (3.7)>) {} -template void f<7>(S<7 + e + int (3.7)>); // { dg-warning "mangle" } +template <int I> void f (S<I + e + int (3.7)>) {} // { dg-warning "mangle" } +template void f<7>(S<7 + e + int (3.7)>); // { dg-message "instantiated" } -template <int I> void g (S<I + e + int (3.7)>) {} -template void g<7>(S<7 + e + int (3.7)>); // { dg-warning "mangle" } +template <int I> void g (S<I + e + int (3.7)>) {} // { dg-warning "mangle" } +template void g<7>(S<7 + e + int (3.7)>); // { dg-message "instantiated" } diff --git a/gcc/testsuite/g++.dg/abi/mangle20-2.C b/gcc/testsuite/g++.dg/abi/mangle20-2.C index bf3d189..b244e2e 100644 --- a/gcc/testsuite/g++.dg/abi/mangle20-2.C +++ b/gcc/testsuite/g++.dg/abi/mangle20-2.C @@ -7,10 +7,10 @@ // PR 9043 // mangled array types in templates -template <int I> void f(int (*)[2]) {} +template <int I> void f(int (*)[2]) {} // { dg-warning "mangled name" } template <int I> void g(int (*)[I+2]) {} -template void f<1>(int (*)[2]); // { dg-warning "mangled name" } +template void f<1>(int (*)[2]); // { dg-message "instantiated" } // { dg-final { scan-assembler "\n_?_Z1fILi1EEvPALi2E_i\[: \t\n\]" } } template void g<1>(int (*)[3]); // { dg-final { scan-assembler "\n_?_Z1gILi1EEvPAplT_Li2E_i\[: \t\n\]" } } diff --git a/gcc/testsuite/g++.dg/template/cond2.C b/gcc/testsuite/g++.dg/template/cond2.C index abb6ebb..cf8df8c 100644 --- a/gcc/testsuite/g++.dg/template/cond2.C +++ b/gcc/testsuite/g++.dg/template/cond2.C @@ -3,8 +3,8 @@ template<int X> class c; -template<int X, int Y> int test(c<X ? : Y>&); +template<int X, int Y> int test(c<X ? : Y>&); // { dg-error "omitted" } void test(c<2>*c2) { - test<0, 2>(*c2); // { dg-error "omitted" } + test<0, 2>(*c2); // { dg-message "instantiated" } } diff --git a/gcc/testsuite/g++.dg/template/pr35240.C b/gcc/testsuite/g++.dg/template/pr35240.C index 9b95799..47455b6 100644 --- a/gcc/testsuite/g++.dg/template/pr35240.C +++ b/gcc/testsuite/g++.dg/template/pr35240.C @@ -4,9 +4,9 @@ template<int> struct A {}; -template<int N> A<sizeof(new int[N][N])> foo(); +template<int N> A<sizeof(new int[N][N])> foo(); // { dg-message "unimplemented" } void bar() { - foo<1>(); // { dg-message "unimplemented" } + foo<1>(); // { dg-message "instantiated" } } |