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 993db5a122 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.7 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>
bb10
Thiago Macieira 2024-03-25 13:42:21 -04:00 committed by Oswald Buddenhagen
parent aa896ca9f5
commit 05408055d5
2 changed files with 4 additions and 1 deletions

View File

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

View File

@ -1,6 +1,9 @@
// 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
#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif
#include <QtCore/qglobal.h>
#define FORKFD_NO_SPAWNFD