varasm.c (get_section): Use gcc_assert.
authorNathan Sidwell <nathan@gcc.gnu.org>
Thu, 29 Dec 2005 16:38:26 +0000 (16:38 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Thu, 29 Dec 2005 16:38:26 +0000 (16:38 +0000)
* varasm.c (get_section): Use gcc_assert.
cp:
* method.c (make_thunk): Don't set comdat_linkage here.
(use_thunk): Make thunk one only here, if thunk target is
DECL_ONE_ONLY.
testsuite:
* g++.dg/abi/thunk3.C: New.
* g++.dg/abi/thunk4.C: New.

From-SVN: r109149

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/method.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/abi/thunk3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/abi/thunk4.C [new file with mode: 0644]
gcc/varasm.c

index 32606d7694b9d63fd6f7e015be2081d923695401..f9b9002b8727448d1bc2d2100e2c87bea4784d98 100644 (file)
@@ -1,3 +1,7 @@
+2005-12-29  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * varasm.c (get_section): Use gcc_assert.
+
 2005-12-29  Paul Brook  <paul@codesourcery.com>
 
        * config/m68k/m68k.h (RETURN_ADDR_RTX): Define.
index ae0fcf5a9a6a8d6b8612b873309db8019909c10b..7391d15018fdffaf887976028ac1739e708543ae 100644 (file)
@@ -1,3 +1,9 @@
+2005-12-29  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * method.c (make_thunk): Don't set comdat_linkage here.
+       (use_thunk): Make thunk one only here, if thunk target is
+       DECL_ONE_ONLY.
+
 2005-12-26  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/25439
index f3c86d3178db7901b453b5ebd3e12e4d714a56b2..250c66d08b35a49a47c393beb4b09fe54d6017b2 100644 (file)
@@ -137,8 +137,6 @@ make_thunk (tree function, bool this_adjusting,
   TREE_READONLY (thunk) = TREE_READONLY (function);
   TREE_THIS_VOLATILE (thunk) = TREE_THIS_VOLATILE (function);
   TREE_PUBLIC (thunk) = TREE_PUBLIC (function);
-  if (flag_weak)
-    comdat_linkage (thunk);
   SET_DECL_THUNK_P (thunk, this_adjusting);
   THUNK_TARGET (thunk) = function;
   THUNK_FIXED_OFFSET (thunk) = d;
@@ -381,8 +379,8 @@ use_thunk (tree thunk_fndecl, bool emit_p)
   DECL_VISIBILITY (thunk_fndecl) = DECL_VISIBILITY (function);
   DECL_VISIBILITY_SPECIFIED (thunk_fndecl)
     = DECL_VISIBILITY_SPECIFIED (function);
-  if (flag_weak && TREE_PUBLIC (thunk_fndecl))
-    comdat_linkage (thunk_fndecl);
+  if (DECL_ONE_ONLY (function))
+    make_decl_one_only (thunk_fndecl);
 
   if (flag_syntax_only)
     {
index c95b8f80c377ba0a6509f6d732de6481fd4bded8..4dbfe9beb624b778a5da4f3ba42fccc57969814b 100644 (file)
@@ -1,7 +1,12 @@
+2005-12-29  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * g++.dg/abi/thunk3.C: New.
+       * g++.dg/abi/thunk4.C: New.
+
 2005-12-29  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/25532
-       *gfortran.dg/host_used_types_1.f90: New test. Check that host
+       * gfortran.dg/host_used_types_1.f90: New test. Check that host
        associated derived type components of derived types are
        properly declared in contained procedures.
 
diff --git a/gcc/testsuite/g++.dg/abi/thunk3.C b/gcc/testsuite/g++.dg/abi/thunk3.C
new file mode 100644 (file)
index 0000000..8b5f3ce
--- /dev/null
@@ -0,0 +1,20 @@
+// { dg-final { scan-assembler-not ".weak\t_ZThn4_N7Derived3FooEv" } }
+
+struct Base 
+{
+  virtual void Foo ();
+};
+
+struct Filler 
+{
+  virtual void Baz ();
+};
+
+struct Derived : Filler, Base 
+{
+  virtual void Foo ();
+};
+
+void Derived::Foo ()
+{
+}
diff --git a/gcc/testsuite/g++.dg/abi/thunk4.C b/gcc/testsuite/g++.dg/abi/thunk4.C
new file mode 100644 (file)
index 0000000..1c47740
--- /dev/null
@@ -0,0 +1,22 @@
+// { dg-final { scan-assembler ".weak\t_ZThn4_N7Derived3FooEv" } }
+
+struct Base 
+{
+  virtual void Foo ();
+};
+
+struct Filler 
+{
+  virtual void Baz ();
+};
+
+struct Derived : Filler, Base 
+{
+  virtual void Foo ();
+};
+
+inline void Derived::Foo ()
+{
+}
+
+Derived f;
index f39b07ccc9ae645eacc15e9971c5bb9e2d53c55a..eafba6b0bc8bc24bc663acf457a908bf0950003f 100644 (file)
@@ -249,10 +249,8 @@ get_section (const char *name, unsigned int flags, tree decl)
          /* Sanity check user variables for flag changes.  */
          if (decl == 0)
            decl = sect->named.decl;
-         if (decl)
-           error ("%+D causes a section type conflict", decl);
-         else
-           gcc_unreachable ();
+         gcc_assert (decl);
+         error ("%+D causes a section type conflict", decl);
        }
     }
   return sect;