re PR c++/42748 (warnings about 'mangling of 'va_list' has changed in GCC 4.4' not...
authorMark Mitchell <mark@codesourcery.com>
Sun, 28 Feb 2010 17:07:54 +0000 (17:07 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 28 Feb 2010 17:07:54 +0000 (17:07 +0000)
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

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/mangle.c
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/abi/mangle11.C
gcc/testsuite/g++.dg/abi/mangle12.C
gcc/testsuite/g++.dg/abi/mangle17.C
gcc/testsuite/g++.dg/abi/mangle20-2.C
gcc/testsuite/g++.dg/template/cond2.C
gcc/testsuite/g++.dg/template/pr35240.C

index d814469..5c2725f 100644 (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
index aff3f91..4e1815f 100644 (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);
index e6d7934..6196ae2 100644 (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;
 }
 
index 6ec002b..ef76573 100644 (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
index bf0b7ce..d6d79c4 100644 (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
index a049a95..3152c25 100644 (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" }
index 7176fcd..3910cfc 100644 (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" }
index 0a5fe9a..57f1a04 100644 (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" }
index bf3d189..b244e2e 100644 (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\]" } }
index abb6ebb..cf8df8c 100644 (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" }       
 }
index 9b95799..47455b6 100644 (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" }
 }