This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [PATCH] cleanup: remove declared variables without any references
- From: "Agovic, Sanimir" <sanimir dot agovic at intel dot com>
- To: 'Mark Kettenis' <mark dot kettenis at xs4all dot nl>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Tue, 11 Feb 2014 15:17:18 +0000
- Subject: RE: [PATCH] cleanup: remove declared variables without any references
- Authentication-results: sourceware.org; auth=none
- References: <1392126951-25347-1-git-send-email-sanimir dot agovic at intel dot com> <201402111412 dot s1BECWEX000161 at glazunov dot sibelius dot xs4all dot nl>
Thanks Mark. I will revert the changes done to mipsnbsd-tdep.c.
> The mipsnbsd-tdep.c one is not ok. For one thing, you're leaving
> behind the comment describing the code.
Indeed, while changing more than 55 files I ended up with mechanical
line deletes without looking at the surrounding code. I will have
a serious look at the upcoming variable cleanups.
5 files left:
* h8300-tdep.c (setmachinelist): Remove global.
* ia64-tdep.c (fp_regnum, lr_regnum): Remove globals.
* ravenscar-thread.c (update_target_observer): Remove global.
* rs6000-tdep.c (rs6000_gdbarch_init): Remove segment_regs.
* symfile-debug.c (debug_sym_fns): Remove global.
-Sanimir
> -----Original Message-----
> From: Mark Kettenis [mailto:mark.kettenis@xs4all.nl]
> Sent: Tuesday, February 11, 2014 03:13 PM
> To: Agovic, Sanimir
> Cc: gdb-patches@sourceware.org
> Subject: Re: [PATCH] cleanup: remove declared variables without any references
>
> > From: Sanimir Agovic <sanimir.agovic@intel.com>
> > Date: Tue, 11 Feb 2014 14:55:51 +0100
> >
> > Hello,
> >
> > I am currently digging through the gdb sources to remove declared variables
> > without any references with the help of a compiler. The findings below are
> > variables with static storage duration. I am uncertain about the removal,
> > thus I like to get feedback.
>
> The cris-tdep.c is ok.
>
> The hppa-tdep.c one is ok; that code got moved to hppa-linux-tdep.c,
> but it looks like a copy was left behind in hppa-tdep.c.
>
> The mipsnbsd-tdep.c one is not ok. For one thing, you're leaving
> behind the comment describing the code. But I think this is better
> left alone, as somebody might want to add (or put back) the missing
> glue that uses those bits.
>
> I'll leave the other ones to people with more intimate knowledge about
> the particular code.
>
>
> > Build pass on x86_64 with --enable-targets=all
> >
> > 2014-02-11 Sanimir Agovic <sanimir.agovic@intel.com>
> >
> > * cris-tdep.c (cris_supply_gregset): Remove zerobuf.
> > (_initialize_cris_tdep): Remove cris_set_cmdlist, cris_show_cmdlist.
> > * h8300-tdep.c (setmachinelist): Remove global.
> > * hppa-tdep.c (hppa_sigtramp): Remove global.
> > * ia64-tdep.c (fp_regnum, lr_regnum): Remove globals.
> > * mipsnbsd-tdep.c (sigtramp_retcode_mipsel, sigtramp_retcode_mipseb):
> > Remove globals.
> > * ravenscar-thread.c (update_target_observer): Remove global.
> > * rs6000-tdep.c (rs6000_gdbarch_init): Remove segment_regs.
> > * symfile-debug.c (debug_sym_fns): Remove global.
> >
> > Change-Id: I4c2aeb3a516c600b8aaedddca562e443d0ae9bc5
> > Signed-off-by: Sanimir Agovic <sanimir.agovic@intel.com>
> > ---
> > gdb/cris-tdep.c | 4 ----
> > gdb/h8300-tdep.c | 2 --
> > gdb/hppa-tdep.c | 12 ------------
> > gdb/ia64-tdep.c | 2 --
> > gdb/mipsnbsd-tdep.c | 14 --------------
> > gdb/ravenscar-thread.c | 2 --
> > gdb/rs6000-tdep.c | 4 ----
> > gdb/symfile-debug.c | 19 -------------------
> > 8 files changed, 59 deletions(-)
> >
> > diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
> > index 78bbfcd..9e3fb78 100644
> > --- a/gdb/cris-tdep.c
> > +++ b/gdb/cris-tdep.c
> > @@ -3830,7 +3830,6 @@ cris_supply_gregset (struct regcache *regcache, cris_elf_gregset_t
> *gregsetp)
> > struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
> > int i;
> > cris_elf_greg_t *regp = *gregsetp;
> > - static char zerobuf[4] = {0};
> >
> > /* The kernel dumps all 32 registers as unsigned longs, but supply_register
> > knows about the actual size of each register so that's no problem. */
> > @@ -3898,9 +3897,6 @@ extern initialize_file_ftype _initialize_cris_tdep; /* -Wmissing-
> prototypes */
> > void
> > _initialize_cris_tdep (void)
> > {
> > - static struct cmd_list_element *cris_set_cmdlist;
> > - static struct cmd_list_element *cris_show_cmdlist;
> > -
> > gdbarch_register (bfd_arch_cris, cris_gdbarch_init, cris_dump_tdep);
> >
> > /* CRIS-specific user-commands. */
> > diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
> > index ffffbc9..648d902 100644
> > --- a/gdb/h8300-tdep.c
> > +++ b/gdb/h8300-tdep.c
> > @@ -937,8 +937,6 @@ h8300h_return_value (struct gdbarch *gdbarch, struct value
> *function,
> > return RETURN_VALUE_REGISTER_CONVENTION;
> > }
> >
> > -static struct cmd_list_element *setmachinelist;
> > -
> > static const char *
> > h8300_register_name (struct gdbarch *gdbarch, int regno)
> > {
> > diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
> > index 8314b4d..9769e6e 100644
> > --- a/gdb/hppa-tdep.c
> > +++ b/gdb/hppa-tdep.c
> > @@ -2770,18 +2770,6 @@ static struct insn_pattern hppa_plt_stub[] = {
> > { 0, 0 }
> > };
> >
> > -static struct insn_pattern hppa_sigtramp[] = {
> > - /* ldi 0, %r25 or ldi 1, %r25 */
> > - { 0x34190000, 0xfffffffd },
> > - /* ldi __NR_rt_sigreturn, %r20 */
> > - { 0x3414015a, 0xffffffff },
> > - /* be,l 0x100(%sr2, %r0), %sr0, %r31 */
> > - { 0xe4008200, 0xffffffff },
> > - /* nop */
> > - { 0x08000240, 0xffffffff },
> > - { 0, 0 }
> > -};
> > -
> > /* Maximum number of instructions on the patterns above. */
> > #define HPPA_MAX_INSN_PATTERN_LEN 4
> >
> > diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
> > index b2f9368..50209a8 100644
> > --- a/gdb/ia64-tdep.c
> > +++ b/gdb/ia64-tdep.c
> > @@ -127,8 +127,6 @@ static CORE_ADDR ia64_find_global_pointer (struct gdbarch *gdbarch,
> > #define NUM_IA64_RAW_REGS 462
> >
> > static int sp_regnum = IA64_GR12_REGNUM;
> > -static int fp_regnum = IA64_VFP_REGNUM;
> > -static int lr_regnum = IA64_VRAP_REGNUM;
> >
> > /* NOTE: we treat the register stack registers r32-r127 as
> > pseudo-registers because they may not be accessible via the ptrace
> > diff --git a/gdb/mipsnbsd-tdep.c b/gdb/mipsnbsd-tdep.c
> > index 4773ae0..b753e36 100644
> > --- a/gdb/mipsnbsd-tdep.c
> > +++ b/gdb/mipsnbsd-tdep.c
> > @@ -230,20 +230,6 @@ mipsnbsd_fill_fpreg (const struct regcache *regcache, char *fpregs,
> int regno)
> > #define RETCODE_NWORDS 3
> > #define RETCODE_SIZE (RETCODE_NWORDS * 4)
> >
> > -static const unsigned char sigtramp_retcode_mipsel[RETCODE_SIZE] =
> > -{
> > - 0x10, 0x00, 0xa4, 0x27, /* addu a0, sp, 16 */
> > - 0x27, 0x01, 0x02, 0x24, /* li v0, 295 */
> > - 0x0c, 0x00, 0x00, 0x00, /* syscall */
> > -};
> > -
> > -static const unsigned char sigtramp_retcode_mipseb[RETCODE_SIZE] =
> > -{
> > - 0x27, 0xa4, 0x00, 0x10, /* addu a0, sp, 16 */
> > - 0x24, 0x02, 0x01, 0x27, /* li v0, 295 */
> > - 0x00, 0x00, 0x00, 0x0c, /* syscall */
> > -};
> > -
> > /* Figure out where the longjmp will land. We expect that we have
> > just entered longjmp and haven't yet setup the stack frame, so the
> > args are still in the argument regs. MIPS_A0_REGNUM points at the
> > diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
> > index e070a1d..a98f8fb 100644
> > --- a/gdb/ravenscar-thread.c
> > +++ b/gdb/ravenscar-thread.c
> > @@ -52,8 +52,6 @@ static const char first_task_name[] =
> "system__tasking__debug__first_task";
> > static const char ravenscar_runtime_initializer[] =
> > "system__bb__threads__initialize";
> >
> > -static struct observer *update_target_observer = NULL;
> > -
> > static void ravenscar_find_new_threads (struct target_ops *ops);
> > static ptid_t ravenscar_running_thread (void);
> > static char *ravenscar_extra_thread_info (struct thread_info *tp);
> > diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
> > index 9f5c3ad..5478cba 100644
> > --- a/gdb/rs6000-tdep.c
> > +++ b/gdb/rs6000-tdep.c
> > @@ -3651,10 +3651,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct
> gdbarch_list *arches)
> > "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
> > "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31"
> > };
> > - static const char *const segment_regs[] = {
> > - "sr0", "sr1", "sr2", "sr3", "sr4", "sr5", "sr6", "sr7",
> > - "sr8", "sr9", "sr10", "sr11", "sr12", "sr13", "sr14", "sr15"
> > - };
> > const struct tdesc_feature *feature;
> > int i, valid_p;
> > static const char *const msr_names[] = { "msr", "ps" };
> > diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c
> > index 705d9cb..a83fd21 100644
> > --- a/gdb/symfile-debug.c
> > +++ b/gdb/symfile-debug.c
> > @@ -532,25 +532,6 @@ debug_sym_relocate (struct objfile *objfile, asection *sectp,
> bfd_byte *buf)
> > return retval;
> > }
> >
> > -/* Template of debugging version of struct sym_fns.
> > - A copy is made, with sym_flavour updated, and a pointer to the real table
> > - installed in real_sf, and then a pointer to the copy is installed in the
> > - objfile. */
> > -
> > -static const struct sym_fns debug_sym_fns =
> > -{
> > - debug_sym_new_init,
> > - debug_sym_init,
> > - debug_sym_read,
> > - debug_sym_read_psymbols,
> > - debug_sym_finish,
> > - debug_sym_offsets,
> > - debug_sym_segments,
> > - debug_sym_read_linetable,
> > - debug_sym_relocate,
> > - &debug_sym_probe_fns,
> > - &debug_sym_quick_functions
> > -};
> >
> > /* Free the copy of sym_fns recorded in the registry. */
> >
> > --
> > 1.8.4.2
> >
> >
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052