public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix warning in symtab.c
@ 2021-07-05 17:45 Tom Tromey
  2021-07-05 17:48 ` Simon Marchi
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2021-07-05 17:45 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

The compiler gives this warning when building symtab.c:

../../binutils-gdb/gdb/symtab.c:4247:28: warning: ‘to_match’ may be used uninitialized in this function [-Wmaybe-uninitialized]

This patch fixes the warning by adding a gdb_assert_not_reached.
---
 gdb/symtab.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gdb/symtab.c b/gdb/symtab.c
index 6a9c3dce6af..fa3f42207ec 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -4242,6 +4242,8 @@ info_sources_filter::matches (const char *fullname) const
         case match_on::FULLNAME:
           to_match = fullname;
           break;
+	default:
+	  gdb_assert_not_reached ("bad m_match_type");
         }
 
       if (m_c_regexp->exec (to_match, 0, NULL, 0) != 0)
-- 
2.26.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix warning in symtab.c
  2021-07-05 17:45 [PATCH] Fix warning in symtab.c Tom Tromey
@ 2021-07-05 17:48 ` Simon Marchi
  2021-07-08 19:26   ` Simon Marchi
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Marchi @ 2021-07-05 17:48 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 2021-07-05 1:45 p.m., Tom Tromey wrote:
> The compiler gives this warning when building symtab.c:
> 
> ../../binutils-gdb/gdb/symtab.c:4247:28: warning: ‘to_match’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> 
> This patch fixes the warning by adding a gdb_assert_not_reached.
> ---
>  gdb/symtab.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/gdb/symtab.c b/gdb/symtab.c
> index 6a9c3dce6af..fa3f42207ec 100644
> --- a/gdb/symtab.c
> +++ b/gdb/symtab.c
> @@ -4242,6 +4242,8 @@ info_sources_filter::matches (const char *fullname) const
>          case match_on::FULLNAME:
>            to_match = fullname;
>            break;
> +	default:
> +	  gdb_assert_not_reached ("bad m_match_type");
>          }
>  
>        if (m_c_regexp->exec (to_match, 0, NULL, 0) != 0)
> 

Thanks, that LGTM (and obvious-ish).

Simon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix warning in symtab.c
  2021-07-05 17:48 ` Simon Marchi
@ 2021-07-08 19:26   ` Simon Marchi
  2021-07-11 14:36     ` Joel Brobecker
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Marchi @ 2021-07-08 19:26 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 2021-07-05 1:48 p.m., Simon Marchi via Gdb-patches wrote:> On 2021-07-05 1:45 p.m., Tom Tromey wrote:
>> The compiler gives this warning when building symtab.c:
>>
>> ../../binutils-gdb/gdb/symtab.c:4247:28: warning: ‘to_match’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>>
>> This patch fixes the warning by adding a gdb_assert_not_reached.
>> ---
>>  gdb/symtab.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/gdb/symtab.c b/gdb/symtab.c
>> index 6a9c3dce6af..fa3f42207ec 100644
>> --- a/gdb/symtab.c
>> +++ b/gdb/symtab.c
>> @@ -4242,6 +4242,8 @@ info_sources_filter::matches (const char *fullname) const
>>          case match_on::FULLNAME:
>>            to_match = fullname;
>>            break;
>> +	default:
>> +	  gdb_assert_not_reached ("bad m_match_type");
>>          }
>>  
>>        if (m_c_regexp->exec (to_match, 0, NULL, 0) != 0)
>>
> 
> Thanks, that LGTM (and obvious-ish).

Hi Tom,

When you push this, it would be good to push it to the gdb-11-branch as
well (with a ChangeLog entry).  See:

  https://sourceware.org/pipermail/gdb-patches/2021-July/180781.html

Thanks,

Simon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix warning in symtab.c
  2021-07-08 19:26   ` Simon Marchi
@ 2021-07-11 14:36     ` Joel Brobecker
  0 siblings, 0 replies; 4+ messages in thread
From: Joel Brobecker @ 2021-07-11 14:36 UTC (permalink / raw)
  To: Simon Marchi via Gdb-patches; +Cc: Tom Tromey, Joel Brobecker

> When you push this, it would be good to push it to the gdb-11-branch as
> well (with a ChangeLog entry).  See:
> 
>   https://sourceware.org/pipermail/gdb-patches/2021-July/180781.html

All taken care of :).

-- 
Joel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-11 14:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-05 17:45 [PATCH] Fix warning in symtab.c Tom Tromey
2021-07-05 17:48 ` Simon Marchi
2021-07-08 19:26   ` Simon Marchi
2021-07-11 14:36     ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).