Remove unused str_backtrace_unavailable variable

Message ID 20260501073117.2962398-1-luis.machado@amd.com
State New
Headers
Series Remove unused str_backtrace_unavailable variable |

Commit Message

Machado, Luis May 1, 2026, 7:31 a.m. UTC
  The str_backtrace_unavailable variable is initialized but never
used anywhere in the codebase.
---
 gdb/bt-utils.c | 2 --
 1 file changed, 2 deletions(-)
  

Comments

Tom Tromey May 1, 2026, 12:59 p.m. UTC | #1
>>>>> "Luis" == Luis Machado <luis.machado@amd.com> writes:

Luis> The str_backtrace_unavailable variable is initialized but never
Luis> used anywhere in the codebase.

Thanks.

Approved-By: Tom Tromey <tom@tromey.com>

Tom
  
Simon Marchi May 1, 2026, 2:17 p.m. UTC | #2
On 5/1/26 3:31 AM, Luis Machado wrote:
> The str_backtrace_unavailable variable is initialized but never
> used anywhere in the codebase.
> ---
>  gdb/bt-utils.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/gdb/bt-utils.c b/gdb/bt-utils.c
> index 7fc8d04f306..21a291c3df3 100644
> --- a/gdb/bt-utils.c
> +++ b/gdb/bt-utils.c
> @@ -146,7 +146,6 @@ gdb_internal_backtrace_1 ()
>  #endif
>  
>  static const char *str_backtrace = "----- Backtrace -----\n";
> -static const char *str_backtrace_unavailable = "Backtrace unavailable\n";
>  
>  #endif /* GDB_PRINT_INTERNAL_BACKTRACE */
>  
> @@ -157,7 +156,6 @@ gdb_internal_backtrace_init_str ()
>  {
>  #ifdef GDB_PRINT_INTERNAL_BACKTRACE
>    str_backtrace = _("----- Backtrace -----\n");
> -  str_backtrace_unavailable = _("Backtrace unavailable\n");
>  #endif
>  }

Seems quite obvious to me, but I would wait for Andrew to confirm that
this wasn't meant to be used somewhere.  For instance, in the
libbacktrace_error function.  But I think the message there is clear, so
I'd be fine with just deleting the variable.

Simon
  
Luis May 1, 2026, 2:20 p.m. UTC | #3
On 01/05/2026 15:17, Simon Marchi wrote:
> On 5/1/26 3:31 AM, Luis Machado wrote:
>> The str_backtrace_unavailable variable is initialized but never
>> used anywhere in the codebase.
>> ---
>>   gdb/bt-utils.c | 2 --
>>   1 file changed, 2 deletions(-)
>>
>> diff --git a/gdb/bt-utils.c b/gdb/bt-utils.c
>> index 7fc8d04f306..21a291c3df3 100644
>> --- a/gdb/bt-utils.c
>> +++ b/gdb/bt-utils.c
>> @@ -146,7 +146,6 @@ gdb_internal_backtrace_1 ()
>>   #endif
>>   
>>   static const char *str_backtrace = "----- Backtrace -----\n";
>> -static const char *str_backtrace_unavailable = "Backtrace unavailable\n";
>>   
>>   #endif /* GDB_PRINT_INTERNAL_BACKTRACE */
>>   
>> @@ -157,7 +156,6 @@ gdb_internal_backtrace_init_str ()
>>   {
>>   #ifdef GDB_PRINT_INTERNAL_BACKTRACE
>>     str_backtrace = _("----- Backtrace -----\n");
>> -  str_backtrace_unavailable = _("Backtrace unavailable\n");
>>   #endif
>>   }
> 
> Seems quite obvious to me, but I would wait for Andrew to confirm that
> this wasn't meant to be used somewhere.  For instance, in the
> libbacktrace_error function.  But I think the message there is clear, so
> I'd be fine with just deleting the variable.

Sorry, I just pushed this. But we can still wait for Andrew to chime in 
and tell us otherwise.
  
Tom Tromey May 1, 2026, 3:50 p.m. UTC | #4
>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

Simon> Seems quite obvious to me, but I would wait for Andrew to confirm that
Simon> this wasn't meant to be used somewhere.  For instance, in the
Simon> libbacktrace_error function.  But I think the message there is clear, so
Simon> I'd be fine with just deleting the variable.

I considered this before approving but my view is that if it is needed,
it is trivial to revert a deletion like this.

I'd generally consider the removal of an unused object to be obvious,
with the caveats:

1. If it looks like maybe it *ought* to be used, then send an RFA
   instead;
2. Be sure to check Insight as it uses a few things that are otherwise
   unused.

Tom
  
Machado, Luis May 1, 2026, 3:58 p.m. UTC | #5
Thanks for the heads up on Insight. For context, this came up when using llvm.

It got grumpy about the unused-but-initialized value.
  

Patch

diff --git a/gdb/bt-utils.c b/gdb/bt-utils.c
index 7fc8d04f306..21a291c3df3 100644
--- a/gdb/bt-utils.c
+++ b/gdb/bt-utils.c
@@ -146,7 +146,6 @@  gdb_internal_backtrace_1 ()
 #endif
 
 static const char *str_backtrace = "----- Backtrace -----\n";
-static const char *str_backtrace_unavailable = "Backtrace unavailable\n";
 
 #endif /* GDB_PRINT_INTERNAL_BACKTRACE */
 
@@ -157,7 +156,6 @@  gdb_internal_backtrace_init_str ()
 {
 #ifdef GDB_PRINT_INTERNAL_BACKTRACE
   str_backtrace = _("----- Backtrace -----\n");
-  str_backtrace_unavailable = _("Backtrace unavailable\n");
 #endif
 }