analyzer: Fix up -Wunused-variable warning

Message ID afmqmmPODo9EOeMk@tucnak
State New
Headers
Series analyzer: Fix up -Wunused-variable warning |

Commit Message

Jakub Jelinek May 5, 2026, 8:30 a.m. UTC
  Hi!

I've noticed a new
../../gcc/analyzer/kf.cc: In member function ‘virtual void ana::kf_strcasecmp::impl_call_post(const ana::call_details&) const’:
../../gcc/analyzer/kf.cc:2882:12: warning: unused variable ‘lhs_type’ [-Wunused-variable]
warning.
The following patch fixes that.

Ok for trunk?

2026-05-05  Jakub Jelinek  <jakub@redhat.com>

	* kf.cc (kf_strcasecmp::impl_call_post): Remove unused variable.


	Jakub
  

Comments

David Malcolm May 5, 2026, 11:21 a.m. UTC | #1
On Tue, 2026-05-05 at 10:30 +0200, Jakub Jelinek wrote:
> Hi!
> 
> I've noticed a new
> ../../gcc/analyzer/kf.cc: In member function ‘virtual void
> ana::kf_strcasecmp::impl_call_post(const ana::call_details&) const’:
> ../../gcc/analyzer/kf.cc:2882:12: warning: unused variable ‘lhs_type’
> [-Wunused-variable]
> warning.
> The following patch fixes that.
> 
> Ok for trunk?

LGTM, thanks

> 
> 2026-05-05  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* kf.cc (kf_strcasecmp::impl_call_post): Remove unused
> variable.
> 
> --- gcc/analyzer/kf.cc.jj	2026-04-29 07:45:27.925267076 +0200
> +++ gcc/analyzer/kf.cc	2026-05-05 10:27:36.593531697 +0200
> @@ -2879,7 +2879,7 @@ public:
>  void
>  kf_strcasecmp::impl_call_post (const call_details &cd) const
>  {
> -  if (tree lhs_type = cd.get_lhs_type ())
> +  if (cd.get_lhs_type ())
>      {
>        const svalue *result_val
>  	= cd.get_or_create_conjured_svalue (cd.get_lhs_region ());
> 
> 	Jakub
>
  

Patch

--- gcc/analyzer/kf.cc.jj	2026-04-29 07:45:27.925267076 +0200
+++ gcc/analyzer/kf.cc	2026-05-05 10:27:36.593531697 +0200
@@ -2879,7 +2879,7 @@  public:
 void
 kf_strcasecmp::impl_call_post (const call_details &cd) const
 {
-  if (tree lhs_type = cd.get_lhs_type ())
+  if (cd.get_lhs_type ())
     {
       const svalue *result_val
 	= cd.get_or_create_conjured_svalue (cd.get_lhs_region ());