[RFA,3/6] Comment out some unused overlay code

Message ID 1465248812-23902-4-git-send-email-tom@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey June 6, 2016, 9:33 p.m. UTC
  This patch comments out some unneeded initializations in overlay code
in symfile.c.  Normally I would not comment out code like this, but
the uses of "size" in these functions are commented out.  If you'd
prefer I could just delete the comments.

2016-06-06  Tom Tromey  <tom@tromey.com>

	* symfile.c (simple_overlay_update_1): Comment out initialization
	of "size".
	(simple_overlay_update): Likewise.
---
 gdb/ChangeLog | 6 ++++++
 gdb/symfile.c | 8 ++++----
 2 files changed, 10 insertions(+), 4 deletions(-)
  

Comments

Yao Qi June 28, 2016, 2:36 p.m. UTC | #1
On Mon, Jun 6, 2016 at 10:33 PM, Tom Tromey <tom@tromey.com> wrote:
> This patch comments out some unneeded initializations in overlay code
> in symfile.c.  Normally I would not comment out code like this, but
> the uses of "size" in these functions are commented out.  If you'd
> prefer I could just delete the comments.

I am inclined to remove these commented-out statements.

These statements were commented out in 1998, and nobody wanted to add
them back again since then,

Fri Jan 23 07:47:06 1998  Fred Fish  <fnf@cygnus.com>

        * config/d10v/tm-d10v.h (CALL_DUMMY): Define as "{ 0 }".
        (TARGET_READ_FP): Define to d10v_read_fp rather than d10v_read_sp.
        (TARGET_WRITE_FP): Define to d10v_write_fp rather than d10v_write_sp.
        (d10v_write_fp, d10v_read_fp): Add prototypes.
        * symtab.c (decode_line_1): Remove assignment of sals[0].pc field.
        * symfile.c (simple_overlay_update, simple_overlay_update_1):
        Ignore the size of overlay sections.  This check is redundant anyway.
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fbd7051..9839c55 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@ 
 2016-06-06  Tom Tromey  <tom@tromey.com>
 
+	* symfile.c (simple_overlay_update_1): Comment out initialization
+	of "size".
+	(simple_overlay_update): Likewise.
+
+2016-06-06  Tom Tromey  <tom@tromey.com>
+
 	* tui/tui-winsource.c (tui_show_source_line): Use
 	ATTRIBUTE_UNUSED.
 	* tui/tui-io.c (tui_puts): Use ATTRIBUTE_UNUSED.
diff --git a/gdb/symfile.c b/gdb/symfile.c
index b244332..5de2cbf 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -3630,14 +3630,14 @@  simple_read_overlay_table (void)
 static int
 simple_overlay_update_1 (struct obj_section *osect)
 {
-  int i, size;
+  int i;
   bfd *obfd = osect->objfile->obfd;
   asection *bsect = osect->the_bfd_section;
   struct gdbarch *gdbarch = get_objfile_arch (osect->objfile);
   int word_size = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
 
-  size = bfd_get_section_size (osect->the_bfd_section);
+  /* size = bfd_get_section_size (osect->the_bfd_section); */
   for (i = 0; i < cache_novlys; i++)
     if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect)
 	&& cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect)
@@ -3706,11 +3706,11 @@  simple_overlay_update (struct obj_section *osect)
   ALL_OBJSECTIONS (objfile, osect)
     if (section_is_overlay (osect))
     {
-      int i, size;
+      int i;
       bfd *obfd = osect->objfile->obfd;
       asection *bsect = osect->the_bfd_section;
 
-      size = bfd_get_section_size (bsect);
+      /* size = bfd_get_section_size (bsect); */
       for (i = 0; i < cache_novlys; i++)
 	if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect)
 	    && cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect)