Fix -Wunused-variable warnings related to conditional compilation
authorSimon Marchi <simon.marchi@polymtl.ca>
Sun, 22 Jul 2018 02:21:57 +0000 (22:21 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Sun, 22 Jul 2018 02:23:33 +0000 (22:23 -0400)
Some variables are not used when !HAVE_ELF, so avoid declaring them in
that case.

gdb/ChangeLog:

* arm-tdep.c (arm_gdbarch_init): Declare attr_arch and
attr_profile in HAVE_ELF.
* rs6000-tdep.c (bfd_uses_spe_extensions): Declare vector_abi in
HAVE_ELF.

gdb/ChangeLog
gdb/arm-tdep.c
gdb/rs6000-tdep.c

index 68c3bb35b5eb2f5dc56f74e6bc49697df066de09..f76f92d88c5acf02966cb0cb13459a3c681a8b6d 100644 (file)
@@ -1,3 +1,10 @@
+2018-07-21  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * arm-tdep.c (arm_gdbarch_init): Declare attr_arch and
+       attr_profile in HAVE_ELF.
+       * rs6000-tdep.c (bfd_uses_spe_extensions): Declare vector_abi in
+       HAVE_ELF.
+
 2018-07-20  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * frame.c (frame_register_unwind): Change parameter name.
index fdfb360f5cc1af5b0941c232720e3462be32ab01..049a887b460d65e01aad120b2852a48e65931aeb 100644 (file)
@@ -8955,7 +8955,6 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
          else if (ei_osabi == ELFOSABI_NONE || ei_osabi == ELFOSABI_GNU)
            {
              int eabi_ver = EF_ARM_EABI_VERSION (e_flags);
-             int attr_arch, attr_profile;
 
              switch (eabi_ver)
                {
@@ -9026,11 +9025,13 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
                 executable file includes build attributes; GCC does
                 copy them to the executable, but e.g. RealView does
                 not.  */
-             attr_arch = bfd_elf_get_obj_attr_int (info.abfd, OBJ_ATTR_PROC,
-                                                   Tag_CPU_arch);
-             attr_profile = bfd_elf_get_obj_attr_int (info.abfd,
-                                                      OBJ_ATTR_PROC,
-                                                      Tag_CPU_arch_profile);
+             int attr_arch
+               = bfd_elf_get_obj_attr_int (info.abfd, OBJ_ATTR_PROC,
+                                           Tag_CPU_arch);
+             int attr_profile
+               = bfd_elf_get_obj_attr_int (info.abfd, OBJ_ATTR_PROC,
+                                           Tag_CPU_arch_profile);
+
              /* GCC specifies the profile for v6-M; RealView only
                 specifies the profile for architectures starting with
                 V7 (as opposed to architectures with a tag
index 45bf98267a99a1c8990f7b0b0f0788dd7b0e03d3..e78de49b2e69808966fa77d0e1ba3b071dfe540e 100644 (file)
@@ -3558,7 +3558,6 @@ bfd_uses_spe_extensions (bfd *abfd)
   bfd_size_type size;
   gdb_byte *ptr;
   int success = 0;
-  int vector_abi;
 
   if (!abfd)
     return 0;
@@ -3567,8 +3566,8 @@ bfd_uses_spe_extensions (bfd *abfd)
   /* Using Tag_GNU_Power_ABI_Vector here is a bit of a hack, as the user
      could be using the SPE vector abi without actually using any spe
      bits whatsoever.  But it's close enough for now.  */
-  vector_abi = bfd_elf_get_obj_attr_int (abfd, OBJ_ATTR_GNU,
-                                        Tag_GNU_Power_ABI_Vector);
+  int vector_abi = bfd_elf_get_obj_attr_int (abfd, OBJ_ATTR_GNU,
+                                            Tag_GNU_Power_ABI_Vector);
   if (vector_abi == 3)
     return 1;
 #endif