]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR debug/12066 (g++ generates stabs for "char *" that gdb cannot read)
authorMark Mitchell <mark@codesourcery.com>
Wed, 17 Sep 2003 20:52:41 +0000 (20:52 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Wed, 17 Sep 2003 20:52:41 +0000 (20:52 +0000)
PR debug/12066
* dbxout.c (dbxout_init): Use a langhook to find builtin types.
* langhooks-def.h (lhd_return_null_tree_v): New function.
(LANG_HOOKS_BUILTIN_TYPE_DECLS): New macro.
(LANG_HOOKS_DECLS): Add it to the intializer.
* langhooks.c (lhd_return_null_tree_v): New function.
* langhooks.h (lang_hooks_for_decls): Add builtin_type_decls.

PR debug/12066
* cp-lang.c (LANG_HOOKS_BUILTIN_TYPE_DECLS): Define.
* cp-tree.h (cxx_builtin_type_decls): Declare.
* decl.c (builtin_type_decls): New variables.
(cxx_builtin_type_decls): New function.
(record_builtin_type): Add to builtin_type_decls.

From-SVN: r71478

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/cp-lang.c
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/dbxout.c
gcc/langhooks-def.h
gcc/langhooks.c
gcc/langhooks.h

index 8f1d4785f16e8c2e7153cb43843047856a19304e..fe68b0a9d16bf60e7588d95325faaefdf6f9511a 100644 (file)
@@ -1,3 +1,13 @@
+2003-09-17  Mark Mitchell  <mark@codesourcery.com>
+
+       PR debug/12066
+       * dbxout.c (dbxout_init): Use a langhook to find builtin types.
+       * langhooks-def.h (lhd_return_null_tree_v): New function.
+       (LANG_HOOKS_BUILTIN_TYPE_DECLS): New macro.
+       (LANG_HOOKS_DECLS): Add it to the intializer.
+       * langhooks.c (lhd_return_null_tree_v): New function.
+       * langhooks.h (lang_hooks_for_decls): Add builtin_type_decls.
+
 2003-09-17  Daniel Jacobowitz  <drow@mvista.com>
 
        * configure.in: Quote gcc_config_arguments for configargs.h.
index f650e3cda2500a86ee591f2502f780a8f3d8551c..24f82d76f34838638f35fda76ed46cf173933a69 100644 (file)
@@ -1,3 +1,12 @@
+2003-09-17  Mark Mitchell  <mark@codesourcery.com>
+
+       PR debug/12066
+       * cp-lang.c (LANG_HOOKS_BUILTIN_TYPE_DECLS): Define.
+       * cp-tree.h (cxx_builtin_type_decls): Declare.
+       * decl.c (builtin_type_decls): New variables.
+       (cxx_builtin_type_decls): New function.
+       (record_builtin_type): Add to builtin_type_decls.
+
 2003-09-17  Richard Henderson  <rth@redhat.com>
 
         * semantics.c (expand_or_defer_fn): Inc/dec function_depth.
index 3e229a01004cf75672a89fa99162171e4650a58b..92e6b914b3ebf851c03e1503db26c65b667224ab 100644 (file)
@@ -102,6 +102,8 @@ static void cxx_initialize_diagnostics (diagnostic_context *);
 #define LANG_HOOKS_DECL_PRINTABLE_NAME cxx_printable_name
 #undef LANG_HOOKS_PRINT_ERROR_FUNCTION
 #define LANG_HOOKS_PRINT_ERROR_FUNCTION        cxx_print_error_function
+#undef LANG_HOOKS_BUILTIN_TYPE_DECLS
+#define LANG_HOOKS_BUILTIN_TYPE_DECLS cxx_builtin_type_decls
 #undef LANG_HOOKS_PUSHLEVEL
 #define LANG_HOOKS_PUSHLEVEL lhd_do_nothing_i
 #undef LANG_HOOKS_POPLEVEL
index 1d126e85618bad0c4fe510529f9db16d2997fbaa..dfa298f5379d5f05af9884bc03200b6631663647 100644 (file)
@@ -3752,6 +3752,8 @@ extern void register_dtor_fn                    (tree);
 extern tmpl_spec_kind current_tmpl_spec_kind    (int);
 extern tree cp_fname_init                      (const char *);
 extern tree check_elaborated_type_specifier     (enum tag_types, tree, bool);
+extern tree cxx_builtin_type_decls              (void);
+
 extern bool have_extern_spec;
 
 /* in decl2.c */
index 92e8597efd51d19a4a0876c4fa58ba1f7741f900..8676698b2eb4729de5fae8a823f5cf359a3f924d 100644 (file)
@@ -5911,6 +5911,19 @@ lookup_type_current_level (tree name)
 }
 
 \f
