Move some code from buildsym to stabsread
authorTom Tromey <tom@tromey.com>
Sun, 20 May 2018 17:13:12 +0000 (11:13 -0600)
committerTom Tromey <tom@tromey.com>
Mon, 16 Jul 2018 14:55:17 +0000 (08:55 -0600)
A few things that currently reside in buildsym.c turn out to be
specific to the stabs reader.  This patch moves these from
buildsym.[ch] to stabsread.[ch].

gdb/ChangeLog
2018-07-16  Tom Tromey  <tom@tromey.com>

* stabsread.h (HASHSIZE, hashname, symnum, next_symbol_text)
(next_symbol_text_func): Move from buildsym.h.
* stabsread.c (hashname): Move from buildsym.c.
* buildsym.h (HASHSIZE, symnum, next_symbol_text)
(next_symbol_text_func, hashname): Move to stabsread.h.
* buildsym.c: Don't include bcache.h
(hashname): Move to stasbread.c.

gdb/ChangeLog
gdb/buildsym.c
gdb/buildsym.h
gdb/stabsread.c
gdb/stabsread.h

index 39936a407576087f226c9c73f7434c5d856714cd..ad72cd8b2682675992cfec80ad5d721a64da3006 100644 (file)
@@ -1,3 +1,13 @@
+2018-07-16  Tom Tromey  <tom@tromey.com>
+
+       * stabsread.h (HASHSIZE, hashname, symnum, next_symbol_text)
+       (next_symbol_text_func): Move from buildsym.h.
+       * stabsread.c (hashname): Move from buildsym.c.
+       * buildsym.h (HASHSIZE, symnum, next_symbol_text)
+       (next_symbol_text_func, hashname): Move to stabsread.h.
+       * buildsym.c: Don't include bcache.h
+       (hashname): Move to stasbread.c.
+
 2018-07-16  Tom Tromey  <tom@tromey.com>
 
        * buildsym.h (context_stack_size): Don't declare.
index 26c511086bbd15de87697c7270057d29701ad450..f2176e2732418121131a6678ab0cd5bc5bd21054 100644 (file)
@@ -74,7 +74,6 @@
 #include "gdbtypes.h"
 #include "complaints.h"
 #include "expression.h"                /* For "enum exp_opcode" used by...  */
-#include "bcache.h"
 #include "filenames.h"         /* For DOSish file names.  */
 #include "macrotab.h"
 #include "demangle.h"          /* Needed by SYMBOL_INIT_DEMANGLED_NAME.  */
@@ -1667,15 +1666,6 @@ pop_context (void)
 
 \f
 
-/* Compute a small integer hash code for the given name.  */
-
-int
-hashname (const char *name)
-{
-    return (hash(name,strlen(name)) % HASHSIZE);
-}
-\f
-
 void
 record_debugformat (const char *format)
 {
index 191db8ca4fadb7b972eed0d165090ab929b40f5f..0b19c3930528b302c5cb73ddfc8264e8d6863ecd 100644 (file)
@@ -46,9 +46,6 @@ struct dynamic_prop;
 #define        EXTERN extern
 #endif
 
-#define HASHSIZE 127           /* Size of things hashed via
-                                  hashname().  */
-
 /* The list of sub-source-files within the current individual
    compilation.  Each file gets its own symtab with its own linetable
    and associated info, but they all share one blockvector.  */
@@ -74,10 +71,6 @@ EXTERN struct subfile *current_subfile;
 
 EXTERN unsigned char processing_gcc_compilation;
 
-/* Count symbols as they are processed, for error messages.  */
-
-EXTERN unsigned int symnum;
-
 /* Record the symbols defined for each context in a list.  We don't
    create a struct block for the context until we know how long to
    make it.  */
@@ -173,12 +166,6 @@ typedef void (record_line_ftype) (struct subfile *subfile, int line,
 
 \f
 
-#define next_symbol_text(objfile) (*next_symbol_text_func)(objfile)
-
-/* Function to invoke get the next symbol.  Return the symbol name.  */
-
-EXTERN const char *(*next_symbol_text_func) (struct objfile *);
-
 extern void add_symbol_to_list (struct symbol *symbol,
                                struct pending **listhead);
 
@@ -251,8 +238,6 @@ extern struct compunit_symtab *start_symtab (struct objfile *objfile,
 extern void restart_symtab (struct compunit_symtab *cust,
                            const char *name, CORE_ADDR start_addr);
 
-extern int hashname (const char *name);
-
 extern void free_pending_blocks (void);
 
 /* Record the name of the debug format in the current pending symbol
index ed4a3d3181fd89fef2978dfcffeab27a87b261ef..e4513c699be58b7cd51d4e73348b8eeca5d06719 100644 (file)
@@ -44,6 +44,7 @@
 #include "target-float.h"
 #include "cp-abi.h"
 #include "cp-support.h"
+#include "bcache.h"
 #include <ctype.h>
 
 /* Ask stabsread.h to define the vars it normally declares `extern'.  */
@@ -4814,6 +4815,14 @@ find_name_end (const char *name)
     }
 }
 
+/* See stabsread.h.  */
+
+int
+hashname (const char *name)
+{
+  return hash (name, strlen (name)) % HASHSIZE;
+}
+
 /* Initializer for this module.  */
 
 void
index d24b25dc72c5f824c240b3d97faf3af2872dc005..38e001a25458b2f2344b175802ea02e80442c3c3 100644 (file)
@@ -31,6 +31,23 @@ enum language;
 #define        EXTERN extern
 #endif
 
+#define HASHSIZE 127           /* Size of things hashed via
+                                  hashname().  */
+
+/* Compute a small integer hash code for the given name.  */
+
+extern int hashname (const char *name);
+
+/* Count symbols as they are processed, for error messages.  */
+
+EXTERN unsigned int symnum;
+
+#define next_symbol_text(objfile) (*next_symbol_text_func)(objfile)
+
+/* Function to invoke get the next symbol.  Return the symbol name.  */
+
+EXTERN const char *(*next_symbol_text_func) (struct objfile *);
+
 /* Hash table of global symbols whose values are not known yet.
    They are chained thru the SYMBOL_VALUE_CHAIN, since we don't
    have the correct data for that slot yet.
This page took 0.034018 seconds and 4 git commands to generate.