QProcess: work around GCC 13 -Wmaybe-uninitialized in -unity-build

When in a unity-build GCC 13 sees the implementation of
forkfd_wait4(), called dfrom forkfd_wait(), it can prove that there
are paths that do not initialize *info: Those paths are the returns
following fcntl() in system_forkfs_wait() in forkd_linux.c and read()
in forkfd_wait4().

To work around the issue and unbreak unity-builds, initialize info = {}.

Task-number: QTBUG-119081
Pick-to: 6.5
Change-Id: I1b3504e7f83c766ebccc851233d4c3e677bf2acd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 635774fc324f079a41e2cecbcfdb700bf171ab6c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2023-11-17 15:49:25 +01:00 committed by Qt Cherry-pick Bot
parent c298d56993
commit 6710ec26de

View File

@ -1104,7 +1104,8 @@ void QProcessPrivate::waitForDeadChild()
Q_ASSERT(forkfd != -1);
// read the process information from our fd
forkfd_info info;
forkfd_info info = {}; // Silence -Wmaybe-uninitialized; Thiago says forkfd_wait cannot fail here
// (QTBUG-119081)
int ret;
EINTR_LOOP(ret, forkfd_wait(forkfd, &info, nullptr));