summaryrefslogtreecommitdiff
path: root/gcc/dbxout.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2004-02-12 21:42:28 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2004-02-12 21:42:28 +0000
commit73ae3ef72f8c419fc963cd401e8cc2ef53d9434b (patch)
treecfa7bbb13d0bfc85e73ea5724b507a1d241d14d5 /gcc/dbxout.c
parentcdfbccf4aec52c4f8777f857e7b34e5f0fd24627 (diff)
downloadgcc-73ae3ef72f8c419fc963cd401e8cc2ef53d9434b.tar.gz
* debug.h (struct gcc_debug_hooks): Add type_decl field.
(debug_nothing_tree_int): Prototype. (dwarf_debug_hooks): Delete, unused. * debug.c (do_nothing_debug_hooks): Update. (debug_nothing_tree_int): New function. * langhooks.h (struct lang_hooks_for_decls): Remove builtin_type_decls field. * langhooks-def.h (LANG_HOOKS_BUILTIN_TYPE_DECLS): Delete. (LANG_HOOKS_DECLS): Update. * toplev.c (rest_of_decl_compilation, rest_of_type_compilation): Use debug_hooks->type_decl. * dbxout.c (preinit_symbols): New static. (dbx_debug_hooks, xcoff_debug_hooks): Update. (dbxout_init): Don't call DBX_OUTPUT_STANDARD_TYPES or lang_hooks.decls.builtin_type_decls. Do scan preinit_symbols for symbols to output. (dbxout_type_decl): New function. (dbxout_symbol): If called before dbxout_init has run, queue the symbol for later. Apply DBX_ASSIGN_FUNDAMENTAL_TYPE_NUMBER to TYPE_DECLs before emitting them. * xcoffout.c (assign_type_number): Delete. (xcoff_type_numbers): New static table. (xcoff_assign_fundamental_type_number): New function. * xcoffout.h: Define DBX_ASSIGN_FUNDAMENTAL_TYPE_NUMBER, not DBX_OUTPUT_STANDARD_TYPES. Remove unnecessary #ifdefs. * sdbout.c: Include varray.h. (deferred_global_decls): New static. (sdb_debug_hooks): Update. (sdbout_global_decl): If we can't emit something right now, remember it in deferred_global_decls. (sdbout_finish): Just scan deferred_global_decls; don't call getdecls. (sdbout_init): Initialize deferred_global_decls. * Makefile.in: Update dependencies of sdbout.o. * dwarf2out.c (dwarf2out_type_decl): New function. (dwarf2_debug_hooks): Update. * vmsdbgout.c (vmsdbg_debug_hooks): Update. * c-decl.c (getdecls): Just return 0. (check_for_loop_decls): Don't use getdecls. (record_builtin_type): Call debug_hooks->type_decl on the TYPE_DECL. * c-objc-common.c (c_objc_common_finish_file): Don't use getdecls. cp: * cp-lang.c: Don't define LANG_HOOKS_BUILTIN_TYPE_DECLS. * cp-tree.h: Don't declare cxx_builtin_type_decls. * decl.c (builtin_type_decls, cxx_builtin_type_decls): Delete. (record_builtin_type): Call debug_hooks->type_decl on the TYPE_DECL. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@77730 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dbxout.c')
-rw-r--r--gcc/dbxout.c71
1 files changed, 54 insertions, 17 deletions
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index e020d03f47a..0fe6c0bd2c8 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -179,6 +179,12 @@ static GTY(()) int typevec_len;
static GTY(()) int next_type_number;
+/* The C front end may call dbxout_symbol before dbxout_init runs.
+ We save all such decls in this list and output them when we get
+ to dbxout_init. */
+
+static GTY(()) tree preinit_symbols;
+
enum binclstatus {BINCL_NOT_REQUIRED, BINCL_PENDING, BINCL_PROCESSED};
/* When using N_BINCL in dbx output, each type number is actually a
@@ -371,6 +377,7 @@ static void dbxout_begin_function (tree);
static void dbxout_begin_block (unsigned, unsigned);
static void dbxout_end_block (unsigned, unsigned);
static void dbxout_function_decl (tree);
+static void dbxout_type_decl (tree, int);
const struct gcc_debug_hooks dbx_debug_hooks =
{
@@ -396,6 +403,7 @@ const struct gcc_debug_hooks dbx_debug_hooks =
debug_nothing_int, /* end_function */
dbxout_function_decl,
dbxout_global_decl, /* global_decl */
+ dbxout_type_decl, /* type_decl */
debug_nothing_tree_tree, /* imported_module_or_decl */
debug_nothing_tree, /* deferred_inline_function */
debug_nothing_tree, /* outlining_inline_function */
@@ -425,6 +433,7 @@ const struct gcc_debug_hooks xcoff_debug_hooks =
xcoffout_end_function,
debug_nothing_tree, /* function_decl */
dbxout_global_decl, /* global_decl */
+ dbxout_type_decl, /* type_decl */
debug_nothing_tree_tree, /* imported_module_or_decl */
debug_nothing_tree, /* deferred_inline_function */
debug_nothing_tree, /* outlining_inline_function */
@@ -537,22 +546,20 @@ dbxout_init (const char *input_file_name)
current_file->pending_bincl_name = NULL;
#endif
- /* Make sure that types `int' and `char' have numbers 1 and 2.
- Definitions of other integer types will refer to those numbers.
- (Actually it should no longer matter what their numbers are.
- Also, if any types with tags have been defined, dbxout_symbol
- will output them first, so the numbers won't be 1 and 2. That
- happens in C++. So it's a good thing it should no longer matter). */
-
-#ifdef DBX_OUTPUT_STANDARD_TYPES
- DBX_OUTPUT_STANDARD_TYPES (syms);
-#endif
-
/* Get all permanent types that have typedef names, and output them
all, except for those already output. Some language front ends
- put these declarations in the top-level scope; some do not. */
- dbxout_typedefs ((*lang_hooks.decls.builtin_type_decls) ());
+ put these declarations in the top-level scope; some do not;
+ the latter are responsible for calling debug_hooks->type_decl from
+ their record_builtin_type function. */
dbxout_typedefs (syms);
+
+ if (preinit_symbols)
+ {
+ tree t;
+ for (t = nreverse (preinit_symbols); t; t = TREE_CHAIN (t))
+ dbxout_symbol (TREE_VALUE (t), 0);
+ preinit_symbols = 0;
+ }
}
/* Output any typedef names for types described by TYPE_DECLs in SYMS. */
@@ -805,6 +812,14 @@ dbxout_global_decl (tree decl)
}
}
+/* This is just a function-type adapter; dbxout_symbol does exactly
+ what we want but returns an int. */
+static void
+dbxout_type_decl (tree decl, int local)
+{
+ dbxout_symbol (decl, local);
+}
+
/* At the end of compilation, finish writing the symbol table.
Unless you define DBX_OUTPUT_MAIN_SOURCE_FILE_END, the default is
to do nothing. */
@@ -2064,14 +2079,22 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
symbol nodees are flagged with TREE_USED. Ignore any that
aren't flaged as TREE_USED. */
+ if (flag_debug_only_used_symbols
+ && (!TREE_USED (decl)
+ && (TREE_CODE (decl) != VAR_DECL || !DECL_INITIAL (decl))))
+ DBXOUT_DECR_NESTING_AND_RETURN (0);
+
+ /* If dbxout_init has not yet run, queue this symbol for later. */
+ if (!typevec)
+ {
+ preinit_symbols = tree_cons (0, decl, preinit_symbols);
+ DBXOUT_DECR_NESTING_AND_RETURN (0);
+ }
+
if (flag_debug_only_used_symbols)
{
tree t;
- if (!TREE_USED (decl)
- && (TREE_CODE (decl) != VAR_DECL || !DECL_INITIAL (decl)))
- DBXOUT_DECR_NESTING_AND_RETURN (0);
-
/* We now have a used symbol. We need to generate the info for
the symbol's type in addition to the symbol itself. These
type symbols are queued to be generated after were done with
@@ -2175,6 +2198,20 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
if (TREE_ASM_WRITTEN (decl) || TYPE_DECL_SUPPRESS_DEBUG (decl))
DBXOUT_DECR_NESTING_AND_RETURN (0);
+ /* Don't output typedefs for types with magic type numbers (XCOFF). */
+#ifdef DBX_ASSIGN_FUNDAMENTAL_TYPE_NUMBER
+ {
+ int fundamental_type_number =
+ DBX_ASSIGN_FUNDAMENTAL_TYPE_NUMBER (decl);
+
+ if (fundamental_type_number != 0)
+ {
+ TREE_ASM_WRITTEN (decl) = 1;
+ TYPE_SYMTAB_ADDRESS (TREE_TYPE (decl)) = fundamental_type_number;
+ DBXOUT_DECR_NESTING_AND_RETURN (0);
+ }
+ }
+#endif
FORCE_TEXT;
result = 1;
{