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
This commit is contained in:
Mark Mitchell 2010-02-28 17:07:54 +00:00 committed by Mark Mitchell
parent dfd65514fe
commit 2a3dbebf6c
11 changed files with 62 additions and 18 deletions

View file

@ -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

View file

@ -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);

View file

@ -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;
}

View file

@ -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

View file

@ -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

View file

@ -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" }

View file

@ -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" }

View file

@ -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" }

View file

@ -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\]" } }

View file

@ -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" }
}

View file

@ -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" }
}