[COMMITTED] Fix unused variable warning (was: [PATCH 1/3] STABS: remove -gstabs and -gxcoff functionality)

Message ID 20220914121921.j46kmn2btdwmj3sc@lug-owl.de
State New, archived
Headers
Series [COMMITTED] Fix unused variable warning (was: [PATCH 1/3] STABS: remove -gstabs and -gxcoff functionality) |

Commit Message

Jan-Benedict Glaw Sept. 14, 2022, 12:19 p.m. UTC
  On Thu, 2022-09-01 12:05:23 +0200, Martin Liška <mliska@suse.cz> wrote:
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> 
> I've also built all cross compilers.
> 
> Ready to be installed?
> Thanks,
> Martin
> 
> gcc/ChangeLog:
> 
> 	* Makefile.in: Remove -gstabs option support, DBX-related
> 	  macros and DBX debugging info support.
[...]
> 	* config/mips/mips.cc (mips_output_filename): Likewise.
> 	(mips_option_override): Likewise.
[...]
> diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc
> index e81a245dcf4..47724950c3e 100644
> --- a/gcc/config/mips/mips.cc
> +++ b/gcc/config/mips/mips.cc
[...]
> @@ -20505,24 +20500,13 @@ mips_option_override (void)
>  
>    for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
>      {
> -      mips_dbx_regno[i] = IGNORED_DWARF_REGNUM;
>        if (GP_REG_P (i) || FP_REG_P (i) || ALL_COP_REG_P (i))
>  	mips_dwarf_regno[i] = i;
>        else
>  	mips_dwarf_regno[i] = INVALID_REGNUM;
>      }
>  
> -  start = GP_DBX_FIRST - GP_REG_FIRST;
> -  for (i = GP_REG_FIRST; i <= GP_REG_LAST; i++)
> -    mips_dbx_regno[i] = i + start;
> -
> -  start = FP_DBX_FIRST - FP_REG_FIRST;
> -  for (i = FP_REG_FIRST; i <= FP_REG_LAST; i++)
> -    mips_dbx_regno[i] = i + start;
> -
>    /* Accumulator debug registers use big-endian ordering.  */
> -  mips_dbx_regno[HI_REGNUM] = MD_DBX_FIRST + 0;
> -  mips_dbx_regno[LO_REGNUM] = MD_DBX_FIRST + 1;
>    mips_dwarf_regno[HI_REGNUM] = MD_REG_FIRST + 0;
>    mips_dwarf_regno[LO_REGNUM] = MD_REG_FIRST + 1;
>    for (i = DSP_ACC_REG_FIRST; i <= DSP_ACC_REG_LAST; i += 2)

This leaves the `start` variable unused, resulting in a new warning.
Fixed (committed as obvious) by this:

/usr/lib/gcc-snapshot/bin/g++  -fno-PIE -c   -g -O2   -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libcody  -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/gcc/../libbacktrace   -o mips.o -MT mips.o -MMD -MP -MF ./.deps/mips.TPo ../../gcc/gcc/config/mips/mips.cc
../../gcc/gcc/config/mips/mips.cc: In function 'void mips_option_override()':
../../gcc/gcc/config/mips/mips.cc:20021:10: error: unused variable 'start' [-Werror=unused-variable]
20021 |   int i, start, regno, mode;
      |          ^~~~~

2022-09-14  Jan-Benedict Glaw  <jbglaw@lug-owl.de>

gcc/
	* config/mips/mips.cc (mips_option_override): Drop unused variable.



Committed as obvious.

MfG, JBG

--
  

Comments

