From 44af54419eaceb27bb729717d6363917fd6bb819 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 23 Nov 2016 12:25:17 +0100 Subject: Properly use the "process" feature Replace all QT_NO_PROCESS with QT_CONFIG(process), define it in qconfig-bootstrapped.h, add QT_REQUIRE_CONFIG(process) to the qprocess headers, exclude the sources from compilation when switched off, guard header inclusions in places where compilation without QProcess seems supported, drop some unused includes, and fix some tests that were apparently designed to work with QT_NO_PROCESS but failed to. Change-Id: Ieceea2504dea6fdf43b81c7c6b65c547b01b9714 Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qconfig-bootstrapped.h | 1 + src/corelib/io/forkfd_qt.cpp | 1 - src/corelib/io/io.pri | 18 +++++++++++++----- src/corelib/io/qprocess.cpp | 5 ----- src/corelib/io/qprocess.h | 7 ++----- src/corelib/io/qprocess_p.h | 7 +++---- src/corelib/io/qprocess_unix.cpp | 4 ---- src/corelib/io/qprocess_win.cpp | 4 ---- src/corelib/io/qwindowspipewriter_p.h | 2 +- src/corelib/kernel/qcore_unix_p.h | 4 ++-- 10 files changed, 22 insertions(+), 31 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index 1c806e0774..a2c0b011e7 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -74,6 +74,7 @@ #define QT_NO_LIBRARY #define QT_FEATURE_library -1 #define QT_NO_QOBJECT +#define QT_FEATURE_process -1 #define QT_NO_SYSTEMLOCALE #define QT_FEATURE_slog2 -1 #define QT_FEATURE_syslog -1 diff --git a/src/corelib/io/forkfd_qt.cpp b/src/corelib/io/forkfd_qt.cpp index 141efeb08c..dce0ebb4da 100644 --- a/src/corelib/io/forkfd_qt.cpp +++ b/src/corelib/io/forkfd_qt.cpp @@ -39,7 +39,6 @@ // these might be defined via precompiled headers #include -#include "qprocess_p.h" #define FORKFD_NO_SPAWNFD diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index 0414ae966a..b5bfec8857 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -22,8 +22,6 @@ HEADERS += \ io/qlockfile.h \ io/qlockfile_p.h \ io/qnoncontiguousbytedevice_p.h \ - io/qprocess.h \ - io/qprocess_p.h \ io/qtextstream.h \ io/qtextstream_p.h \ io/qtemporarydir.h \ @@ -72,7 +70,6 @@ SOURCES += \ io/qiodevice.cpp \ io/qlockfile.cpp \ io/qnoncontiguousbytedevice.cpp \ - io/qprocess.cpp \ io/qstorageinfo.cpp \ io/qtextstream.cpp \ io/qtemporarydir.cpp \ @@ -96,6 +93,19 @@ SOURCES += \ io/qloggingcategory.cpp \ io/qloggingregistry.cpp +qtConfig(process) { + SOURCES += \ + io/qprocess.cpp + HEADERS += \ + io/qprocess.h \ + io/qprocess_p.h + + win32:!winrt: \ + SOURCES += io/qprocess_win.cpp + else: unix: \ + SOURCES += io/qprocess_unix.cpp +} + win32 { SOURCES += io/qfsfileengine_win.cpp SOURCES += io/qlockfile_win.cpp @@ -112,7 +122,6 @@ win32 { io/qwinoverlappedionotifier_p.h SOURCES += \ - io/qprocess_win.cpp \ io/qsettings_win.cpp \ io/qstandardpaths_win.cpp \ io/qstorageinfo_win.cpp \ @@ -132,7 +141,6 @@ win32 { io/qfsfileengine_unix.cpp \ io/qfilesystemengine_unix.cpp \ io/qlockfile_unix.cpp \ - io/qprocess_unix.cpp \ io/qfilesystemiterator_unix.cpp !integrity:!uikit { diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index c7d6cb426d..fd340ca607 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -99,8 +99,6 @@ QT_END_NAMESPACE #include #endif -#ifndef QT_NO_PROCESS - QT_BEGIN_NAMESPACE /*! @@ -2604,6 +2602,3 @@ QString QProcess::nullDevice() QT_END_NAMESPACE #include "moc_qprocess.cpp" - -#endif // QT_NO_PROCESS - diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h index 4ce0503761..67c163c012 100644 --- a/src/corelib/io/qprocess.h +++ b/src/corelib/io/qprocess.h @@ -46,10 +46,9 @@ #include -QT_BEGIN_NAMESPACE - +QT_REQUIRE_CONFIG(process); -#ifndef QT_NO_PROCESS +QT_BEGIN_NAMESPACE #if !defined(Q_OS_WIN) || defined(Q_QDOC) typedef qint64 Q_PID; @@ -298,8 +297,6 @@ private: friend class QProcessManager; }; -#endif // QT_NO_PROCESS - QT_END_NAMESPACE #endif // QPROCESS_H diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h index ae236c8c60..250eeb5de6 100644 --- a/src/corelib/io/qprocess_p.h +++ b/src/corelib/io/qprocess_p.h @@ -57,6 +57,9 @@ #include "QtCore/qhash.h" #include "QtCore/qshareddata.h" #include "private/qiodevice_p.h" + +QT_REQUIRE_CONFIG(process); + #ifdef Q_OS_UNIX #include #endif @@ -70,8 +73,6 @@ typedef int Q_PIPE; #define INVALID_Q_PIPE -1 #endif -#ifndef QT_NO_PROCESS - QT_BEGIN_NAMESPACE class QSocketNotifier; @@ -388,6 +389,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_PROCESS - #endif // QPROCESS_P_H diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index b39816dd7d..03e2c0c4ce 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -41,8 +41,6 @@ //#define QPROCESS_DEBUG #include "qdebug.h" -#ifndef QT_NO_PROCESS - #if defined QPROCESS_DEBUG #include "private/qtools_p.h" #include @@ -1045,5 +1043,3 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a } QT_END_NAMESPACE - -#endif // QT_NO_PROCESS diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index d0e922bf2b..6dd431eb47 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -59,8 +59,6 @@ #define PIPE_REJECT_REMOTE_CLIENTS 0x08 #endif -#ifndef QT_NO_PROCESS - QT_BEGIN_NAMESPACE //#define QPROCESS_DEBUG @@ -893,5 +891,3 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a } QT_END_NAMESPACE - -#endif // QT_NO_PROCESS diff --git a/src/corelib/io/qwindowspipewriter_p.h b/src/corelib/io/qwindowspipewriter_p.h index 5a0d04855f..c43e986f34 100644 --- a/src/corelib/io/qwindowspipewriter_p.h +++ b/src/corelib/io/qwindowspipewriter_p.h @@ -156,4 +156,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_PROCESS +#endif // QWINDOWSPIPEWRITER_P_H diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index 80058d9115..8f37aec6e2 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -300,7 +300,7 @@ static inline int qt_safe_close(int fd) #define QT_CLOSE qt_safe_close // - VxWorks & iOS/tvOS/watchOS don't have processes -#if !defined(Q_OS_VXWORKS) && !defined(QT_NO_PROCESS) +#if QT_CONFIG(process) static inline int qt_safe_execve(const char *filename, char *const argv[], char *const envp[]) { @@ -329,7 +329,7 @@ static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options) EINTR_LOOP(ret, ::waitpid(pid, status, options)); return ret; } -#endif // Q_OS_VXWORKS +#endif // QT_CONFIG(process) #if !defined(_POSIX_MONOTONIC_CLOCK) # define _POSIX_MONOTONIC_CLOCK -1 -- cgit v1.2.3