Remove some unneeded psymtab initializations
authorTom Tromey <tom@tromey.com>
Thu, 10 May 2018 22:23:44 +0000 (16:23 -0600)
committerTom Tromey <tom@tromey.com>
Thu, 10 Jan 2019 14:08:10 +0000 (07:08 -0700)
allocate_psymtab has long cleared the new psymtab that is returned.
This patch documents this behavior and then removes some redundant
initializations.

gdb/ChangeLog
2019-01-10  Tom Tromey  <tom@tromey.com>

* xcoffread.c (xcoff_end_psymtab): Remove some initializations.
* psymtab.c (allocate_psymtab): Add comment.
* psympriv.h (allocate_psymtab): Add comment.
* dwarf2read.c (dwarf2_create_include_psymtab): Remove some
initializations.
* dbxread.c (dbx_end_psymtab): Remove some initializations.

gdb/ChangeLog
gdb/dbxread.c
gdb/dwarf2read.c
gdb/psympriv.h
gdb/psymtab.c
gdb/xcoffread.c

index dc646070cc12199a52c502a79aa7e602af91e1e0..99b5afd1026ea6b5c224d3eac3330ffdf337b66a 100644 (file)
@@ -1,3 +1,12 @@
+2019-01-10  Tom Tromey  <tom@tromey.com>
+
+       * xcoffread.c (xcoff_end_psymtab): Remove some initializations.
+       * psymtab.c (allocate_psymtab): Add comment.
+       * psympriv.h (allocate_psymtab): Add comment.
+       * dwarf2read.c (dwarf2_create_include_psymtab): Remove some
+       initializations.
+       * dbxread.c (dbx_end_psymtab): Remove some initializations.
+
 2019-01-10  Tom Tromey  <tom@tromey.com>
 
        * symfile.h (mdebug_build_psymtabs, elfmdebug_build_psymtabs):
index e3a952022cceb24b3a79235490ad4b4db54f6fcb..743fced220f87aa540e01da3673083a434ccd463 100644 (file)
@@ -2057,13 +2057,6 @@ dbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
       subpst->dependencies[0] = pst;
       subpst->number_of_dependencies = 1;
 
-      subpst->globals_offset =
-       subpst->n_global_syms =
-       subpst->statics_offset =
-       subpst->n_static_syms = 0;
-
-      subpst->readin = 0;
-      subpst->compunit_symtab = 0;
       subpst->read_symtab = pst->read_symtab;
     }
 
index ddf07f151d3adfef3f6ef1569429f8a9ec873ca9..40d173aab6f279db5bb091495978842debf38ca9 100644 (file)
@@ -6592,13 +6592,7 @@ dwarf2_create_include_psymtab (const char *name, struct partial_symtab *pst,
   subpst->dependencies[0] = pst;
   subpst->number_of_dependencies = 1;
 
-  subpst->globals_offset = 0;
-  subpst->n_global_syms = 0;
-  subpst->statics_offset = 0;
-  subpst->n_static_syms = 0;
-  subpst->compunit_symtab = NULL;
   subpst->read_symtab = pst->read_symtab;
-  subpst->readin = 0;
 
   /* No private part is necessary for include psymtabs.  This property
      can be used to differentiate between such include psymtabs and
index e28adfed4ab309346d3372dae21d8d784fc891dc..76893f2bf0681b429f89cf5aa05b65f706a913d3 100644 (file)
@@ -290,8 +290,14 @@ extern struct partial_symtab *start_psymtab_common (struct objfile *,
 
 extern void end_psymtab_common (struct objfile *, struct partial_symtab *);
 
-extern struct partial_symtab *allocate_psymtab (const char *,
-                                               struct objfile *)
+/* Allocate a new partial symbol table associated with OBJFILE.
+   FILENAME (which must be non-NULL) is the filename of this partial
+   symbol table; it is copied into the appropriate storage.  A new
+   partial symbol table is returned; aside from "next" and "filename",
+   its fields are initialized to zero.  */
+
+extern struct partial_symtab *allocate_psymtab (const char *filename,
+                                               struct objfile *objfile)
   ATTRIBUTE_NONNULL (1);
 
 extern void discard_psymtab (struct objfile *, struct partial_symtab *);
index d5bd5b1b2db44cd540feda0663f2ea85ca67598c..1a54ea9c8e44c8bd442d21f52eb6698b450b01c1 100644 (file)
@@ -1677,6 +1677,8 @@ init_psymbol_list (struct objfile *objfile, int total_symbols)
   objfile->static_psymbols.reserve (total_symbols / 10);
 }
 
+/* See psympriv.h.  */
+
 struct partial_symtab *
 allocate_psymtab (const char *filename, struct objfile *objfile)
 {
index b8ab292bc3a0ad081d4f8acab408b360130fb9e8..41ff583628a5fb83df8ca388ad3108201c81cf81 100644 (file)
@@ -2103,13 +2103,6 @@ xcoff_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
       subpst->dependencies[0] = pst;
       subpst->number_of_dependencies = 1;
 
-      subpst->globals_offset =
-       subpst->n_global_syms =
-       subpst->statics_offset =
-       subpst->n_static_syms = 0;
-
-      subpst->readin = 0;
-      subpst->compunit_symtab = NULL;
       subpst->read_symtab = pst->read_symtab;
     }