Move within_function to stabsread
authorTom Tromey <tom@tromey.com>
Sun, 20 May 2018 17:19:14 +0000 (11:19 -0600)
committerTom Tromey <tom@tromey.com>
Mon, 16 Jul 2018 14:55:18 +0000 (08:55 -0600)
The global within_function is only used by a few symbol readers.  This
patch moves the global out of buildsym and into stabsread, which
seemed like a better fit.  It also arranges for the existing readers
to clear the global at the appropriate time.

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

* stabsread.h (within_function): Move from buildsym.h.
* stabsread.c (start_stabs): Clear within_function.
* coffread.c (coff_start_symtab): Clear within_function.
* buildsym.h (within_function): Move to stabsread.h.
* buildsym.c (prepare_for_building): Update.

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

index f43ab29eab9130c3f1f2e782fccf105cb78c4447..74573a8f83c31be2ed8afc575b10ec60c9e0536e 100644 (file)
@@ -1,3 +1,11 @@
+2018-07-16  Tom Tromey  <tom@tromey.com>
+
+       * stabsread.h (within_function): Move from buildsym.h.
+       * stabsread.c (start_stabs): Clear within_function.
+       * coffread.c (coff_start_symtab): Clear within_function.
+       * buildsym.h (within_function): Move to stabsread.h.
+       * buildsym.c (prepare_for_building): Update.
+
 2018-07-16  Tom Tromey  <tom@tromey.com>
 
        * stabsread.h (processing_gcc_compilation): Move from buildsym.h.
index f2176e2732418121131a6678ab0cd5bc5bd21054..fea43645e7c87f2c80e79e49ab4736d49c5cf453 100644 (file)
@@ -1031,7 +1031,6 @@ prepare_for_building ()
 {
   local_symbols = NULL;
   local_using_directives = NULL;
-  within_function = 0;
 
   context_stack_depth = 0;
 
index 01d9acc2c9631c7ce086a5708ab30ad3588a4519..a6bed3c6119172f2b9cd3a25450b60319f16d002 100644 (file)
@@ -150,11 +150,6 @@ EXTERN int context_stack_depth;
 /* Non-zero if the context stack is empty.  */
 #define outermost_context_p() (context_stack_depth == 0)
 
-/* Nonzero if within a function (so symbols should be local, if
-   nothing says specifically).  */
-
-EXTERN int within_function;
-
 /* The type of the record_line function.  */
 typedef void (record_line_ftype) (struct subfile *subfile, int line,
                                  CORE_ADDR pc);
index 0b0cbace6ba709b71fa2b70b1d6e2946b5132b9e..0ba5bab60dcf270cea43eb19d5eb2bd4d245c46e 100644 (file)
@@ -383,6 +383,7 @@ coff_alloc_type (int index)
 static void
 coff_start_symtab (struct objfile *objfile, const char *name)
 {
+  within_function = 0;
   start_symtab (objfile,
   /* We fill in the filename later.  start_symtab puts this pointer
      into last_source_file and we put it in subfiles->name, which
index e4513c699be58b7cd51d4e73348b8eeca5d06719..a260fc76b5619b634d8d8f41e99103cfb91014e6 100644 (file)
@@ -4758,6 +4758,7 @@ start_stabs (void)
   n_this_object_header_files = 1;
   type_vector_length = 0;
   type_vector = (struct type **) 0;
+  within_function = 0;
 
   /* FIXME: If common_block_name is not already NULL, we should complain().  */
   common_block_name = NULL;
index 0da88f4142f54dcd52aa6c6ac5cf2f12d3a8fba7..34c6738813dd727b53d08e14df7c920d4e4bdbcf 100644 (file)
@@ -53,6 +53,11 @@ EXTERN const char *(*next_symbol_text_func) (struct objfile *);
 
 EXTERN unsigned char processing_gcc_compilation;
 
+/* Nonzero if within a function (so symbols should be local, if
+   nothing says specifically).  */
+
+EXTERN int within_function;
+
 /* 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.033318 seconds and 4 git commands to generate.