re PR debug/27473 (g++.dg/other/unused1.C and gcc.dg/20060410.c fail on powerpc-darwin)
authorDaniel Jacobowitz <dan@codesourcery.com>
Mon, 24 Jul 2006 02:59:36 +0000 (02:59 +0000)
committerDaniel Jacobowitz <drow@gcc.gnu.org>
Mon, 24 Jul 2006 02:59:36 +0000 (02:59 +0000)
PR debug/27473
* dbxout.c (output_used_types_helper, output_used_types): New.
(dbxout_symbol): Call output_used_types.

From-SVN: r115704

gcc/ChangeLog
gcc/dbxout.c

index d23808d345c38627a9d78f4591e61ae794a56ae4..415a58ac267e20a8021077be13208582677f16c2 100644 (file)
@@ -1,3 +1,9 @@
+2006-07-23  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       PR debug/27473
+       * dbxout.c (output_used_types_helper, output_used_types): New.
+       (dbxout_symbol): Call output_used_types.
+
 2006-07-23  Jan Hubicka  <jh@suse.cz>
 
        PR c/25795
index 49a32425f900b31b0a2e3baa07975ad1f4cd7c09..0776ad88df7c5334f1d7f568715931747bfdc11e 100644 (file)
@@ -2369,6 +2369,38 @@ dbxout_expand_expr (tree expr)
     }
 }
 
+/* Helper function for output_used_types.  Queue one entry from the
+   used types hash to be output.  */
+
+static int
+output_used_types_helper (void **slot, void *data ATTRIBUTE_UNUSED)
+{
+  tree type = *slot;
+
+  if ((TREE_CODE (type) == RECORD_TYPE
+       || TREE_CODE (type) == UNION_TYPE
+       || TREE_CODE (type) == QUAL_UNION_TYPE
+       || TREE_CODE (type) == ENUMERAL_TYPE)
+      && TYPE_STUB_DECL (type)
+      && DECL_P (TYPE_STUB_DECL (type))
+      && ! DECL_IGNORED_P (TYPE_STUB_DECL (type)))
+    debug_queue_symbol (TYPE_STUB_DECL (type));
+  else if (TYPE_NAME (type)
+          && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL)
+    debug_queue_symbol (TYPE_NAME (type));
+
+  return 1;
+}
+
+/* Force all types used by this function to be output in debug
+   information.  */
+static void
+output_used_types (void)
+{
+  if (cfun && cfun->used_types_hash)
+    htab_traverse (cfun->used_types_hash, output_used_types_helper, NULL);
+}
+
 /* Output a .stabs for the symbol defined by DECL,
    which must be a ..._DECL node in the normal namespace.
    It may be a CONST_DECL, a FUNCTION_DECL, a PARM_DECL or a VAR_DECL.
@@ -2482,6 +2514,9 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
          || GET_CODE (XEXP (decl_rtl, 0)) != SYMBOL_REF)
        break;
 
+      if (flag_debug_only_used_symbols)
+       output_used_types ();
+
       dbxout_begin_complex_stabs ();
       stabstr_I (DECL_ASSEMBLER_NAME (decl));
       stabstr_S (TREE_PUBLIC (decl) ? ":F" : ":f");