+
+/* A chain of TYPE_DECLs for the builtin types.  */
+
+static GTY(()) tree builtin_type_decls;
+
+/* Return a chain of TYPE_DECLs for the builtin types.  */
+
+tree
+cxx_builtin_type_decls ()
+{
+  return builtin_type_decls;
+}
+
 /* Push the declarations of builtin types into the namespace.
    RID_INDEX is the index of the builtin type in the array
    RID_POINTERS.  NAME is the name used when looking up the builtin
@@ -5952,6 +5965,12 @@ record_builtin_type (enum rid rid_index,
 
   if (!TYPE_NAME (type))
     TYPE_NAME (type) = tdecl;
+
+  if (tdecl)
+    {
+      TREE_CHAIN (tdecl) = builtin_type_decls;
+      builtin_type_decls = tdecl;
+    }
 }
 
 /* Record one of the standard Java types.
index d257729d8f8ed2e9505e0c1e7aa5efd901797365..e4c797894c0421158374fbff0fd93b2809c93e85 100644 (file)
@@ -535,9 +535,10 @@ dbxout_init (const char *input_file_name)
   DBX_OUTPUT_STANDARD_TYPES (syms);
 #endif
 
-  /* Get all permanent types that have typedef names,
-     and output them all, except for those already output.  */
-
+  /* 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) ());
   dbxout_typedefs (syms);
 }
 
index 2f34664185db5c7942bae1131fd62e52fb5a9525..f8ecc8bdcb7685b3d87afbfaa5a93f64f040bb50 100644 (file)
@@ -46,6 +46,7 @@ extern void lhd_do_nothing_f (struct function *);
 extern bool lhd_post_options (const char **);
 extern HOST_WIDE_INT lhd_get_alias_set (tree);
 extern tree lhd_return_tree (tree);
+extern tree lhd_return_null_tree_v (void);
 extern tree lhd_return_null_tree (tree);
 extern tree lhd_do_nothing_iii_return_null_tree (int, int, int);
 extern int lhd_safe_from_p (rtx, tree);
@@ -239,6 +240,7 @@ extern int lhd_tree_dump_type_quals (tree);
 #define LANG_HOOKS_SET_BLOCK   set_block
 #define LANG_HOOKS_PUSHDECL    pushdecl
 #define LANG_HOOKS_GETDECLS    getdecls
+#define LANG_HOOKS_BUILTIN_TYPE_DECLS lhd_return_null_tree_v
 #define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL lhd_warn_unused_global_decl
 #define LANG_HOOKS_WRITE_GLOBALS write_global_declarations
 #define LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE NULL
@@ -252,6 +254,7 @@ extern int lhd_tree_dump_type_quals (tree);
   LANG_HOOKS_SET_BLOCK, \
   LANG_HOOKS_PUSHDECL, \
   LANG_HOOKS_GETDECLS, \
+  LANG_HOOKS_BUILTIN_TYPE_DECLS, \
   LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL, \
   LANG_HOOKS_WRITE_GLOBALS, \
   LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE, \
index 6c74ed2044f8420c3d06dd9e472aa02abef854b1..a1d60f9ff5eb035a3e70dcda87ceac0065b1ff80 100644 (file)
@@ -83,6 +83,14 @@ lhd_return_tree (tree t)
 
 /* Do nothing (return NULL_TREE).  */
 
+tree
+lhd_return_null_tree_v (void)
+{
+  return NULL_TREE;
+}
+
+/* Do nothing (return NULL_TREE).  */
+
 tree
 lhd_return_null_tree (tree t ATTRIBUTE_UNUSED)
 {
index 195446c702c90275b2d9d0c2a73259afe0d98ae3..4887f6dcd44473abd1346937fb993b3bc640a178 100644 (file)
@@ -189,6 +189,9 @@ struct lang_hooks_for_decls
   /* Returns the chain of decls so far in the current scope level.  */
   tree (*getdecls) (void);
 
+  /* Returns a chain of TYPE_DECLs for built-in types.  */
+  tree (*builtin_type_decls) (void);
+
   /* Returns true when we should warn for an unused global DECL.
      We will already have checked that it has static binding.  */
   bool (*warn_unused_global) (tree);