From 95571937284dd3e793266ea5a356857022d4433b Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 01 2017 03:30:40 +0000 Subject: import qt5-qtbase-5.6.2-1.el7 --- diff --git a/.gitignore b/.gitignore index 0d9fdba..622df0c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/qtbase-opensource-src-5.6.1.tar.xz +SOURCES/qtbase-opensource-src-5.6.2.tar.xz diff --git a/.qt5-qtbase.metadata b/.qt5-qtbase.metadata index 76e0a22..6d94cb7 100644 --- a/.qt5-qtbase.metadata +++ b/.qt5-qtbase.metadata @@ -1 +1 @@ -234daccb120e34878abe10127b1a1ec18f1b12dc SOURCES/qtbase-opensource-src-5.6.1.tar.xz +f728a6b8a50e12d7da9b70c8093c484d48b33ca8 SOURCES/qtbase-opensource-src-5.6.2.tar.xz diff --git a/SOURCES/moc-get-the-system-defines-from-the-compiler-itself.patch b/SOURCES/moc-get-the-system-defines-from-the-compiler-itself.patch deleted file mode 100644 index 3912cc7..0000000 --- a/SOURCES/moc-get-the-system-defines-from-the-compiler-itself.patch +++ /dev/null @@ -1,368 +0,0 @@ -From fa0d02eedcacc22db1026b902801b29176755362 Mon Sep 17 00:00:00 2001 -From: Thiago Macieira -Date: Fri, 21 Aug 2015 17:08:19 -0700 -Subject: [PATCH] moc: get the system #defines from the compiler itself - -In order for moc to properly parse #ifdefs and family, we've had -QMAKE_COMPILER_DEFINES as a list of pre-defined macros from the -compiler. That list is woefully incomplete. - -Instead, let's simply ask the compiler for the list. With GCC and -family, we use the -dM flag while preprocessing. With ICC on Windows, -the flag gains an extra "Q" but is otherwise the same. For MSVC, it -requires using some undocumented switches and parsing environment -variables (I've tested MSVC 2012, 2013 and 2015). - -The new moc option is called --include to be similar to GCC's -include -option. It does more than just parse a list of pre-defined macros and -can be used to insert any sort of code that moc needs to parse prior to -the main file. - -Change-Id: I7de033f80b0e4431b7f1ffff13fca02dbb60a0a6 ---- - mkspecs/features/moc.prf | 31 +++++++++++++-- - qmake/main.cpp | 38 +++++++++++++++++++ - src/tools/moc/main.cpp | 16 +++++++- - src/tools/moc/preprocessor.cpp | 60 +++++++++++++++++------------- - src/tools/moc/preprocessor.h | 1 + - tests/auto/tools/moc/subdir/extradefines.h | 1 + - tests/auto/tools/moc/tst_moc.cpp | 42 +++++++++++++++++++++ - 7 files changed, 158 insertions(+), 31 deletions(-) - create mode 100644 tests/auto/tools/moc/subdir/extradefines.h - -diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf -index c0b5682..af885c3 100644 ---- a/mkspecs/features/moc.prf -+++ b/mkspecs/features/moc.prf -@@ -24,8 +24,25 @@ win32:count(MOC_INCLUDEPATH, 40, >) { - write_file($$absolute_path($$WIN_INCLUDETEMP, $$OUT_PWD), WIN_INCLUDETEMP_CONT)|error("Aborting.") - } - -+# QNX's compiler sets "gcc" config, but does not support the -dM option; -+# iOS builds are multi-arch, so this feature cannot possibly work. -+if(gcc|intel_icl|msvc):!rim_qcc:!ios { -+ moc_predefs.CONFIG = no_link -+ gcc: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -dM -E -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} -+ else:intel_icl: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -QdM -P -Fi${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} -+ else:msvc { -+ # make sure that our bin dir is first in path, so qmake is found -+ moc_predefs.commands = PATH $$shell_path($$[QT_INSTALL_BINS/src]);%PATH%& -+ moc_predefs.commands += $$QMAKE_CXX -Bxqmake $$QMAKE_CXXFLAGS -E ${QMAKE_FILE_IN} 2>NUL >${QMAKE_FILE_OUT} -+ } else: error("Oops, I messed up") -+ moc_predefs.output = $$MOC_DIR/moc_predefs.h -+ moc_predefs.input = MOC_PREDEF_FILE -+ silent: moc_predefs.commands = @echo generating $$moc_predefs.output$$escape_expand(\n\t)@$$moc_predefs.commands -+ QMAKE_EXTRA_COMPILERS += moc_predefs -+ MOC_PREDEF_FILE = $$[QT_HOST_DATA/src]/mkspecs/features/data/dummy.cpp -+} -+ - defineReplace(mocCmdBase) { -- RET = - !isEmpty(WIN_INCLUDETEMP) { - incvar = @$$WIN_INCLUDETEMP - } else { -@@ -34,7 +51,13 @@ defineReplace(mocCmdBase) { - incvar += -I$$shell_quote($$inc) - incvar += $$QMAKE_FRAMEWORKPATH_FLAGS - } -- RET += $$QMAKE_MOC $(DEFINES) $$join(QMAKE_COMPILER_DEFINES, " -D", -D) $$incvar $$QMAKE_MOC_OPTIONS -+ -+ RET = $$QMAKE_MOC $(DEFINES) -+ -+ isEmpty(MOC_PREDEF_FILE): RET += $$join(QMAKE_COMPILER_DEFINES, " -D", -D) -+ else: RET += --include $$moc_predefs.output -+ -+ RET += $$incvar $$QMAKE_MOC_OPTIONS - return($$RET) - } - -@@ -46,7 +69,7 @@ moc_header.output = $$MOC_DIR/$${QMAKE_H_MOD_MOC}${QMAKE_FILE_BASE}$${first(QMAK - moc_header.input = HEADERS - moc_header.variable_out = SOURCES - moc_header.name = MOC ${QMAKE_FILE_IN} --moc_header.depends += $$WIN_INCLUDETEMP -+moc_header.depends += $$WIN_INCLUDETEMP $$moc_predefs.output - silent:moc_header.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_header.commands - QMAKE_EXTRA_COMPILERS += moc_header - INCREDIBUILD_XGE += moc_header -@@ -58,7 +81,7 @@ moc_source.commands = ${QMAKE_FUNC_mocCmdBase} ${QMAKE_FILE_IN} -o ${QMAKE_FILE_ - moc_source.output = $$MOC_DIR/$${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}$${QMAKE_EXT_CPP_MOC} - moc_source.input = SOURCES OBJECTIVE_SOURCES - moc_source.name = MOC ${QMAKE_FILE_IN} --moc_source.depends += $$WIN_INCLUDETEMP -+moc_source.depends += $$WIN_INCLUDETEMP $$moc_predefs.output - silent:moc_source.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_source.commands - QMAKE_EXTRA_COMPILERS += moc_source - INCREDIBUILD_XGE += moc_source -diff --git a/qmake/main.cpp b/qmake/main.cpp -index bde537d..e9b8bde 100644 ---- a/qmake/main.cpp -+++ b/qmake/main.cpp -@@ -1,6 +1,7 @@ - /**************************************************************************** - ** - ** Copyright (C) 2015 The Qt Company Ltd. -+** Copyright (C) 2015 Intel Corporation. - ** Contact: http://www.qt.io/licensing/ - ** - ** This file is part of the qmake application of the Qt Toolkit. -@@ -47,6 +48,10 @@ - #include - #include - -+#ifdef Q_OS_WIN -+# include -+#endif -+ - QT_BEGIN_NAMESPACE - - #ifdef Q_OS_WIN -@@ -246,6 +251,30 @@ static int doInstall(int argc, char **argv) - return 3; - } - -+static int dumpMacros(const wchar_t *cmdline) -+{ -+ // from http://stackoverflow.com/questions/3665537/how-to-find-out-cl-exes-built-in-macros -+ int argc; -+ wchar_t **argv = CommandLineToArgvW(cmdline, &argc); -+ if (!argv) -+ return 2; -+ for (int i = 0; i < argc; ++i) { -+ if (argv[i][0] != L'-' || argv[i][1] != 'D') -+ continue; -+ -+ wchar_t *value = wcschr(argv[i], L'='); -+ if (value) { -+ *value = 0; -+ ++value; -+ } else { -+ // point to the NUL at the end, so we don't print anything -+ value = argv[i] + wcslen(argv[i]); -+ } -+ wprintf(L"#define %Ls %Ls\n", argv[i] + 2, value); -+ } -+ return 0; -+} -+ - #endif // Q_OS_WIN - - /* This is to work around lame implementation on Darwin. It has been noted that the getpwd(3) function -@@ -280,6 +309,15 @@ int runQMake(int argc, char **argv) - // Workaround for inferior/missing command line tools on Windows: make our own! - if (argc >= 2 && !strcmp(argv[1], "-install")) - return doInstall(argc - 2, argv + 2); -+ -+ { -+ // Support running as Visual C++'s compiler -+ const wchar_t *cmdline = _wgetenv(L"MSC_CMD_FLAGS"); -+ if (!cmdline || !*cmdline) -+ cmdline = _wgetenv(L"MSC_IDE_FLAGS"); -+ if (cmdline && *cmdline) -+ return dumpMacros(cmdline); -+ } - #endif - - QMakeVfs vfs; -diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp -index a5cbad7..d06335d 100644 ---- a/src/tools/moc/main.cpp -+++ b/src/tools/moc/main.cpp -@@ -259,6 +259,11 @@ int runMoc(int argc, char **argv) - prependIncludeOption.setValueName(QStringLiteral("file")); - parser.addOption(prependIncludeOption); - -+ QCommandLineOption includeOption(QStringLiteral("include")); -+ includeOption.setDescription(QStringLiteral("Parse as an #include before the main source(s).")); -+ includeOption.setValueName(QStringLiteral("file")); -+ parser.addOption(includeOption); -+ - QCommandLineOption noNotesWarningsCompatOption(QStringLiteral("n")); - noNotesWarningsCompatOption.setDescription(QStringLiteral("Do not display notes (-nn) or warnings (-nw). Compatibility option.")); - noNotesWarningsCompatOption.setValueName(QStringLiteral("which")); -@@ -406,7 +411,16 @@ int runMoc(int argc, char **argv) - moc.includes = pp.includes; - - // 1. preprocess -- moc.symbols = pp.preprocessed(moc.filename, &in); -+ foreach (const QString &includeName, parser.values(includeOption)) { -+ QByteArray rawName = pp.resolveInclude(QFile::encodeName(includeName), moc.filename); -+ QFile f(QFile::decodeName(rawName)); -+ if (f.open(QIODevice::ReadOnly)) { -+ moc.symbols += Symbol(0, MOC_INCLUDE_BEGIN, rawName); -+ moc.symbols += pp.preprocessed(rawName, &f); -+ moc.symbols += Symbol(0, MOC_INCLUDE_END, rawName); -+ } -+ } -+ moc.symbols += pp.preprocessed(moc.filename, &in); - - if (!pp.preprocessOnly) { - // 2. parse -diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp -index d036c40..70cf14a 100644 ---- a/src/tools/moc/preprocessor.cpp -+++ b/src/tools/moc/preprocessor.cpp -@@ -1001,6 +1001,37 @@ static void mergeStringLiterals(Symbols *_symbols) - } - } - -+QByteArray Preprocessor::resolveInclude(const QByteArray &include, const QByteArray &relativeTo) -+{ -+ // #### stringery -+ QFileInfo fi; -+ if (!relativeTo.isEmpty()) -+ fi.setFile(QFileInfo(QString::fromLocal8Bit(relativeTo.constData())).dir(), QString::fromLocal8Bit(include.constData())); -+ for (int j = 0; j < Preprocessor::includes.size() && !fi.exists(); ++j) { -+ const IncludePath &p = Preprocessor::includes.at(j); -+ if (p.isFrameworkPath) { -+ const int slashPos = include.indexOf('/'); -+ if (slashPos == -1) -+ continue; -+ QByteArray frameworkCandidate = include.left(slashPos); -+ frameworkCandidate.append(".framework/Headers/"); -+ fi.setFile(QString::fromLocal8Bit(QByteArray(p.path + '/' + frameworkCandidate).constData()), QString::fromLocal8Bit(include.mid(slashPos + 1).constData())); -+ } else { -+ fi.setFile(QString::fromLocal8Bit(p.path.constData()), QString::fromLocal8Bit(include.constData())); -+ } -+ // try again, maybe there's a file later in the include paths with the same name -+ // (186067) -+ if (fi.isDir()) { -+ fi = QFileInfo(); -+ continue; -+ } -+ } -+ -+ if (!fi.exists() || fi.isDir()) -+ return QByteArray(); -+ return fi.canonicalFilePath().toLocal8Bit(); -+} -+ - void Preprocessor::preprocess(const QByteArray &filename, Symbols &preprocessed) - { - currentFilenames.push(filename); -@@ -1021,33 +1052,9 @@ void Preprocessor::preprocess(const QByteArray &filename, Symbols &preprocessed) - continue; - until(PP_NEWLINE); - -- // #### stringery -- QFileInfo fi; -- if (local) -- fi.setFile(QFileInfo(QString::fromLocal8Bit(filename.constData())).dir(), QString::fromLocal8Bit(include.constData())); -- for (int j = 0; j < Preprocessor::includes.size() && !fi.exists(); ++j) { -- const IncludePath &p = Preprocessor::includes.at(j); -- if (p.isFrameworkPath) { -- const int slashPos = include.indexOf('/'); -- if (slashPos == -1) -- continue; -- QByteArray frameworkCandidate = include.left(slashPos); -- frameworkCandidate.append(".framework/Headers/"); -- fi.setFile(QString::fromLocal8Bit(QByteArray(p.path + '/' + frameworkCandidate).constData()), QString::fromLocal8Bit(include.mid(slashPos + 1).constData())); -- } else { -- fi.setFile(QString::fromLocal8Bit(p.path.constData()), QString::fromLocal8Bit(include.constData())); -- } -- // try again, maybe there's a file later in the include paths with the same name -- // (186067) -- if (fi.isDir()) { -- fi = QFileInfo(); -- continue; -- } -- } -- -- if (!fi.exists() || fi.isDir()) -+ include = resolveInclude(include, local ? filename : QByteArray()); -+ if (include.isNull()) - continue; -- include = fi.canonicalFilePath().toLocal8Bit(); - - if (Preprocessor::preprocessedIncludes.contains(include)) - continue; -@@ -1202,6 +1209,7 @@ Symbols Preprocessor::preprocessed(const QByteArray &filename, QFile *file) - input = cleaned(input); - - // phase 2: tokenize for the preprocessor -+ index = 0; - symbols = tokenize(input); - - #if 0 -diff --git a/src/tools/moc/preprocessor.h b/src/tools/moc/preprocessor.h -index 9c81f86..d876caf 100644 ---- a/src/tools/moc/preprocessor.h -+++ b/src/tools/moc/preprocessor.h -@@ -67,6 +67,7 @@ public: - QList frameworks; - QSet preprocessedIncludes; - Macros macros; -+ QByteArray resolveInclude(const QByteArray &filename, const QByteArray &relativeTo); - Symbols preprocessed(const QByteArray &filename, QFile *device); - - void parseDefineArguments(Macro *m); -diff --git a/tests/auto/tools/moc/subdir/extradefines.h b/tests/auto/tools/moc/subdir/extradefines.h -new file mode 100644 -index 0000000..e7888ce ---- /dev/null -+++ b/tests/auto/tools/moc/subdir/extradefines.h -@@ -0,0 +1 @@ -+#define FOO 1 -diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp -index fa1b68b..1d6a911 100644 ---- a/tests/auto/tools/moc/tst_moc.cpp -+++ b/tests/auto/tools/moc/tst_moc.cpp -@@ -552,6 +552,8 @@ private slots: - void frameworkSearchPath(); - void cstyleEnums(); - void defineMacroViaCmdline(); -+ void defineMacroViaForcedInclude(); -+ void defineMacroViaForcedIncludeRelative(); - void specifyMetaTagsFromCmdline(); - void invokable(); - void singleFunctionKeywordSignalAndSlot(); -@@ -1219,6 +1221,46 @@ void tst_Moc::defineMacroViaCmdline() - #endif - } - -+void tst_Moc::defineMacroViaForcedInclude() -+{ -+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) -+ QProcess proc; -+ -+ QStringList args; -+ args << "--include" << m_sourceDirectory + QLatin1String("/subdir/extradefines.h"); -+ args << m_sourceDirectory + QStringLiteral("/macro-on-cmdline.h"); -+ -+ proc.start(m_moc, args); -+ QVERIFY(proc.waitForFinished()); -+ QCOMPARE(proc.exitCode(), 0); -+ QCOMPARE(proc.readAllStandardError(), QByteArray()); -+ QByteArray mocOut = proc.readAllStandardOutput(); -+ QVERIFY(!mocOut.isEmpty()); -+#else -+ QSKIP("Only tested on linux/gcc"); -+#endif -+} -+ -+void tst_Moc::defineMacroViaForcedIncludeRelative() -+{ -+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) -+ QProcess proc; -+ -+ QStringList args; -+ args << "--include" << QStringLiteral("extradefines.h") << "-I" + m_sourceDirectory + "/subdir"; -+ args << m_sourceDirectory + QStringLiteral("/macro-on-cmdline.h"); -+ -+ proc.start(m_moc, args); -+ QVERIFY(proc.waitForFinished()); -+ QCOMPARE(proc.exitCode(), 0); -+ QCOMPARE(proc.readAllStandardError(), QByteArray()); -+ QByteArray mocOut = proc.readAllStandardOutput(); -+ QVERIFY(!mocOut.isEmpty()); -+#else -+ QSKIP("Only tested on linux/gcc"); -+#endif -+} -+ - // tst_Moc::specifyMetaTagsFromCmdline() - // plugin_metadata.h contains a plugin which we register here. Since we're not building this - // application as a plugin, we need top copy some of the initializer code found in qplugin.h: --- -1.9.3 - diff --git a/SOURCES/qt5-poll.patch b/SOURCES/qt5-poll.patch index 1dd739b..97e0c67 100644 --- a/SOURCES/qt5-poll.patch +++ b/SOURCES/qt5-poll.patch @@ -313,10 +313,10 @@ index 0000000..d08a8a0 +SOURCES = ppoll.cpp +CONFIG -= qt diff --git a/configure b/configure -index 7651e29..9be4179 100755 +index 0b8b417..f63daef 100755 --- a/configure +++ b/configure -@@ -729,6 +729,7 @@ CFG_GETIFADDRS=auto +@@ -745,6 +745,7 @@ CFG_GETIFADDRS=auto CFG_INOTIFY=auto CFG_EVENTFD=auto CFG_CLOEXEC=no @@ -324,10 +324,10 @@ index 7651e29..9be4179 100755 CFG_RPATH=yes CFG_FRAMEWORK=auto CFG_USE_GOLD_LINKER=auto -@@ -6043,6 +6044,16 @@ if compileTest unix/cloexec "cloexec"; then +@@ -6068,6 +6069,16 @@ if compileTest unix/cloexec "cloexec"; then CFG_CLOEXEC=yes fi - + +if compileTest unix/ppoll "ppoll"; then + CFG_POLL="ppoll" +elif compileTest unix/pollts "pollts"; then @@ -341,7 +341,7 @@ index 7651e29..9be4179 100755 if [ "$XPLATFORM_MAC" = "yes" ] && [ "$CFG_SECURETRANSPORT" != "no" ] && ([ "$CFG_OPENSSL" = "no" ] || [ "$CFG_OPENSSL" = "auto" ]); then CFG_SECURETRANSPORT=yes CFG_OPENSSL=no -@@ -6350,6 +6361,10 @@ fi +@@ -6379,6 +6390,10 @@ fi if [ "$CFG_CLOEXEC" = "yes" ]; then QT_CONFIG="$QT_CONFIG threadsafe-cloexec" fi @@ -353,13 +353,13 @@ index 7651e29..9be4179 100755 CFG_JPEG="no" elif [ "$CFG_LIBJPEG" = "system" ]; then diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp -index 8eb5ac9..74a0c41 100644 +index fda9178..89e4665 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -115,11 +115,52 @@ QT_BEGIN_NAMESPACE // so we will use 512 static const int errorBufferMax = 512; - + -static inline void add_fd(int &nfds, int fd, fd_set *fdset) +namespace { +struct QProcessPoller @@ -411,12 +411,12 @@ index 8eb5ac9..74a0c41 100644 +{ + return pfd.fd >= 0 && (pfd.revents & (revents | POLLHUP | POLLERR | POLLNVAL)) != 0; } - + static int qt_create_pipe(int *pipe) -@@ -812,10 +853,9 @@ bool QProcessPrivate::waitForStarted(int msecs) +@@ -677,10 +718,9 @@ bool QProcessPrivate::waitForStarted(int msecs) childStartedPipe[0]); #endif - + - fd_set fds; - FD_ZERO(&fds); - FD_SET(childStartedPipe[0], &fds); @@ -427,9 +427,9 @@ index 8eb5ac9..74a0c41 100644 setError(QProcess::Timedout); #if defined (QPROCESS_DEBUG) qDebug("QProcessPrivate::waitForStarted(%d) == false (timed out)", msecs); -@@ -855,31 +895,13 @@ bool QProcessPrivate::waitForReadyRead(int msecs) +@@ -720,31 +760,13 @@ bool QProcessPrivate::waitForReadyRead(int msecs) #endif - + forever { - fd_set fdread; - fd_set fdwrite; @@ -451,7 +451,7 @@ index 8eb5ac9..74a0c41 100644 - if (!stdinChannel.buffer.isEmpty() && stdinChannel.pipe[1] != -1) - add_fd(nfds, stdinChannel.pipe[1], &fdwrite); + QProcessPoller poller(*this); - + int timeout = qt_subtract_from_timeout(msecs, stopWatch.elapsed()); #ifdef Q_OS_BLACKBERRY int ret = bb_select(notifiers, nfds + 1, &fdread, &fdwrite, timeout); @@ -461,16 +461,16 @@ index 8eb5ac9..74a0c41 100644 #endif if (ret < 0) { break; -@@ -889,18 +911,18 @@ bool QProcessPrivate::waitForReadyRead(int msecs) +@@ -754,18 +776,18 @@ bool QProcessPrivate::waitForReadyRead(int msecs) return false; } - + - if (childStartedPipe[0] != -1 && FD_ISSET(childStartedPipe[0], &fdread)) { + if (qt_pollfd_check(poller.childStartedPipe(), POLLIN)) { if (!_q_startupNotification()) return false; } - + bool readyReadEmitted = false; - if (stdoutChannel.pipe[0] != -1 && FD_ISSET(stdoutChannel.pipe[0], &fdread)) { + if (qt_pollfd_check(poller.stdoutPipe(), POLLIN)) { @@ -483,22 +483,22 @@ index 8eb5ac9..74a0c41 100644 bool canRead = _q_canReadStandardError(); if (processChannel == QProcess::StandardError && canRead) readyReadEmitted = true; -@@ -908,10 +930,10 @@ bool QProcessPrivate::waitForReadyRead(int msecs) +@@ -773,10 +795,10 @@ bool QProcessPrivate::waitForReadyRead(int msecs) if (readyReadEmitted) return true; - + - if (stdinChannel.pipe[1] != -1 && FD_ISSET(stdinChannel.pipe[1], &fdwrite)) + if (qt_pollfd_check(poller.stdinPipe(), POLLOUT)) _q_canWrite(); - + - if (forkfd == -1 || FD_ISSET(forkfd, &fdread)) { + if (qt_pollfd_check(poller.forkfd(), POLLIN)) { if (_q_processDied()) return false; } -@@ -933,32 +955,13 @@ bool QProcessPrivate::waitForBytesWritten(int msecs) +@@ -798,32 +820,13 @@ bool QProcessPrivate::waitForBytesWritten(int msecs) #endif - + while (!stdinChannel.buffer.isEmpty()) { - fd_set fdread; - fd_set fdwrite; @@ -521,7 +521,7 @@ index 8eb5ac9..74a0c41 100644 - if (!stdinChannel.buffer.isEmpty() && stdinChannel.pipe[1] != -1) - add_fd(nfds, stdinChannel.pipe[1], &fdwrite); + QProcessPoller poller(*this); - + int timeout = qt_subtract_from_timeout(msecs, stopWatch.elapsed()); #ifdef Q_OS_BLACKBERRY int ret = bb_select(notifiers, nfds + 1, &fdread, &fdwrite, timeout); @@ -531,36 +531,36 @@ index 8eb5ac9..74a0c41 100644 #endif if (ret < 0) { break; -@@ -969,21 +972,21 @@ bool QProcessPrivate::waitForBytesWritten(int msecs) +@@ -834,21 +837,21 @@ bool QProcessPrivate::waitForBytesWritten(int msecs) return false; } - + - if (childStartedPipe[0] != -1 && FD_ISSET(childStartedPipe[0], &fdread)) { + if (qt_pollfd_check(poller.childStartedPipe(), POLLIN)) { if (!_q_startupNotification()) return false; } - + - if (stdinChannel.pipe[1] != -1 && FD_ISSET(stdinChannel.pipe[1], &fdwrite)) + if (qt_pollfd_check(poller.stdinPipe(), POLLOUT)) return _q_canWrite(); - + - if (stdoutChannel.pipe[0] != -1 && FD_ISSET(stdoutChannel.pipe[0], &fdread)) + if (qt_pollfd_check(poller.stdoutPipe(), POLLIN)) _q_canReadStandardOutput(); - + - if (stderrChannel.pipe[0] != -1 && FD_ISSET(stderrChannel.pipe[0], &fdread)) + if (qt_pollfd_check(poller.stderrPipe(), POLLIN)) _q_canReadStandardError(); - + - if (forkfd == -1 || FD_ISSET(forkfd, &fdread)) { + if (qt_pollfd_check(poller.forkfd(), POLLIN)) { if (_q_processDied()) return false; } -@@ -1006,32 +1009,13 @@ bool QProcessPrivate::waitForFinished(int msecs) +@@ -871,32 +874,13 @@ bool QProcessPrivate::waitForFinished(int msecs) #endif - + forever { - fd_set fdread; - fd_set fdwrite; @@ -583,7 +583,7 @@ index 8eb5ac9..74a0c41 100644 - if (!stdinChannel.buffer.isEmpty() && stdinChannel.pipe[1] != -1) - add_fd(nfds, stdinChannel.pipe[1], &fdwrite); + QProcessPoller poller(*this); - + int timeout = qt_subtract_from_timeout(msecs, stopWatch.elapsed()); #ifdef Q_OS_BLACKBERRY int ret = bb_select(notifiers, nfds + 1, &fdread, &fdwrite, timeout); @@ -593,10 +593,10 @@ index 8eb5ac9..74a0c41 100644 #endif if (ret < 0) { break; -@@ -1041,20 +1025,20 @@ bool QProcessPrivate::waitForFinished(int msecs) +@@ -906,20 +890,20 @@ bool QProcessPrivate::waitForFinished(int msecs) return false; } - + - if (childStartedPipe[0] != -1 && FD_ISSET(childStartedPipe[0], &fdread)) { + if (qt_pollfd_check(poller.childStartedPipe(), POLLIN)) { if (!_q_startupNotification()) @@ -605,22 +605,22 @@ index 8eb5ac9..74a0c41 100644 - if (stdinChannel.pipe[1] != -1 && FD_ISSET(stdinChannel.pipe[1], &fdwrite)) + if (qt_pollfd_check(poller.stdinPipe(), POLLOUT)) _q_canWrite(); - + - if (stdoutChannel.pipe[0] != -1 && FD_ISSET(stdoutChannel.pipe[0], &fdread)) + if (qt_pollfd_check(poller.stdoutPipe(), POLLIN)) _q_canReadStandardOutput(); - + - if (stderrChannel.pipe[0] != -1 && FD_ISSET(stderrChannel.pipe[0], &fdread)) + if (qt_pollfd_check(poller.stderrPipe(), POLLIN)) _q_canReadStandardError(); - + - if (forkfd == -1 || FD_ISSET(forkfd, &fdread)) { + if (qt_pollfd_check(poller.forkfd(), POLLIN)) { if (_q_processDied()) return true; } -@@ -1064,10 +1048,8 @@ bool QProcessPrivate::waitForFinished(int msecs) - +@@ -929,10 +913,8 @@ bool QProcessPrivate::waitForFinished(int msecs) + bool QProcessPrivate::waitForWrite(int msecs) { - fd_set fdwrite; @@ -630,7 +630,7 @@ index 8eb5ac9..74a0c41 100644 + pollfd pfd = qt_make_pollfd(stdinChannel.pipe[1], POLLOUT); + return qt_poll_msecs(&pfd, 1, msecs < 0 ? 0 : msecs) == 1; } - + void QProcessPrivate::findExitCode() diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index bc93791..ff64b4e 100644 @@ -642,7 +642,7 @@ index bc93791..ff64b4e 100644 kernel/qeventdispatcher_unix_p.h \ + kernel/qpoll_p.h \ kernel/qtimerinfo_unix_p.h - + + contains(QT_CONFIG, poll_select): SOURCES += kernel/qpoll.cpp + contains(QT_CONFIG, poll_poll): DEFINES += QT_HAVE_POLL + contains(QT_CONFIG, poll_ppoll): DEFINES += QT_HAVE_POLL QT_HAVE_PPOLL @@ -652,13 +652,13 @@ index bc93791..ff64b4e 100644 SOURCES += \ kernel/qeventdispatcher_glib.cpp diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp -index 5695cb3..2ffc746 100644 +index 1bcb472..3a3990c 100644 --- a/src/corelib/kernel/qcore_unix.cpp +++ b/src/corelib/kernel/qcore_unix.cpp -@@ -56,6 +56,11 @@ - +@@ -46,6 +46,11 @@ + QT_BEGIN_NAMESPACE - + +#if !defined(QT_HAVE_PPOLL) && defined(QT_HAVE_POLLTS) +# define ppoll pollts +# define QT_HAVE_PPOLL @@ -667,7 +667,7 @@ index 5695cb3..2ffc746 100644 static inline bool time_update(struct timespec *tv, const struct timespec &start, const struct timespec &timeout) { -@@ -85,9 +90,7 @@ int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, +@@ -75,9 +80,7 @@ int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, #ifndef Q_OS_QNX ret = ::pselect(nfds, fdread, fdwrite, fdexcept, &timeout, 0); #else @@ -678,10 +678,10 @@ index 5695cb3..2ffc746 100644 ret = ::select(nfds, fdread, fdwrite, fdexcept, &timeoutVal); #endif if (ret != -1 || errno != EINTR) -@@ -102,17 +105,82 @@ int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, +@@ -92,17 +95,82 @@ int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, } } - + +static inline struct timespec millisecsToTimespec(const unsigned int ms) +{ + struct timespec tv; @@ -696,14 +696,14 @@ index 5695cb3..2ffc746 100644 { if (timeout < 0) return qt_safe_select(nfds, fdread, fdwrite, 0, 0); - + - struct timespec tv; - tv.tv_sec = timeout / 1000; - tv.tv_nsec = (timeout % 1000) * 1000 * 1000; + struct timespec tv = millisecsToTimespec(timeout); return qt_safe_select(nfds, fdread, fdwrite, 0, &tv); } - + +#if !defined(QT_HAVE_PPOLL) && defined(QT_HAVE_POLL) +static inline int timespecToMillisecs(const struct timespec *ts) +{ @@ -765,13 +765,13 @@ index 5695cb3..2ffc746 100644 // The BlackBerry event dispatcher uses bps_get_event. Unfortunately, already registered // socket notifiers are disabled by a call to select. This is to rearm the standard streams. diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h -index f80dcb5..fc3f63b 100644 +index 07725b8..64f62f5 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h -@@ -66,6 +66,12 @@ +@@ -80,6 +80,12 @@ # include #endif - + +#ifdef QT_NO_NATIVE_POLL +# include "qpoll_p.h" +#else @@ -779,12 +779,12 @@ index f80dcb5..fc3f63b 100644 +#endif + struct sockaddr; - + #define EINTR_LOOP(var, cmd) \ -@@ -122,6 +128,14 @@ inline timespec operator*(const timespec &t1, int mul) +@@ -136,6 +142,14 @@ inline timespec operator*(const timespec &t1, int mul) return normalizedTimespec(tmp); } - + +inline timeval timespecToTimeval(const timespec &ts) +{ + timeval tv; @@ -796,10 +796,10 @@ index f80dcb5..fc3f63b 100644 inline void qt_ignore_sigpipe() { // Set to ignore SIGPIPE once only. -@@ -303,6 +317,27 @@ static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options) +@@ -317,6 +331,27 @@ static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options) timespec qt_gettime() Q_DECL_NOTHROW; void qt_nanosleep(timespec amount); - + +Q_CORE_EXPORT int qt_safe_poll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts); + +static inline int qt_poll_msecs(struct pollfd *fds, nfds_t nfds, int timeout) @@ -823,9 +823,9 @@ index f80dcb5..fc3f63b 100644 + Q_CORE_EXPORT int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, const struct timespec *tv); - + diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp -index 155f7b7..7d23283 100644 +index 155f7b7..9567e29 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -59,7 +59,7 @@ @@ -835,12 +835,12 @@ index 155f7b7..7d23283 100644 -# include +# include #endif - + #if (_POSIX_MONOTONIC_CLOCK-0 <= 0) || defined(QT_BOOTSTRAPPED) @@ -68,6 +68,20 @@ - + QT_BEGIN_NAMESPACE - + +static const char *socketType(QSocketNotifier::Type type) +{ + switch (type) { @@ -859,18 +859,18 @@ index 155f7b7..7d23283 100644 static void initThreadPipeFD(int fd) { @@ -137,8 +151,6 @@ QEventDispatcherUNIXPrivate::QEventDispatcherUNIXPrivate() - + if (pipefail) qFatal("QEventDispatcherUNIXPrivate(): Can not continue without a thread pipe"); - - sn_highest = -1; } - + QEventDispatcherUNIXPrivate::~QEventDispatcherUNIXPrivate() @@ -163,116 +175,11 @@ QEventDispatcherUNIXPrivate::~QEventDispatcherUNIXPrivate() qDeleteAll(timerList); } - + -int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags, timespec *timeout) -{ - Q_Q(QEventDispatcherUNIX); @@ -979,7 +979,7 @@ index 155f7b7..7d23283 100644 - return thread_pipe[0]; -} + Q_ASSERT(pfd.fd == thread_pipe[0]); - + -int QEventDispatcherUNIXPrivate::processThreadWakeUp(int nsel) -{ - if (nsel > 0 && FD_ISSET(thread_pipe[0], &sn_vec[0].select_fds)) { @@ -990,7 +990,7 @@ index 155f7b7..7d23283 100644 @@ -302,6 +209,80 @@ int QEventDispatcherUNIXPrivate::processThreadWakeUp(int nsel) return 0; } - + +void QEventDispatcherUNIXPrivate::setSocketNotifierPending(QSocketNotifier *notifier) +{ + Q_ASSERT(notifier); @@ -1070,7 +1070,7 @@ index 155f7b7..7d23283 100644 { } @@ -311,14 +292,7 @@ QEventDispatcherUNIX::QEventDispatcherUNIX(QEventDispatcherUNIXPrivate &dd, QObj { } - + QEventDispatcherUNIX::~QEventDispatcherUNIX() -{ -} @@ -1081,12 +1081,12 @@ index 155f7b7..7d23283 100644 - return qt_safe_select(nfds, readfds, writefds, exceptfds, timeout); -} +{ } - + /*! \internal @@ -390,22 +364,6 @@ QEventDispatcherUNIX::registeredTimers(QObject *object) const } - + /***************************************************************************** - Socket notifier type - *****************************************************************************/ @@ -1106,7 +1106,7 @@ index 155f7b7..7d23283 100644 -/***************************************************************************** QEventDispatcher implementations for UNIX *****************************************************************************/ - + @@ -413,160 +371,57 @@ void QEventDispatcherUNIX::registerSocketNotifier(QSocketNotifier *notifier) { Q_ASSERT(notifier); @@ -1125,7 +1125,7 @@ index 155f7b7..7d23283 100644 return; } #endif - + Q_D(QEventDispatcherUNIX); - QSockNotType::List &list = d->sn_vec[type].list; - fd_set *fds = &d->sn_vec[type].enabled_fds; @@ -1153,12 +1153,12 @@ index 155f7b7..7d23283 100644 + if (sn_set.notifiers[type] && sn_set.notifiers[type] != notifier) + qWarning("%s: Multiple socket notifiers for same socket %d and type %s", + Q_FUNC_INFO, sockfd, socketType(type)); - + - FD_SET(sockfd, fds); - d->sn_highest = qMax(d->sn_highest, sockfd); + sn_set.notifiers[type] = notifier; } - + void QEventDispatcherUNIX::unregisterSocketNotifier(QSocketNotifier *notifier) { Q_ASSERT(notifier); @@ -1177,7 +1177,7 @@ index 155f7b7..7d23283 100644 return; } #endif - + Q_D(QEventDispatcherUNIX); - QSockNotType::List &list = d->sn_vec[type].list; - fd_set *fds = &d->sn_vec[type].enabled_fds; @@ -1191,7 +1191,7 @@ index 155f7b7..7d23283 100644 - if (i == list.size()) // not found - return; + d->pendingNotifiers.removeOne(notifier); - + - FD_CLR(sockfd, fds); // clear fd bit - FD_CLR(sockfd, sn->queue); - d->sn_pending_list.removeAll(sn); // remove from activation list @@ -1224,7 +1224,7 @@ index 155f7b7..7d23283 100644 - Q_ASSERT(notifier->thread() == thread() && thread() == QThread::currentThread()); -#endif + QSocketNotifierSetUNIX &sn_set = i.value(); - + - Q_D(QEventDispatcherUNIX); - QSockNotType::List &list = d->sn_vec[type].list; - QSockNot *sn = 0; @@ -1237,7 +1237,7 @@ index 155f7b7..7d23283 100644 - if (i == list.size()) // not found + if (sn_set.notifiers[type] == nullptr) return; - + - // We choose a random activation order to be more fair under high load. - // If a constant order is used and a peer early in the list can - // saturate the IO, it might grab our attention completely. @@ -1265,14 +1265,14 @@ index 155f7b7..7d23283 100644 - Q_D(QEventDispatcherUNIX); - return d->timerList.activateTimers(); -} - + -int QEventDispatcherUNIX::activateSocketNotifiers() -{ - Q_D(QEventDispatcherUNIX); - if (d->sn_pending_list.isEmpty()) - return 0; + sn_set.notifiers[type] = nullptr; - + - // activate entries - int n_act = 0; - QEvent event(QEvent::SockAct); @@ -1288,12 +1288,12 @@ index 155f7b7..7d23283 100644 + if (sn_set.isEmpty()) + d->socketNotifiers.erase(i); } - + bool QEventDispatcherUNIX::processEvents(QEventLoop::ProcessEventsFlags flags) @@ -578,39 +433,54 @@ bool QEventDispatcherUNIX::processEvents(QEventLoop::ProcessEventsFlags flags) emit awake(); QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData); - + - int nevents = 0; + const bool include_timers = (flags & QEventLoop::X11ExcludeTimers) == 0; + const bool include_notifiers = (flags & QEventLoop::ExcludeSocketNotifiers) == 0; @@ -1303,10 +1303,10 @@ index 155f7b7..7d23283 100644 && !d->interrupt.load() - && (flags & QEventLoop::WaitForMoreEvents)); + && wait_for_events); - + if (canWait) emit aboutToBlock(); - + - if (!d->interrupt.load()) { - // return the maximum time we can wait for an event. - timespec *tm = 0; @@ -1317,24 +1317,24 @@ index 155f7b7..7d23283 100644 - } + if (d->interrupt.load()) + return false; - + - if (!canWait) { - if (!tm) - tm = &wait_tm; + timespec *tm = nullptr; + timespec wait_tm = { 0, 0 }; - + - // no time to wait - tm->tv_sec = 0l; - tm->tv_nsec = 0l; - } + if (!canWait || (include_timers && d->timerList.timerWait(wait_tm))) + tm = &wait_tm; - + - nevents = d->doSelect(flags, tm); + d->pollfds.reserve(1 + (include_notifiers ? d->socketNotifiers.size() : 0)); + d->pollfds.resize(0); - + - // activate timers - if (! (flags & QEventLoop::X11ExcludeTimers)) { - nevents += activateTimers(); @@ -1368,13 +1368,13 @@ index 155f7b7..7d23283 100644 return (nevents > 0); } diff --git a/src/corelib/kernel/qeventdispatcher_unix_p.h b/src/corelib/kernel/qeventdispatcher_unix_p.h -index df08080..b76bb8e 100644 +index 32c9de0..8a0a0e2 100644 --- a/src/corelib/kernel/qeventdispatcher_unix_p.h +++ b/src/corelib/kernel/qeventdispatcher_unix_p.h -@@ -53,38 +53,21 @@ +@@ -53,35 +53,18 @@ #include "QtCore/qvarlengtharray.h" #include "private/qtimerinfo_unix_p.h" - + -#if !defined(Q_OS_VXWORKS) -# include -# if (!defined(Q_OS_HPUX) || defined(__ia64)) && !defined(Q_OS_NACL) @@ -1383,7 +1383,7 @@ index df08080..b76bb8e 100644 -#endif - QT_BEGIN_NAMESPACE - + -struct QSockNot -{ - QSocketNotifier *obj; @@ -1391,7 +1391,7 @@ index df08080..b76bb8e 100644 - fd_set *queue; -}; +class QEventDispatcherUNIXPrivate; - + -class QSockNotType +struct Q_CORE_EXPORT QSocketNotifierSetUNIX Q_DECL_FINAL { @@ -1399,7 +1399,7 @@ index df08080..b76bb8e 100644 - QSockNotType(); - ~QSockNotType(); + inline QSocketNotifierSetUNIX() Q_DECL_NOTHROW; - + - typedef QPodList List; - - List list; @@ -1408,17 +1408,22 @@ index df08080..b76bb8e 100644 - fd_set pending_fds; + inline bool isEmpty() const Q_DECL_NOTHROW; + inline short events() const Q_DECL_NOTHROW; - + + QSocketNotifier *notifiers[3]; }; - + + #ifdef check +@@ -89,7 +72,7 @@ public: + # undef check + #endif + -class QEventDispatcherUNIXPrivate; +Q_DECLARE_TYPEINFO(QSocketNotifierSetUNIX, Q_PRIMITIVE_TYPE); - + #ifdef Q_OS_QNX # define FINAL_EXCEPT_BLACKBERRY -@@ -120,15 +103,6 @@ public: - +@@ -125,15 +108,6 @@ public: + protected: QEventDispatcherUNIX(QEventDispatcherUNIXPrivate &dd, QObject *parent = 0); - @@ -1431,12 +1436,12 @@ index df08080..b76bb8e 100644 - fd_set *readfds, fd_set *writefds, fd_set *exceptfds, - timespec *timeout); }; - + class Q_CORE_EXPORT QEventDispatcherUNIXPrivate : public QAbstractEventDispatcherPrivate -@@ -139,9 +113,13 @@ public: +@@ -144,9 +118,13 @@ public: QEventDispatcherUNIXPrivate(); ~QEventDispatcherUNIXPrivate(); - + - int doSelect(QEventLoop::ProcessEventsFlags flags, timespec *timeout); - virtual int initThreadWakeUp() FINAL_EXCEPT_BLACKBERRY; - virtual int processThreadWakeUp(int nsel) FINAL_EXCEPT_BLACKBERRY; @@ -1447,33 +1452,33 @@ index df08080..b76bb8e 100644 + void markPendingSocketNotifiers(); + int activateSocketNotifiers(); + void setSocketNotifierPending(QSocketNotifier *notifier); - + bool mainThread; - -@@ -149,15 +127,12 @@ public: + +@@ -154,15 +132,12 @@ public: // if thread_pipe[1] is -1, then eventfd(7) is in use and is stored in thread_pipe[0] int thread_pipe[2]; - + - // highest fd for all socket notifiers - int sn_highest; - // 3 socket notifier types - read, write and exception - QSockNotType sn_vec[3]; + QVector pollfds; - + - QTimerInfoList timerList; + QHash socketNotifiers; + QVector pendingNotifiers; - + - // pending socket notifiers list - QSockNotType::List sn_pending_list; + QTimerInfoList timerList; - + QAtomicInt wakeUps; QAtomicInt interrupt; // bool -@@ -165,6 +140,34 @@ public: - +@@ -170,6 +145,34 @@ public: + #undef FINAL_EXCEPT_BLACKBERRY - + +inline QSocketNotifierSetUNIX::QSocketNotifierSetUNIX() Q_DECL_NOTHROW +{ + notifiers[0] = 0; @@ -1503,8 +1508,62 @@ index df08080..b76bb8e 100644 +} + QT_END_NAMESPACE - + #endif // QEVENTDISPATCHER_UNIX_P_H +diff --git a/src/corelib/kernel/qeventdispatcher_unix_p.h.patch b/src/corelib/kernel/qeventdispatcher_unix_p.h.patch +new file mode 100644 +index 0000000..ad568c9 +--- /dev/null ++++ b/src/corelib/kernel/qeventdispatcher_unix_p.h.patch +@@ -0,0 +1,48 @@ ++--- src/corelib/kernel/qeventdispatcher_unix_p.h +++++ src/corelib/kernel/qeventdispatcher_unix_p.h ++@@ -53,38 +53,21 @@ ++ #include "QtCore/qvarlengtharray.h" ++ #include "private/qtimerinfo_unix_p.h" ++ ++-#if !defined(Q_OS_VXWORKS) ++-# include ++-# if (!defined(Q_OS_HPUX) || defined(__ia64)) && !defined(Q_OS_NACL) ++-# include ++-# endif ++-#endif ++- ++ QT_BEGIN_NAMESPACE ++ ++-struct QSockNot ++-{ ++- QSocketNotifier *obj; ++- int fd; ++- fd_set *queue; ++-}; +++class QEventDispatcherUNIXPrivate; ++ ++-class QSockNotType +++struct Q_CORE_EXPORT QSocketNotifierSetUNIX Q_DECL_FINAL ++ { ++-public: ++- QSockNotType(); ++- ~QSockNotType(); +++ inline QSocketNotifierSetUNIX() Q_DECL_NOTHROW; ++ ++- typedef QPodList List; ++- ++- List list; ++- fd_set select_fds; ++- fd_set enabled_fds; ++- fd_set pending_fds; +++ inline bool isEmpty() const Q_DECL_NOTHROW; +++ inline short events() const Q_DECL_NOTHROW; ++ +++ QSocketNotifier *notifiers[3]; ++ }; ++ ++-class QEventDispatcherUNIXPrivate; +++Q_DECLARE_TYPEINFO(QSocketNotifierSetUNIX, Q_PRIMITIVE_TYPE); ++ ++ #ifdef Q_OS_QNX ++ # define FINAL_EXCEPT_BLACKBERRY diff --git a/src/corelib/kernel/qpoll.cpp b/src/corelib/kernel/qpoll.cpp new file mode 100644 index 0000000..b152518 @@ -1821,14 +1880,14 @@ index a356e21..79b9b9c 100644 --- a/src/network/socket/qlocalserver_unix.cpp +++ b/src/network/socket/qlocalserver_unix.cpp @@ -277,24 +277,27 @@ void QLocalServerPrivate::_q_onNewConnection() - + void QLocalServerPrivate::waitForNewConnection(int msec, bool *timedOut) { - fd_set readfds; - FD_ZERO(&readfds); - FD_SET(listenSocket, &readfds); + pollfd pfd = qt_make_pollfd(listenSocket, POLLIN); - + - struct timespec timeout; - timeout.tv_sec = msec / 1000; - timeout.tv_nsec = (msec % 1000) * 1000 * 1000; @@ -1843,7 +1902,7 @@ index a356e21..79b9b9c 100644 + _q_onNewConnection(); + return; + } - + - int result = -1; - result = qt_safe_select(listenSocket + 1, &readfds, 0, 0, (msec == -1) ? 0 : &timeout); - if (-1 == result) { @@ -1859,10 +1918,10 @@ index a356e21..79b9b9c 100644 - if (timedOut) - *timedOut = (result == 0); } - + void QLocalServerPrivate::setError(const QString &function) diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp -index bb0f11f..3e85217 100644 +index bb0f11f..4b5686e 100644 --- a/src/network/socket/qlocalsocket_unix.cpp +++ b/src/network/socket/qlocalsocket_unix.cpp @@ -507,36 +507,25 @@ void QLocalSocket::setReadBufferSize(qint64 size) @@ -1872,25 +1931,25 @@ index bb0f11f..3e85217 100644 + if (state() != ConnectingState) return (state() == ConnectedState); - + - fd_set fds; - FD_ZERO(&fds); - FD_SET(d->connectingSocket, &fds); + QElapsedTimer timer; + timer.start(); - + - timeval timeout; - timeout.tv_sec = msec / 1000; - timeout.tv_usec = (msec % 1000) * 1000; + pollfd pfd = qt_make_pollfd(d->connectingSocket, POLLIN); - + - // timeout can not be 0 or else select will return an error. - if (0 == msec) - timeout.tv_usec = 1000; + do { + const int timeout = (msec > 0) ? qMax(msec - timer.elapsed(), Q_INT64_C(0)) : msec; + const int result = qt_poll_msecs(&pfd, 1, timeout); - + - int result = -1; - // on Linux timeout will be updated by select, but _not_ on other systems. - QElapsedTimer timer; @@ -1911,15 +1970,15 @@ index bb0f11f..3e85217 100644 d->_q_connectToSocket(); - } + } while (state() == ConnectingState && !timer.hasExpired(msec)); - + return (state() == ConnectedState); } diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp -index 6a740f4..de86f27 100644 +index 1ce12ed..f8b3663 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp -@@ -1256,47 +1256,36 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c - +@@ -1257,47 +1257,36 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c + int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) const { - fd_set fds; @@ -1940,7 +1999,7 @@ index 6a740f4..de86f27 100644 + bool dummy; + return nativeSelect(timeout, selectForRead, !selectForRead, &dummy, &dummy); } - + int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool checkWrite, bool *selectForRead, bool *selectForWrite) const { @@ -1951,13 +2010,13 @@ index 6a740f4..de86f27 100644 if (checkRead) - FD_SET(socketDescriptor, &fdread); + pfd.events |= POLLIN; - + - fd_set fdwrite; - FD_ZERO(&fdwrite); if (checkWrite) - FD_SET(socketDescriptor, &fdwrite); + pfd.events |= POLLOUT; - + - struct timespec tv; - tv.tv_sec = timeout / 1000; - tv.tv_nsec = (timeout % 1000) * 1000 * 1000; @@ -1965,7 +2024,7 @@ index 6a740f4..de86f27 100644 - int ret; - ret = qt_safe_select(socketDescriptor + 1, &fdread, &fdwrite, 0, timeout < 0 ? 0 : &tv); + const int ret = qt_poll_msecs(&pfd, 1, timeout); - + if (ret <= 0) return ret; - *selectForRead = FD_ISSET(socketDescriptor, &fdread); @@ -1981,11 +2040,11 @@ index 6a740f4..de86f27 100644 + + *selectForRead = ((pfd.revents & read_flags) != 0); + *selectForWrite = ((pfd.revents & write_flags) != 0); - + return ret; } diff --git a/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp b/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp -index 8ffe4d8..c528891 100644 +index 7e057f3..020fe52 100644 --- a/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp +++ b/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp @@ -48,6 +48,7 @@ private slots: @@ -1999,7 +2058,7 @@ index 8ffe4d8..c528891 100644 @@ -353,6 +354,33 @@ void tst_QtConcurrentRun::runWaitLoop() run(fn).waitForFinished(); } - + +static bool allFinished(const QList > &futures) +{ + auto hasNotFinished = [](const QFuture &future) { return !future.isFinished(); }; @@ -2028,7 +2087,7 @@ index 8ffe4d8..c528891 100644 +} + QAtomicInt count; - + void recursiveRun(int level) diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp index c8bb4cd..9b2bada 100644 @@ -2036,7 +2095,7 @@ index c8bb4cd..9b2bada 100644 +++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp @@ -430,11 +430,8 @@ public slots: dataSent = serverSocket->waitForBytesWritten(-1); - + if (dataSent) { - fd_set fdread; - int fd = socket->socketDescriptor(); @@ -2046,7 +2105,7 @@ index c8bb4cd..9b2bada 100644 + pollfd pfd = qt_make_pollfd(socket->socketDescriptor(), POLLIN); + dataReadable = (1 == qt_safe_poll(&pfd, 1, nullptr)); } - + if (!dataReadable) { diff --git a/tests/manual/qt_poll/qt_poll.pro b/tests/manual/qt_poll/qt_poll.pro new file mode 100644 @@ -2223,32 +2282,32 @@ index 0000000..56e41e4 +QTEST_APPLESS_MAIN(tst_qt_poll) +#include "tst_qt_poll.moc" diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp -index 555ccbf..67a581a 100644 +index 88dcd81..9d41381 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp -@@ -1733,6 +1733,7 @@ void Configure::applySpecSpecifics() +@@ -1749,6 +1749,7 @@ void Configure::applySpecSpecifics() dictionary[ "QT_EVDEV" ] = "no"; dictionary[ "QT_MTDEV" ] = "no"; dictionary[ "FONT_CONFIG" ] = "auto"; + dictionary[ "POLL" ] = "poll"; dictionary[ "ANGLE" ] = "no"; - + dictionary["DECORATIONS"] = "default windows styled"; -@@ -1758,6 +1759,7 @@ void Configure::applySpecSpecifics() +@@ -1776,6 +1777,7 @@ void Configure::applySpecSpecifics() dictionary[ "QT_XKBCOMMON" ] = "no"; dictionary["ANDROID_STYLE_ASSETS"] = "yes"; dictionary[ "STYLE_ANDROID" ] = "yes"; + dictionary[ "POLL" ] = "poll"; } } - -@@ -3049,6 +3051,9 @@ void Configure::generateOutputVars() + +@@ -3094,6 +3096,9 @@ void Configure::generateOutputVars() if (dictionary["REDUCE_EXPORTS"] == "yes") qtConfig += "reduce_exports"; - + + if (!dictionary["POLL"].isEmpty()) + qtConfig += "poll_" + dictionary["POLL"]; + // We currently have no switch for QtConcurrent, so add it unconditionally. qtConfig += "concurrent"; - + diff --git a/SOURCES/qtbase-opensource-src-5.2.0-enable_ft_lcdfilter.patch b/SOURCES/qtbase-opensource-src-5.2.0-enable_ft_lcdfilter.patch deleted file mode 100644 index 1c0326e..0000000 --- a/SOURCES/qtbase-opensource-src-5.2.0-enable_ft_lcdfilter.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up qtbase-opensource-src-5.2.0/src/gui/text/qfontengine_ft.cpp.lcdfilter qtbase-opensource-src-5.2.0/src/gui/text/qfontengine_ft.cpp ---- qtbase-opensource-src-5.2.0/src/gui/text/qfontengine_ft.cpp.lcdfilter 2013-12-08 11:09:51.000000000 -0600 -+++ qtbase-opensource-src-5.2.0/src/gui/text/qfontengine_ft.cpp 2014-01-27 13:09:28.426065603 -0600 -@@ -69,7 +69,7 @@ - #include FT_CONFIG_OPTIONS_H - #endif - --#if defined(FT_LCD_FILTER_H) && defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING) -+#if defined(FT_LCD_FILTER_H) - #define QT_USE_FREETYPE_LCDFILTER - #endif - diff --git a/SOURCES/qtbase-opensource-src-5.3.2-QTBUG-35459.patch b/SOURCES/qtbase-opensource-src-5.3.2-QTBUG-35459.patch deleted file mode 100644 index 1ef698b..0000000 --- a/SOURCES/qtbase-opensource-src-5.3.2-QTBUG-35459.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -up qtbase-opensource-src-5.3.2/src/xml/sax/qxml.cpp.QTBUG-35459 qtbase-opensource-src-5.3.2/src/xml/sax/qxml.cpp -diff -up qtbase-opensource-src-5.3.2/src/xml/sax/qxml_p.h.QTBUG-35459 qtbase-opensource-src-5.3.2/src/xml/sax/qxml_p.h ---- qtbase-opensource-src-5.3.2/src/xml/sax/qxml_p.h.QTBUG-35459 2014-09-11 05:48:05.000000000 -0500 -+++ qtbase-opensource-src-5.3.2/src/xml/sax/qxml_p.h 2014-09-16 09:35:01.189255615 -0500 -@@ -223,7 +223,7 @@ private: - // for the DTD currently being parsed. - static const int dtdRecursionLimit = 2; - // The maximum amount of characters an entity value may contain, after expansion. -- static const int entityCharacterLimit = 1024; -+ static const int entityCharacterLimit = 65536; - - const QString &string(); - void stringClear(); diff --git a/SOURCES/qtbase-opensource-src-5.6.0-arm.patch b/SOURCES/qtbase-opensource-src-5.6.0-arm.patch deleted file mode 100644 index 63df719..0000000 --- a/SOURCES/qtbase-opensource-src-5.6.0-arm.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -up qtbase-opensource-src-5.6.0-beta/configure.than qtbase-opensource-src-5.6.0-beta/configure ---- qtbase-opensource-src-5.6.0-beta/configure.than 2016-02-12 13:56:20.057741037 +0100 -+++ qtbase-opensource-src-5.6.0-beta/configure 2016-02-12 14:10:10.267768256 +0100 -@@ -4346,6 +4346,9 @@ if [ "$QMAKESPEC" != "$XQMAKESPEC" ]; th - else - # not cross compiling, host == target - CFG_HOST_ARCH="$CFG_ARCH" -+ if [ "$CFG_ARCH" = "arm" ] ; then -+ CFG_CPUFEATURES="neon" -+ fi - CFG_HOST_CPUFEATURES="$CFG_CPUFEATURES" - fi - unset OUTFILE diff --git a/SOURCES/qtbase-opensource-src-5.6.2-QTBUG-35459.patch b/SOURCES/qtbase-opensource-src-5.6.2-QTBUG-35459.patch new file mode 100644 index 0000000..b5548fd --- /dev/null +++ b/SOURCES/qtbase-opensource-src-5.6.2-QTBUG-35459.patch @@ -0,0 +1,12 @@ +diff -up qtbase-opensource-src-5.6.2/src/xml/sax/qxml_p.h.QTBUG-35459 qtbase-opensource-src-5.6.2/src/xml/sax/qxml_p.h +--- qtbase-opensource-src-5.6.2/src/xml/sax/qxml_p.h.QTBUG-35459 2016-09-16 00:49:42.000000000 -0500 ++++ qtbase-opensource-src-5.6.2/src/xml/sax/qxml_p.h 2016-10-16 08:40:04.441725330 -0500 +@@ -217,7 +217,7 @@ private: + // for the DTD currently being parsed. + static const int dtdRecursionLimit = 2; + // The maximum amount of characters an entity value may contain, after expansion. +- static const int entityCharacterLimit = 1024; ++ static const int entityCharacterLimit = 65536; + + const QString &string(); + void stringClear(); diff --git a/SOURCES/qtbase-opensource-src-5.6.2-arm.patch b/SOURCES/qtbase-opensource-src-5.6.2-arm.patch new file mode 100644 index 0000000..90483e5 --- /dev/null +++ b/SOURCES/qtbase-opensource-src-5.6.2-arm.patch @@ -0,0 +1,13 @@ +diff -up qtbase-opensource-src-5.6.2/configure.arm qtbase-opensource-src-5.6.2/configure +--- qtbase-opensource-src-5.6.2/configure.arm 2016-09-16 00:49:42.000000000 -0500 ++++ qtbase-opensource-src-5.6.2/configure 2016-10-16 08:41:20.583267295 -0500 +@@ -4373,6 +4373,9 @@ if [ "$QMAKESPEC" != "$XQMAKESPEC" ]; th + else + # not cross compiling, host == target + CFG_HOST_ARCH="$CFG_ARCH" ++ if [ "$CFG_ARCH" = "arm" ] ; then ++ CFG_CPUFEATURES="neon" ++ fi + CFG_HOST_CPUFEATURES="$CFG_CPUFEATURES" + fi + unset OUTFILE diff --git a/SOURCES/qtbase-opensource-src-5.6.2-moc_system_defines.patch b/SOURCES/qtbase-opensource-src-5.6.2-moc_system_defines.patch new file mode 100644 index 0000000..b718b60 --- /dev/null +++ b/SOURCES/qtbase-opensource-src-5.6.2-moc_system_defines.patch @@ -0,0 +1,325 @@ +diff -up qtbase-opensource-src-5.6.2/mkspecs/features/moc.prf.moc_system_defines qtbase-opensource-src-5.6.2/mkspecs/features/moc.prf +--- qtbase-opensource-src-5.6.2/mkspecs/features/moc.prf.moc_system_defines 2016-09-16 00:49:42.000000000 -0500 ++++ qtbase-opensource-src-5.6.2/mkspecs/features/moc.prf 2016-10-16 08:42:20.561694271 -0500 +@@ -24,8 +24,25 @@ win32:count(MOC_INCLUDEPATH, 40, >) { + write_file($$absolute_path($$WIN_INCLUDETEMP, $$OUT_PWD), WIN_INCLUDETEMP_CONT)|error("Aborting.") + } + ++# QNX's compiler sets "gcc" config, but does not support the -dM option; ++# iOS builds are multi-arch, so this feature cannot possibly work. ++if(gcc|intel_icl|msvc):!rim_qcc:!ios { ++ moc_predefs.CONFIG = no_link ++ gcc: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -dM -E -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} ++ else:intel_icl: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -QdM -P -Fi${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} ++ else:msvc { ++ # make sure that our bin dir is first in path, so qmake is found ++ moc_predefs.commands = PATH $$shell_path($$[QT_INSTALL_BINS/src]);%PATH%& ++ moc_predefs.commands += $$QMAKE_CXX -Bxqmake $$QMAKE_CXXFLAGS -E ${QMAKE_FILE_IN} 2>NUL >${QMAKE_FILE_OUT} ++ } else: error("Oops, I messed up") ++ moc_predefs.output = $$MOC_DIR/moc_predefs.h ++ moc_predefs.input = MOC_PREDEF_FILE ++ silent: moc_predefs.commands = @echo generating $$moc_predefs.output$$escape_expand(\n\t)@$$moc_predefs.commands ++ QMAKE_EXTRA_COMPILERS += moc_predefs ++ MOC_PREDEF_FILE = $$[QT_HOST_DATA/src]/mkspecs/features/data/dummy.cpp ++} ++ + defineReplace(mocCmdBase) { +- RET = + !isEmpty(WIN_INCLUDETEMP) { + incvar = @$$WIN_INCLUDETEMP + } else { +@@ -34,7 +51,13 @@ defineReplace(mocCmdBase) { + incvar += -I$$shell_quote($$inc) + incvar += $$QMAKE_FRAMEWORKPATH_FLAGS + } +- RET += $$QMAKE_MOC $(DEFINES) $$join(QMAKE_COMPILER_DEFINES, " -D", -D) $$incvar $$QMAKE_MOC_OPTIONS ++ ++ RET = $$QMAKE_MOC $(DEFINES) ++ ++ isEmpty(MOC_PREDEF_FILE): RET += $$join(QMAKE_COMPILER_DEFINES, " -D", -D) ++ else: RET += --include $$moc_predefs.output ++ ++ RET += $$incvar $$QMAKE_MOC_OPTIONS + return($$RET) + } + +@@ -46,7 +69,7 @@ moc_header.output = $$MOC_DIR/$${QMAKE_H + moc_header.input = HEADERS + moc_header.variable_out = SOURCES + moc_header.name = MOC ${QMAKE_FILE_IN} +-moc_header.depends += $$WIN_INCLUDETEMP ++moc_header.depends += $$WIN_INCLUDETEMP $$moc_predefs.output + silent:moc_header.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_header.commands + QMAKE_EXTRA_COMPILERS += moc_header + INCREDIBUILD_XGE += moc_header +@@ -58,7 +81,7 @@ moc_source.commands = ${QMAKE_FUNC_mocCm + moc_source.output = $$MOC_DIR/$${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}$${QMAKE_EXT_CPP_MOC} + moc_source.input = SOURCES OBJECTIVE_SOURCES + moc_source.name = MOC ${QMAKE_FILE_IN} +-moc_source.depends += $$WIN_INCLUDETEMP ++moc_source.depends += $$WIN_INCLUDETEMP $$moc_predefs.output + silent:moc_source.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_source.commands + QMAKE_EXTRA_COMPILERS += moc_source + INCREDIBUILD_XGE += moc_source +diff -up qtbase-opensource-src-5.6.2/qmake/main.cpp.moc_system_defines qtbase-opensource-src-5.6.2/qmake/main.cpp +--- qtbase-opensource-src-5.6.2/qmake/main.cpp.moc_system_defines 2016-09-16 00:49:42.000000000 -0500 ++++ qtbase-opensource-src-5.6.2/qmake/main.cpp 2016-10-16 08:42:20.561694271 -0500 +@@ -1,6 +1,7 @@ + /**************************************************************************** + ** + ** Copyright (C) 2015 The Qt Company Ltd. ++** Copyright (C) 2015 Intel Corporation. + ** Contact: http://www.qt.io/licensing/ + ** + ** This file is part of the qmake application of the Qt Toolkit. +@@ -47,6 +48,10 @@ + #include + #include + ++#ifdef Q_OS_WIN ++# include ++#endif ++ + QT_BEGIN_NAMESPACE + + #ifdef Q_OS_WIN +@@ -246,6 +251,30 @@ static int doInstall(int argc, char **ar + return 3; + } + ++static int dumpMacros(const wchar_t *cmdline) ++{ ++ // from http://stackoverflow.com/questions/3665537/how-to-find-out-cl-exes-built-in-macros ++ int argc; ++ wchar_t **argv = CommandLineToArgvW(cmdline, &argc); ++ if (!argv) ++ return 2; ++ for (int i = 0; i < argc; ++i) { ++ if (argv[i][0] != L'-' || argv[i][1] != 'D') ++ continue; ++ ++ wchar_t *value = wcschr(argv[i], L'='); ++ if (value) { ++ *value = 0; ++ ++value; ++ } else { ++ // point to the NUL at the end, so we don't print anything ++ value = argv[i] + wcslen(argv[i]); ++ } ++ wprintf(L"#define %Ls %Ls\n", argv[i] + 2, value); ++ } ++ return 0; ++} ++ + #endif // Q_OS_WIN + + /* This is to work around lame implementation on Darwin. It has been noted that the getpwd(3) function +@@ -280,6 +309,15 @@ int runQMake(int argc, char **argv) + // Workaround for inferior/missing command line tools on Windows: make our own! + if (argc >= 2 && !strcmp(argv[1], "-install")) + return doInstall(argc - 2, argv + 2); ++ ++ { ++ // Support running as Visual C++'s compiler ++ const wchar_t *cmdline = _wgetenv(L"MSC_CMD_FLAGS"); ++ if (!cmdline || !*cmdline) ++ cmdline = _wgetenv(L"MSC_IDE_FLAGS"); ++ if (cmdline && *cmdline) ++ return dumpMacros(cmdline); ++ } + #endif + + QMakeVfs vfs; +diff -up qtbase-opensource-src-5.6.2/src/tools/moc/main.cpp.moc_system_defines qtbase-opensource-src-5.6.2/src/tools/moc/main.cpp +--- qtbase-opensource-src-5.6.2/src/tools/moc/main.cpp.moc_system_defines 2016-10-16 08:42:20.558694249 -0500 ++++ qtbase-opensource-src-5.6.2/src/tools/moc/main.cpp 2016-10-16 08:42:20.562694278 -0500 +@@ -263,6 +263,11 @@ int runMoc(int argc, char **argv) + prependIncludeOption.setValueName(QStringLiteral("file")); + parser.addOption(prependIncludeOption); + ++ QCommandLineOption includeOption(QStringLiteral("include")); ++ includeOption.setDescription(QStringLiteral("Parse as an #include before the main source(s).")); ++ includeOption.setValueName(QStringLiteral("file")); ++ parser.addOption(includeOption); ++ + QCommandLineOption noNotesWarningsCompatOption(QStringLiteral("n")); + noNotesWarningsCompatOption.setDescription(QStringLiteral("Do not display notes (-nn) or warnings (-nw). Compatibility option.")); + noNotesWarningsCompatOption.setValueName(QStringLiteral("which")); +@@ -412,7 +417,16 @@ int runMoc(int argc, char **argv) + moc.includes = pp.includes; + + // 1. preprocess +- moc.symbols = pp.preprocessed(moc.filename, &in); ++ foreach (const QString &includeName, parser.values(includeOption)) { ++ QByteArray rawName = pp.resolveInclude(QFile::encodeName(includeName), moc.filename); ++ QFile f(QFile::decodeName(rawName)); ++ if (f.open(QIODevice::ReadOnly)) { ++ moc.symbols += Symbol(0, MOC_INCLUDE_BEGIN, rawName); ++ moc.symbols += pp.preprocessed(rawName, &f); ++ moc.symbols += Symbol(0, MOC_INCLUDE_END, rawName); ++ } ++ } ++ moc.symbols += pp.preprocessed(moc.filename, &in); + + if (!pp.preprocessOnly) { + // 2. parse +diff -up qtbase-opensource-src-5.6.2/src/tools/moc/preprocessor.cpp.moc_system_defines qtbase-opensource-src-5.6.2/src/tools/moc/preprocessor.cpp +--- qtbase-opensource-src-5.6.2/src/tools/moc/preprocessor.cpp.moc_system_defines 2016-09-16 00:49:42.000000000 -0500 ++++ qtbase-opensource-src-5.6.2/src/tools/moc/preprocessor.cpp 2016-10-16 08:42:20.562694278 -0500 +@@ -1007,6 +1007,37 @@ static void mergeStringLiterals(Symbols + } + } + ++QByteArray Preprocessor::resolveInclude(const QByteArray &include, const QByteArray &relativeTo) ++{ ++ // #### stringery ++ QFileInfo fi; ++ if (!relativeTo.isEmpty()) ++ fi.setFile(QFileInfo(QString::fromLocal8Bit(relativeTo.constData())).dir(), QString::fromLocal8Bit(include.constData())); ++ for (int j = 0; j < Preprocessor::includes.size() && !fi.exists(); ++j) { ++ const IncludePath &p = Preprocessor::includes.at(j); ++ if (p.isFrameworkPath) { ++ const int slashPos = include.indexOf('/'); ++ if (slashPos == -1) ++ continue; ++ QByteArray frameworkCandidate = include.left(slashPos); ++ frameworkCandidate.append(".framework/Headers/"); ++ fi.setFile(QString::fromLocal8Bit(QByteArray(p.path + '/' + frameworkCandidate).constData()), QString::fromLocal8Bit(include.mid(slashPos + 1).constData())); ++ } else { ++ fi.setFile(QString::fromLocal8Bit(p.path.constData()), QString::fromLocal8Bit(include.constData())); ++ } ++ // try again, maybe there's a file later in the include paths with the same name ++ // (186067) ++ if (fi.isDir()) { ++ fi = QFileInfo(); ++ continue; ++ } ++ } ++ ++ if (!fi.exists() || fi.isDir()) ++ return QByteArray(); ++ return fi.canonicalFilePath().toLocal8Bit(); ++} ++ + void Preprocessor::preprocess(const QByteArray &filename, Symbols &preprocessed) + { + currentFilenames.push(filename); +@@ -1027,33 +1058,9 @@ void Preprocessor::preprocess(const QByt + continue; + until(PP_NEWLINE); + +- // #### stringery +- QFileInfo fi; +- if (local) +- fi.setFile(QFileInfo(QString::fromLocal8Bit(filename.constData())).dir(), QString::fromLocal8Bit(include.constData())); +- for (int j = 0; j < Preprocessor::includes.size() && !fi.exists(); ++j) { +- const IncludePath &p = Preprocessor::includes.at(j); +- if (p.isFrameworkPath) { +- const int slashPos = include.indexOf('/'); +- if (slashPos == -1) +- continue; +- QByteArray frameworkCandidate = include.left(slashPos); +- frameworkCandidate.append(".framework/Headers/"); +- fi.setFile(QString::fromLocal8Bit(QByteArray(p.path + '/' + frameworkCandidate).constData()), QString::fromLocal8Bit(include.mid(slashPos + 1).constData())); +- } else { +- fi.setFile(QString::fromLocal8Bit(p.path.constData()), QString::fromLocal8Bit(include.constData())); +- } +- // try again, maybe there's a file later in the include paths with the same name +- // (186067) +- if (fi.isDir()) { +- fi = QFileInfo(); +- continue; +- } +- } +- +- if (!fi.exists() || fi.isDir()) ++ include = resolveInclude(include, local ? filename : QByteArray()); ++ if (include.isNull()) + continue; +- include = fi.canonicalFilePath().toLocal8Bit(); + + if (Preprocessor::preprocessedIncludes.contains(include)) + continue; +@@ -1208,6 +1215,7 @@ Symbols Preprocessor::preprocessed(const + input = cleaned(input); + + // phase 2: tokenize for the preprocessor ++ index = 0; + symbols = tokenize(input); + + #if 0 +diff -up qtbase-opensource-src-5.6.2/src/tools/moc/preprocessor.h.moc_system_defines qtbase-opensource-src-5.6.2/src/tools/moc/preprocessor.h +--- qtbase-opensource-src-5.6.2/src/tools/moc/preprocessor.h.moc_system_defines 2016-09-16 00:49:42.000000000 -0500 ++++ qtbase-opensource-src-5.6.2/src/tools/moc/preprocessor.h 2016-10-16 08:42:20.562694278 -0500 +@@ -67,6 +67,7 @@ public: + QList frameworks; + QSet preprocessedIncludes; + Macros macros; ++ QByteArray resolveInclude(const QByteArray &filename, const QByteArray &relativeTo); + Symbols preprocessed(const QByteArray &filename, QFile *device); + + void parseDefineArguments(Macro *m); +diff -up qtbase-opensource-src-5.6.2/tests/auto/tools/moc/subdir/extradefines.h.moc_system_defines qtbase-opensource-src-5.6.2/tests/auto/tools/moc/subdir/extradefines.h +--- qtbase-opensource-src-5.6.2/tests/auto/tools/moc/subdir/extradefines.h.moc_system_defines 2016-10-16 08:42:20.562694278 -0500 ++++ qtbase-opensource-src-5.6.2/tests/auto/tools/moc/subdir/extradefines.h 2016-10-16 08:42:20.562694278 -0500 +@@ -0,0 +1 @@ ++#define FOO 1 +diff -up qtbase-opensource-src-5.6.2/tests/auto/tools/moc/tst_moc.cpp.moc_system_defines qtbase-opensource-src-5.6.2/tests/auto/tools/moc/tst_moc.cpp +--- qtbase-opensource-src-5.6.2/tests/auto/tools/moc/tst_moc.cpp.moc_system_defines 2016-09-16 00:49:42.000000000 -0500 ++++ qtbase-opensource-src-5.6.2/tests/auto/tools/moc/tst_moc.cpp 2016-10-16 08:42:20.562694278 -0500 +@@ -581,6 +581,8 @@ private slots: + void frameworkSearchPath(); + void cstyleEnums(); + void defineMacroViaCmdline(); ++ void defineMacroViaForcedInclude(); ++ void defineMacroViaForcedIncludeRelative(); + void specifyMetaTagsFromCmdline(); + void invokable(); + void singleFunctionKeywordSignalAndSlot(); +@@ -1248,6 +1250,46 @@ void tst_Moc::defineMacroViaCmdline() + args << m_sourceDirectory + QStringLiteral("/macro-on-cmdline.h"); + + proc.start(m_moc, args); ++ QVERIFY(proc.waitForFinished()); ++ QCOMPARE(proc.exitCode(), 0); ++ QCOMPARE(proc.readAllStandardError(), QByteArray()); ++ QByteArray mocOut = proc.readAllStandardOutput(); ++ QVERIFY(!mocOut.isEmpty()); ++#else ++ QSKIP("Only tested on linux/gcc"); ++#endif ++} ++ ++void tst_Moc::defineMacroViaForcedInclude() ++{ ++#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) ++ QProcess proc; ++ ++ QStringList args; ++ args << "--include" << m_sourceDirectory + QLatin1String("/subdir/extradefines.h"); ++ args << m_sourceDirectory + QStringLiteral("/macro-on-cmdline.h"); ++ ++ proc.start(m_moc, args); ++ QVERIFY(proc.waitForFinished()); ++ QCOMPARE(proc.exitCode(), 0); ++ QCOMPARE(proc.readAllStandardError(), QByteArray()); ++ QByteArray mocOut = proc.readAllStandardOutput(); ++ QVERIFY(!mocOut.isEmpty()); ++#else ++ QSKIP("Only tested on linux/gcc"); ++#endif ++} ++ ++void tst_Moc::defineMacroViaForcedIncludeRelative() ++{ ++#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) ++ QProcess proc; ++ ++ QStringList args; ++ args << "--include" << QStringLiteral("extradefines.h") << "-I" + m_sourceDirectory + "/subdir"; ++ args << m_sourceDirectory + QStringLiteral("/macro-on-cmdline.h"); ++ ++ proc.start(m_moc, args); + QVERIFY(proc.waitForFinished()); + QCOMPARE(proc.exitCode(), 0); + QCOMPARE(proc.readAllStandardError(), QByteArray()); diff --git a/SPECS/qt5-qtbase.spec b/SPECS/qt5-qtbase.spec index 728c42f..b895c64 100644 --- a/SPECS/qt5-qtbase.spec +++ b/SPECS/qt5-qtbase.spec @@ -52,17 +52,15 @@ BuildRequires: pkgconfig(libsystemd) %global tests 1 %endif -#define prerelease rc - Summary: Qt5 - QtBase components Name: qt5-qtbase -Version: 5.6.1 -Release: 10%{?prerelease:.%{prerelease}}%{?dist} +Version: 5.6.2 +Release: 1%{?dist} # See LGPL_EXCEPTIONS.txt, for exception details License: LGPLv2 with exceptions or GPLv3 with exceptions Url: http://qt-project.org/ -Source0: http://download.qt.io/official_releases/qt/5.6/%{version}%{?prerelease:-%{prerelease}}/submodules/%{qt_module}-opensource-src-%{version}%{?prerelease:-%{prerelease}}.tar.xz +Source0: http://download.qt.io/official_releases/qt/5.6/%{version}/submodules/%{qt_module}-opensource-src-%{version}.tar.xz # https://bugzilla.redhat.com/show_bug.cgi?id=1227295 Source1: qtlogging.ini @@ -79,10 +77,7 @@ Source6: 10-qt5-check-opengl2.sh Patch2: qtbase-multilib_optflags.patch # fix QTBUG-35459 (too low entityCharacterLimit=1024 for CVE-2013-4549) -Patch4: qtbase-opensource-src-5.3.2-QTBUG-35459.patch - -# unconditionally enable freetype lcdfilter support -Patch12: qtbase-opensource-src-5.2.0-enable_ft_lcdfilter.patch +Patch4: qtbase-opensource-src-5.6.2-QTBUG-35459.patch # upstreamable patches # support poll @@ -95,11 +90,11 @@ Patch50: qt5-poll.patch Patch52: qtbase-opensource-src-5.6.0-moc_WORDSIZE.patch # arm patch -Patch54: qtbase-opensource-src-5.6.0-arm.patch +Patch54: qtbase-opensource-src-5.6.2-arm.patch # recently passed code review, not integrated yet # https://codereview.qt-project.org/126102/ -Patch60: moc-get-the-system-defines-from-the-compiler-itself.patch +Patch60: qtbase-opensource-src-5.6.2-moc_system_defines.patch # drop -O3 and make -O2 by default Patch61: qt5-qtbase-cxxflag.patch @@ -354,10 +349,9 @@ RPM macros for building Qt5 packages. %prep -%setup -q -n %{qt_module}-opensource-src-%{version}%{?prerelease:-%{prerelease}} +%setup -q -n %{qt_module}-opensource-src-%{version} %patch4 -p1 -b .QTBUG-35459 -%patch12 -p1 -b .enable_ft_lcdfilter %patch50 -p1 -b .qt5-poll.patch %patch52 -p1 -b .moc_WORDSIZE @@ -389,9 +383,6 @@ sed -i -e "s|^\(QMAKE_LFLAGS_RELEASE.*\)|\1 $RPM_LD_FLAGS|" \ sed -i -e 's|^\(QMAKE_STRIP.*=\).*$|\1|g' mkspecs/common/linux.conf %endif -%if 0%{?prerelease} -bin/syncqt.pl -version %{version} -%endif # move some bundled libs to ensure they're not accidentally used pushd src/3rdparty @@ -930,6 +921,8 @@ fi %{_qt5_libdir}/cmake/Qt5Gui/Qt5Gui_QEglFSX11IntegrationPlugin.cmake %{_qt5_libdir}/cmake/Qt5Gui/Qt5Gui_QXcbEglIntegrationPlugin.cmake %endif +%{_qt5_plugindir}/egldeviceintegrations/libqeglfs-kms-egldevice-integration.so +%{_qt5_libdir}/cmake/Qt5Gui/Qt5Gui_QEglFSKmsEglDeviceIntegrationPlugin.cmake %{_qt5_plugindir}/platforms/libqlinuxfb.so %{_qt5_plugindir}/platforms/libqminimal.so %{_qt5_plugindir}/platforms/libqoffscreen.so @@ -950,6 +943,10 @@ fi %changelog +* Wed Jan 11 2017 Jan Grulich - 5.6.2-1 +- Update to 5.6.2 + Resolves: bz#1384812 + * Tue Aug 30 2016 Jan Grulich - 5.6.1-10 - Increase build version to have newer version than in EPEL Resolves: bz#1317396