QProcess: build forkfd as C code

forkfd_qt.cpp was originally created so we could use the Qt atomic
classes back when we couldn't rely on C11. We now can, so that primary
reason is gone. We only need it now to set NDEBUG, which the Qt build
doesn't set by default, and _GNU_SOURCE to match forkfd.c itself (GCC
and Clang define it by default in C++ mode because libstdc++ apparently
needs that).

Amends 993db5a12227b1e4067714ddc626d64a14474a54 and thus avoids a new
Clang 18 warning about using VLAs in C++ code:

 forkfd_linux.c:160:50: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension]

Pick-to: 6.6
Change-Id: I5f663c2f9f4149af84fefffd17bed82d39be4d78
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 05408055d52f3fe014fef3c550820011fa8b89f7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2024-03-25 13:42:21 -04:00 committed by Qt Cherry-pick Bot
parent 6aedc439c6
commit bce02faa5f
2 changed files with 4 additions and 1 deletions

View File

@ -992,7 +992,7 @@ qt_internal_extend_target(Core CONDITION QT_FEATURE_filesystemiterator AND WIN32
qt_internal_extend_target(Core CONDITION QT_FEATURE_process AND UNIX qt_internal_extend_target(Core CONDITION QT_FEATURE_process AND UNIX
SOURCES SOURCES
../3rdparty/forkfd/forkfd.h ../3rdparty/forkfd/forkfd.h
io/forkfd_qt.cpp io/forkfd_qt.c
INCLUDE_DIRECTORIES INCLUDE_DIRECTORIES
../3rdparty/forkfd ../3rdparty/forkfd
) )

View File

@ -1,6 +1,9 @@
// Copyright (C) 2016 Intel Corporation. // Copyright (C) 2016 Intel Corporation.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif
#include <QtCore/qglobal.h> #include <QtCore/qglobal.h>
#define FORKFD_NO_SPAWNFD #define FORKFD_NO_SPAWNFD