summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2016-11-23 12:25:17 +0100
committerUlf Hermann <ulf.hermann@qt.io>2017-02-27 15:44:46 +0000
commit44af54419eaceb27bb729717d6363917fd6bb819 (patch)
treeb111875dd8cb8ff653cb0e27cfa766933ca6d589 /src
parent85b30fda7ceccecfd3938703979b3431bdedc9a2 (diff)
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 <oswald.buddenhagen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qconfig-bootstrapped.h1
-rw-r--r--src/corelib/io/forkfd_qt.cpp1
-rw-r--r--src/corelib/io/io.pri18
-rw-r--r--src/corelib/io/qprocess.cpp5
-rw-r--r--src/corelib/io/qprocess.h7
-rw-r--r--src/corelib/io/qprocess_p.h7
-rw-r--r--src/corelib/io/qprocess_unix.cpp4
-rw-r--r--src/corelib/io/qprocess_win.cpp4
-rw-r--r--src/corelib/io/qwindowspipewriter_p.h2
-rw-r--r--src/corelib/kernel/qcore_unix_p.h4
-rw-r--r--src/platformsupport/services/genericunix/qgenericunixservices.cpp6
-rw-r--r--src/testlib/qbenchmark.cpp1
-rw-r--r--src/testlib/qbenchmark_p.h2
-rw-r--r--src/testlib/qtestcase.cpp1
-rw-r--r--src/widgets/styles/qfusionstyle.cpp1
15 files changed, 27 insertions, 37 deletions
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 <QtCore/qatomic.h>
-#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 <private/qcore_unix_p.h>
#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 <functional>
-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 <QtCore/private/qorderedmutexlocker_p.h>
#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 <ctype.h>
@@ -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
diff --git a/src/platformsupport/services/genericunix/qgenericunixservices.cpp b/src/platformsupport/services/genericunix/qgenericunixservices.cpp
index a24ab82057..01d988fdbe 100644
--- a/src/platformsupport/services/genericunix/qgenericunixservices.cpp
+++ b/src/platformsupport/services/genericunix/qgenericunixservices.cpp
@@ -41,7 +41,9 @@
#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/QStandardPaths>
-#include <QtCore/QProcess>
+#if QT_CONFIG(process)
+# include <QtCore/QProcess>
+#endif
#include <QtCore/QUrl>
#include <QtCore/QDebug>
@@ -121,7 +123,7 @@ static inline bool launch(const QString &launcher, const QUrl &url)
const QString command = launcher + QLatin1Char(' ') + QLatin1String(url.toEncoded());
if (debug)
qDebug("Launching %s", qPrintable(command));
-#if defined(QT_NO_PROCESS)
+#if !QT_CONFIG(process)
const bool ok = ::system(qPrintable(command + QLatin1String(" &")));
#else
const bool ok = QProcess::startDetached(command);
diff --git a/src/testlib/qbenchmark.cpp b/src/testlib/qbenchmark.cpp
index c933a16c35..d49d07bb70 100644
--- a/src/testlib/qbenchmark.cpp
+++ b/src/testlib/qbenchmark.cpp
@@ -42,7 +42,6 @@
#include <QtTest/private/qbenchmarkmetric_p.h>
#include <QtTest/private/qbenchmarktimemeasurers_p.h>
-#include <QtCore/qprocess.h>
#include <QtCore/qdir.h>
#include <QtCore/qset.h>
#include <QtCore/qdebug.h>
diff --git a/src/testlib/qbenchmark_p.h b/src/testlib/qbenchmark_p.h
index 0b16f624df..69b33d2d58 100644
--- a/src/testlib/qbenchmark_p.h
+++ b/src/testlib/qbenchmark_p.h
@@ -55,7 +55,7 @@
#include <QtCore/qglobal.h>
-#if (defined(Q_OS_LINUX) || defined Q_OS_MAC) && !defined(QT_NO_PROCESS)
+#if (defined(Q_OS_LINUX) || defined Q_OS_MACOS) && QT_CONFIG(process)
#define QTESTLIB_USE_VALGRIND
#else
#undef QTESTLIB_USE_VALGRIND
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 31ffb36690..d0f4f76fe5 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -51,7 +51,6 @@
#include <QtCore/qfile.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qdir.h>
-#include <QtCore/qprocess.h>
#include <QtCore/qdebug.h>
#include <QtCore/qlibraryinfo.h>
#include <QtCore/private/qtools_p.h>
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index e08cd3ac70..7cfb51743d 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -51,7 +51,6 @@
#include <qmainwindow.h>
#include <qfont.h>
#include <qgroupbox.h>
-#include <qprocess.h>
#include <qpixmapcache.h>
#include <qdialogbuttonbox.h>
#include <qscrollbar.h>