Martin Liška Sept. 14, 2022, 1:20 p.m. UTC | #1
On 9/14/22 14:19, Jan-Benedict Glaw wrote:
> On Thu, 2022-09-01 12:05:23 +0200, Martin Liška <mliska@suse.cz> wrote:
>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>
>> I've also built all cross compilers.
>>
>> Ready to be installed?
>> Thanks,
>> Martin
>>
>> gcc/ChangeLog:
>>
>> 	* Makefile.in: Remove -gstabs option support, DBX-related
>> 	  macros and DBX debugging info support.
> [...]
>> 	* config/mips/mips.cc (mips_output_filename): Likewise.
>> 	(mips_option_override): Likewise.
> [...]
>> diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc
>> index e81a245dcf4..47724950c3e 100644
>> --- a/gcc/config/mips/mips.cc
>> +++ b/gcc/config/mips/mips.cc
> [...]
>> @@ -20505,24 +20500,13 @@ mips_option_override (void)
>>  
>>    for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
>>      {
>> -      mips_dbx_regno[i] = IGNORED_DWARF_REGNUM;
>>        if (GP_REG_P (i) || FP_REG_P (i) || ALL_COP_REG_P (i))
>>  	mips_dwarf_regno[i] = i;
>>        else
>>  	mips_dwarf_regno[i] = INVALID_REGNUM;
>>      }
>>  
>> -  start = GP_DBX_FIRST - GP_REG_FIRST;
>> -  for (i = GP_REG_FIRST; i <= GP_REG_LAST; i++)
>> -    mips_dbx_regno[i] = i + start;
>> -
>> -  start = FP_DBX_FIRST - FP_REG_FIRST;
>> -  for (i = FP_REG_FIRST; i <= FP_REG_LAST; i++)
>> -    mips_dbx_regno[i] = i + start;
>> -
>>    /* Accumulator debug registers use big-endian ordering.  */
>> -  mips_dbx_regno[HI_REGNUM] = MD_DBX_FIRST + 0;
>> -  mips_dbx_regno[LO_REGNUM] = MD_DBX_FIRST + 1;
>>    mips_dwarf_regno[HI_REGNUM] = MD_REG_FIRST + 0;
>>    mips_dwarf_regno[LO_REGNUM] = MD_REG_FIRST + 1;
>>    for (i = DSP_ACC_REG_FIRST; i <= DSP_ACC_REG_LAST; i += 2)
> 
> This leaves the `start` variable unused, resulting in a new warning.
> Fixed (committed as obvious) by this:
> 
> /usr/lib/gcc-snapshot/bin/g++  -fno-PIE -c   -g -O2   -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libcody  -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/gcc/../libbacktrace   -o mips.o -MT mips.o -MMD -MP -MF ./.deps/mips.TPo ../../gcc/gcc/config/mips/mips.cc
> ../../gcc/gcc/config/mips/mips.cc: In function 'void mips_option_override()':
> ../../gcc/gcc/config/mips/mips.cc:20021:10: error: unused variable 'start' [-Werror=unused-variable]
> 20021 |   int i, start, regno, mode;
>       |          ^~~~~
> 
> 2022-09-14  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
> 
> gcc/
> 	* config/mips/mips.cc (mips_option_override): Drop unused variable.
> 
> diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc
> index 47724950c3e..387376b3df8 100644
> --- a/gcc/config/mips/mips.cc
> +++ b/gcc/config/mips/mips.cc
> @@ -20018,7 +20018,7 @@ mips_set_tune (const struct mips_cpu_info *info)
>  static void
>  mips_option_override (void)
>  {
> -  int i, start, regno, mode;
> +  int i, regno, mode;
>  
>    if (OPTION_SET_P (mips_isa_option))
>      mips_isa_option_info = &mips_cpu_info_table[mips_isa_option];
> 
> 
> Committed as obvious.
> 
> MfG, JBG
> 

Thanks for the commit!

Cheers,
Martin
  

Patch

diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc
index 47724950c3e..387376b3df8 100644
--- a/gcc/config/mips/mips.cc
+++ b/gcc/config/mips/mips.cc
@@ -20018,7 +20018,7 @@  mips_set_tune (const struct mips_cpu_info *info)
 static void
 mips_option_override (void)
 {
-  int i, start, regno, mode;
+  int i, regno, mode;
 
   if (OPTION_SET_P (mips_isa_option))
     mips_isa_option_info = &mips_cpu_info_table[mips_isa_option];