* [PATCH + 12.1] Silence -Wmaybe-uninitialized warning from target_waitstatus
@ 2022-04-07 16:22 Tom Tromey
2022-04-07 16:52 ` Eli Zaretskii
2022-04-14 16:04 ` Tom Tromey
0 siblings, 2 replies; 3+ messages in thread
From: Tom Tromey @ 2022-04-07 16:22 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
Currently, one use of target_waitstatus yields a warning:
target/waitstatus.h: In function 'void stop_all_threads()':
target/waitstatus.h:175:13: warning: 'ws.target_waitstatus::m_value' may be used uninitialized in this function [-Wmaybe-uninitialized]
175 | m_value = other.m_value;
| ~~~~~~~~^~~~~~~~~~~~~~~
This patch silences the warning. I tried the "volatile member"
approach that was used for gdb::optional, but that didn't work, so
this patch simply initializes the member.
---
gdb/target/waitstatus.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/target/waitstatus.h b/gdb/target/waitstatus.h
index 7b5faed83c7..63bbd737749 100644
--- a/gdb/target/waitstatus.h
+++ b/gdb/target/waitstatus.h
@@ -418,7 +418,7 @@ struct target_waitstatus
char *execd_pathname;
/* Syscall number */
int syscall_number;
- } m_value;
+ } m_value {};
};
/* Extended reasons that can explain why a target/thread stopped for a
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH + 12.1] Silence -Wmaybe-uninitialized warning from target_waitstatus
2022-04-07 16:22 [PATCH + 12.1] Silence -Wmaybe-uninitialized warning from target_waitstatus Tom Tromey
@ 2022-04-07 16:52 ` Eli Zaretskii
2022-04-14 16:04 ` Tom Tromey
1 sibling, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2022-04-07 16:52 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
> Date: Thu, 7 Apr 2022 10:22:05 -0600
> From: Tom Tromey via Gdb-patches <gdb-patches@sourceware.org>
> Cc: Tom Tromey <tromey@adacore.com>
>
> Currently, one use of target_waitstatus yields a warning:
>
> target/waitstatus.h: In function 'void stop_all_threads()':
> target/waitstatus.h:175:13: warning: 'ws.target_waitstatus::m_value' may be used uninitialized in this function [-Wmaybe-uninitialized]
> 175 | m_value = other.m_value;
> | ~~~~~~~~^~~~~~~~~~~~~~~
>
> This patch silences the warning. I tried the "volatile member"
> approach that was used for gdb::optional, but that didn't work, so
> this patch simply initializes the member.
> ---
> gdb/target/waitstatus.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
I can confirm that the warning is gone after applying this patch.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH + 12.1] Silence -Wmaybe-uninitialized warning from target_waitstatus
2022-04-07 16:22 [PATCH + 12.1] Silence -Wmaybe-uninitialized warning from target_waitstatus Tom Tromey
2022-04-07 16:52 ` Eli Zaretskii
@ 2022-04-14 16:04 ` Tom Tromey
1 sibling, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2022-04-14 16:04 UTC (permalink / raw)
To: Tom Tromey via Gdb-patches; +Cc: Tom Tromey
>>>>> "Tom" == Tom Tromey via Gdb-patches <gdb-patches@sourceware.org> writes:
Tom> Currently, one use of target_waitstatus yields a warning:
Tom> target/waitstatus.h: In function 'void stop_all_threads()':
Tom> target/waitstatus.h:175:13: warning: 'ws.target_waitstatus::m_value' may be used uninitialized in this function [-Wmaybe-uninitialized]
Tom> 175 | m_value = other.m_value;
Tom> | ~~~~~~~~^~~~~~~~~~~~~~~
Tom> This patch silences the warning. I tried the "volatile member"
Tom> approach that was used for gdb::optional, but that didn't work, so
Tom> this patch simply initializes the member.
I'm going to push this now.
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-14 16:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-07 16:22 [PATCH + 12.1] Silence -Wmaybe-uninitialized warning from target_waitstatus Tom Tromey
2022-04-07 16:52 ` Eli Zaretskii
2022-04-14 16:04 ` Tom Tromey
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).