From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id D389B3857827; Thu, 14 Apr 2022 16:19:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D389B3857827 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Silence -Wmaybe-uninitialized warning from target_waitstatus X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 7ae6857316e020467f84645ba7c1c5ec6c085bd9 X-Git-Newrev: 4536b3bb61fd2fc7b3482cdc8d03a2542cdf5d9e Message-Id: <20220414161900.D389B3857827@sourceware.org> Date: Thu, 14 Apr 2022 16:19:00 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Apr 2022 16:19:00 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D4536b3bb61fd= 2fc7b3482cdc8d03a2542cdf5d9e commit 4536b3bb61fd2fc7b3482cdc8d03a2542cdf5d9e Author: Tom Tromey Date: Thu Apr 7 10:17:02 2022 -0600 Silence -Wmaybe-uninitialized warning from target_waitstatus =20 Currently, one use of target_waitstatus yields a warning: =20 target/waitstatus.h: In function 'void stop_all_threads()': target/waitstatus.h:175:13: warning: 'ws.target_waitstatus::m_valu= e' may be used uninitialized in this function [-Wmaybe-uninitialized] 175 | m_value =3D other.m_value; | ~~~~~~~~^~~~~~~~~~~~~~~ =20 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. Diff: --- 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 @@ private: char *execd_pathname; /* Syscall number */ int syscall_number; - } m_value; + } m_value {}; }; =20 /* Extended reasons that can explain why a target/thread stopped for a