diff options
78 files changed, 877 insertions, 111 deletions
diff --git a/config.tests/unix/journald/journald.c b/config.tests/unix/journald/journald.c new file mode 100644 index 0000000000..470d526e68 --- /dev/null +++ b/config.tests/unix/journald/journald.c @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Jolla Ltd, author: <robin.burchell@jollamobile.com> +** Contact: http://www.qt-project.org/legal +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <systemd/sd-journal.h> + +int main(int argc, char **argv) +{ + sd_journal_print_with_location(LOG_INFO, "CODE_FILE=foo.c", "CODE_LINE=0", "unknown_function", "test message"); + return 0; +} diff --git a/config.tests/unix/journald/journald.pro b/config.tests/unix/journald/journald.pro new file mode 100644 index 0000000000..2bb50ceb71 --- /dev/null +++ b/config.tests/unix/journald/journald.pro @@ -0,0 +1,6 @@ +SOURCES = journald.c + +CONFIG += link_pkgconfig +PKGCONFIG_PRIVATE += libsystemd-journal + +CONFIG -= qt @@ -596,6 +596,7 @@ CFG_XINERAMA=runtime CFG_XFIXES=runtime CFG_ZLIB=auto CFG_MTDEV=auto +CFG_JOURNALD=no CFG_SQLITE=qt CFG_GIF=auto CFG_PNG=yes @@ -1590,6 +1591,13 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; + journald) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_JOURNALD="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; sqlite) if [ "$VAL" = "system" ]; then CFG_SQLITE=system @@ -2307,6 +2315,9 @@ Third Party Libraries: -no-mtdev ......... Do not compile mtdev support. + -mtdev ............. Enable mtdev support. + + -no-journald ....... Do not send logging output to journald. + -journald .......... Send logging output to journald. + -no-gif ............ Do not compile GIF reading support. -no-libpng ......... Do not compile PNG support. @@ -4416,6 +4427,23 @@ if [ "$CFG_MTDEV" = "no" ]; then QMakeVar add DEFINES QT_NO_MTDEV fi +if [ "$CFG_JOURNALD" != "no" ]; then + if compileTest unix/journald "journald"; then + CFG_JOURNALD=yes + QMAKE_CONFIG="$QMAKE_CONFIG journald" + else + if [ "$CFG_JOURNALD" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "journald support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_JOURNALD=no + fi + fi +fi + if [ "$CFG_LARGEFILE" = "auto" ]; then #Large files should be enabled for all Linux systems CFG_LARGEFILE=yes @@ -5166,6 +5194,14 @@ if [ "$CFG_XCB" != "no" ]; then else CFG_XCB="system" + if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "x11" 2> /dev/null; then + QMAKE_X11_PREFIX="`$PKG_CONFIG --variable=prefix x11`" + else + # default to LSB prefix + QMAKE_X11_PREFIX="/usr" + fi + QMakeVar set QMAKE_X11_PREFIX "$QMAKE_X11_PREFIX" + if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xcb >= 1.5" 2>/dev/null; then XCB_PACKAGES="xcb xcb-shm xcb-sync xcb-xfixes xcb-randr xcb-image xcb-keysyms xcb-icccm" QMAKE_CFLAGS_XCB="`$PKG_CONFIG --cflags $XCB_PACKAGES 2>/dev/null`" @@ -6716,6 +6752,7 @@ report_support_plugin " JPEG ................." "$CFG_JPEG" "$CFG_LIBJPEG" Qt report_support_plugin " PNG .................." "$CFG_PNG" "$CFG_LIBPNG" QtGui report_support " Glib ..................." "$CFG_GLIB" report_support " GTK theme .............." "$CFG_QGTKSTYLE" +report_support " journald ..............." "$CFG_JOURNALD" report_support " Large File ............." "$CFG_LARGEFILE" report_support " mtdev .................." "$CFG_MTDEV" yes "system library" report_support " Networking:" diff --git a/mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp b/mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp index 5e57ba382a..6cee63abbc 100644 --- a/mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp +++ b/mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp @@ -40,7 +40,6 @@ ****************************************************************************/ #include "qeglfshooks.h" -#include "qeglfscursor.h" #include <QtDebug> diff --git a/src/3rdparty/xkbcommon.pri b/src/3rdparty/xkbcommon.pri index d437c6b8b6..21a3e78e1c 100644 --- a/src/3rdparty/xkbcommon.pri +++ b/src/3rdparty/xkbcommon.pri @@ -1,7 +1,7 @@ QMAKE_CFLAGS += -std=gnu99 -w INCLUDEPATH += $$PWD/xkbcommon $$PWD/xkbcommon/src $$PWD/xkbcommon/src/xkbcomp -DEFINES += DFLT_XKB_CONFIG_ROOT='\\"/usr/share/X11/xkb\\"' +DEFINES += DFLT_XKB_CONFIG_ROOT='\\"$$QMAKE_X11_PREFIX/share/X11/xkb\\"' ### RMLVO names can be overwritten with environmental variables (See libxkbcommon documentation) DEFINES += DEFAULT_XKB_RULES='\\"evdev\\"' diff --git a/src/corelib/doc/snippets/code/qlogging/qlogging.cpp b/src/corelib/doc/snippets/code/qlogging/qlogging.cpp index 774610a3c0..d3b9e1fd14 100644 --- a/src/corelib/doc/snippets/code/qlogging/qlogging.cpp +++ b/src/corelib/doc/snippets/code/qlogging/qlogging.cpp @@ -52,3 +52,7 @@ } } //! [1] + +//! [2] + QLoggingCategory &category(); +//! [2] diff --git a/src/corelib/doc/snippets/qloggingcategory/main.cpp b/src/corelib/doc/snippets/qloggingcategory/main.cpp index c1dad7f43a..628243dbdd 100644 --- a/src/corelib/doc/snippets/qloggingcategory/main.cpp +++ b/src/corelib/doc/snippets/qloggingcategory/main.cpp @@ -128,6 +128,27 @@ oldCategoryFilter = QLoggingCategory::installFilter(myCategoryFilter); //![12] } + { +//![13] + QLoggingCategory category("qt.driver.usb"); + qCDebug(category, "a debug message logged into category %s", category.categoryName()); +//![13] + } + + { +//![14] + QLoggingCategory category("qt.driver.usb"); + qCWarning(category, "a warning message logged into category %s", category.categoryName()); +//![14] + } + + { +//![15] + QLoggingCategory category("qt.driver.usb"); + qCCritical(category, "a critical message logged into category %s", category.categoryName()); +//![15] + } + return 0; } diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index fd031469f6..789f500cab 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -51,3 +51,9 @@ slog2 { LIBS_PRIVATE += -lslog2 DEFINES += QT_USE_SLOG2 } + +journald { + CONFIG += link_pkgconfig + PKGCONFIG_PRIVATE += libsystemd-journal + DEFINES += QT_USE_JOURNALD +} diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 28493311fb..dbe28da120 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -46,10 +46,10 @@ #include "qvarlengtharray.h" #include "qdebug.h" #include "qmutex.h" +#include "qloggingcategory.h" #ifndef QT_BOOTSTRAPPED #include "qcoreapplication.h" #include "qthread.h" -#include "qloggingcategory.h" #include "private/qloggingregistry_p.h" #endif #ifdef Q_OS_WIN @@ -63,6 +63,11 @@ #include <android/log.h> #endif +#if defined(QT_USE_JOURNALD) && !defined(QT_BOOTSTRAPPED) +# include <systemd/sd-journal.h> +# include <unistd.h> +#endif + #include <stdio.h> QT_BEGIN_NAMESPACE @@ -265,6 +270,74 @@ void QMessageLogger::debug(const char *msg, ...) const qt_message_fatal(QtDebugMsg, context, message); } +/*! + \typedef QMessageLogger::CategoryFunction + + This is a typedef for a pointer to a function with the following + signature: + + \snippet code/qlogging/qlogging.cpp 2 + + A function which this signature is generated by Q_DECLARE_LOGGING_CATEGORY, + Q_LOGGING_CATEGORY. + + \since 5.3 +*/ + +/*! + Logs a debug message specified with format \a msg for the context \a cat. + Additional parameters, specified by \a msg, may be used. + + \since 5.3 + \sa qCDebug() +*/ +void QMessageLogger::debug(const QLoggingCategory &cat, const char *msg, ...) const +{ + if (!cat.isDebugEnabled()) + return; + + QMessageLogContext ctxt; + ctxt.copy(context); + ctxt.category = cat.categoryName(); + + QString message; + + va_list ap; + va_start(ap, msg); // use variable arg list + qt_message(QtDebugMsg, ctxt, msg, ap, message); + va_end(ap); + + if (isFatal(QtDebugMsg)) + qt_message_fatal(QtDebugMsg, ctxt, message); +} + +/*! + Logs a debug message specified with format \a msg for the context returned + by \a catFunc. Additional parameters, specified by \a msg, may be used. + + \since 5.3 + \sa qCDebug() +*/ +void QMessageLogger::debug(QMessageLogger::CategoryFunction catFunc, + const char *msg, ...) const +{ + const QLoggingCategory &cat = (*catFunc)(); + + QMessageLogContext ctxt; + ctxt.copy(context); + ctxt.category = cat.categoryName(); + + QString message; + + va_list ap; + va_start(ap, msg); // use variable arg list + qt_message(QtDebugMsg, ctxt, msg, ap, message); + va_end(ap); + + if (isFatal(QtDebugMsg)) + qt_message_fatal(QtDebugMsg, ctxt, message); +} + #ifndef QT_NO_DEBUG_STREAM /*! @@ -281,6 +354,36 @@ QDebug QMessageLogger::debug() const } /*! + Logs a debug message into category \a cat using a QDebug stream. + + \since 5.3 + \sa qCDebug(), QDebug +*/ +QDebug QMessageLogger::debug(const QLoggingCategory &cat) const +{ + QDebug dbg = QDebug(QtDebugMsg); + if (!cat.isDebugEnabled()) + dbg.stream->message_output = false; + + QMessageLogContext &ctxt = dbg.stream->context; + ctxt.copy(context); + ctxt.category = cat.categoryName(); + + return dbg; +} + +/*! + Logs a debug message into category returned by \a catFunc using a QDebug stream. + + \since 5.3 + \sa qCDebug(), QDebug +*/ +QDebug QMessageLogger::debug(QMessageLogger::CategoryFunction catFunc) const +{ + return debug((*catFunc)()); +} + +/*! \internal Returns a QNoDebug object, which is used to ignore debugging output. @@ -314,9 +417,65 @@ void QMessageLogger::warning(const char *msg, ...) const qt_message_fatal(QtWarningMsg, context, message); } +/*! + Logs a warning message specified with format \a msg for the context \a cat. + Additional parameters, specified by \a msg, may be used. + + \since 5.3 + \sa qCWarning() +*/ +void QMessageLogger::warning(const QLoggingCategory &cat, const char *msg, ...) const +{ + if (!cat.isWarningEnabled()) + return; + + QMessageLogContext ctxt; + ctxt.copy(context); + ctxt.category = cat.categoryName(); + + QString message; + + va_list ap; + va_start(ap, msg); // use variable arg list + qt_message(QtWarningMsg, ctxt, msg, ap, message); + va_end(ap); + + if (isFatal(QtWarningMsg)) + qt_message_fatal(QtWarningMsg, ctxt, message); +} + +/*! + Logs a warning message specified with format \a msg for the context returned + by \a catFunc. Additional parameters, specified by \a msg, may be used. + + \since 5.3 + \sa qCWarning() +*/ +void QMessageLogger::warning(QMessageLogger::CategoryFunction catFunc, + const char *msg, ...) const +{ + const QLoggingCategory &cat = (*catFunc)(); + if (!cat.isWarningEnabled()) + return; + + QMessageLogContext ctxt; + ctxt.copy(context); + ctxt.category = cat.categoryName(); + + QString message; + + va_list ap; + va_start(ap, msg); // use variable arg list + qt_message(QtWarningMsg, ctxt, msg, ap, message); + va_end(ap); + + if (isFatal(QtWarningMsg)) + qt_message_fatal(QtWarningMsg, ctxt, message); +} + #ifndef QT_NO_DEBUG_STREAM /*! - Logs a debug message using a QDebug stream + Logs a warning message using a QDebug stream \sa qWarning(), QDebug */ @@ -327,6 +486,36 @@ QDebug QMessageLogger::warning() const ctxt.copy(context); return dbg; } + +/*! + Logs a warning message into category \a cat using a QDebug stream. + + \sa qCWarning(), QDebug +*/ +QDebug QMessageLogger::warning(const QLoggingCategory &cat) const +{ + QDebug dbg = QDebug(QtWarningMsg); + if (!cat.isWarningEnabled()) + dbg.stream->message_output = false; + + QMessageLogContext &ctxt = dbg.stream->context; + ctxt.copy(context); + ctxt.category = cat.categoryName(); + + return dbg; +} + +/*! + Logs a warning message into category returned by \a catFunc using a QDebug stream. + + \since 5.3 + \sa qCWarning(), QDebug +*/ +QDebug QMessageLogger::warning(QMessageLogger::CategoryFunction catFunc) const +{ + return warning((*catFunc)()); +} + #endif #undef qCritical @@ -350,6 +539,62 @@ void QMessageLogger::critical(const char *msg, ...) const qt_message_fatal(QtCriticalMsg, context, message); } +/*! + Logs a critical message specified with format \a msg for the context \a cat. + Additional parameters, specified by \a msg, may be used. + + \since 5.3 + \sa qCCritical() +*/ +void QMessageLogger::critical(const QLoggingCategory &cat, const char *msg, ...) const +{ + if (!cat.isCriticalEnabled()) + return; + + QMessageLogContext ctxt; + ctxt.copy(context); + ctxt.category = cat.categoryName(); + + QString message; + + va_list ap; + va_start(ap, msg); // use variable arg list + qt_message(QtCriticalMsg, ctxt, msg, ap, message); + va_end(ap); + + if (isFatal(QtCriticalMsg)) + qt_message_fatal(QtCriticalMsg, ctxt, message); +} + +/*! + Logs a critical message specified with format \a msg for the context returned + by \a catFunc. Additional parameters, specified by \a msg, may be used. + + \since 5.3 + \sa qCCritical() +*/ +void QMessageLogger::critical(QMessageLogger::CategoryFunction catFunc, + const char *msg, ...) const +{ + const QLoggingCategory &cat = (*catFunc)(); + if (!cat.isCriticalEnabled()) + return; + + QMessageLogContext ctxt; + ctxt.copy(context); + ctxt.category = cat.categoryName(); + + QString message; + + va_list ap; + va_start(ap, msg); // use variable arg list + qt_message(QtCriticalMsg, ctxt, msg, ap, message); + va_end(ap); + + if (isFatal(QtCriticalMsg)) + qt_message_fatal(QtCriticalMsg, ctxt, message); +} + #ifndef QT_NO_DEBUG_STREAM /*! Logs a critical message using a QDebug stream @@ -363,6 +608,37 @@ QDebug QMessageLogger::critical() const ctxt.copy(context); return dbg; } + +/*! + Logs a critical message into category \a cat using a QDebug stream. + + \since 5.3 + \sa qCCritical(), QDebug +*/ +QDebug QMessageLogger::critical(const QLoggingCategory &cat) const +{ + QDebug dbg = QDebug(QtCriticalMsg); + if (!cat.isCriticalEnabled()) + dbg.stream->message_output = false; + + QMessageLogContext &ctxt = dbg.stream->context; + ctxt.copy(context); + ctxt.category = cat.categoryName(); + + return dbg; +} + +/*! + Logs a critical message into category returned by \a catFunc using a QDebug stream. + + \since 5.3 + \sa qCCritical(), QDebug +*/ +QDebug QMessageLogger::critical(QMessageLogger::CategoryFunction catFunc) const +{ + return critical((*catFunc)()); +} + #endif #undef qFatal @@ -866,6 +1142,37 @@ Q_CORE_EXPORT QtMsgHandler qInstallMsgHandler(QtMsgHandler); static QtMsgHandler msgHandler = 0; // pointer to debug handler (without context) static QtMessageHandler messageHandler = 0; // pointer to debug handler (with context) +#if defined(QT_USE_JOURNALD) && !defined(QT_BOOTSTRAPPED) +static void systemd_default_message_handler(QtMsgType type, + const QMessageLogContext &context, + const QString &message) +{ + int priority = LOG_INFO; // Informational + switch (type) { + case QtDebugMsg: + priority = LOG_DEBUG; // Debug-level messages + break; + case QtWarningMsg: + priority = LOG_WARNING; // Warning conditions + break; + case QtCriticalMsg: + priority = LOG_CRIT; // Critical conditions + break; + case QtFatalMsg: + priority = LOG_ALERT; // Action must be taken immediately + break; + } + + char filebuf[PATH_MAX + sizeof("CODE_FILE=")]; + snprintf(filebuf, sizeof(filebuf), "CODE_FILE=%s", context.file ? context.file : "unknown"); + + char linebuf[20]; + snprintf(linebuf, sizeof(linebuf), "CODE_LINE=%d", context.line); + + sd_journal_print_with_location(priority, filebuf, linebuf, context.function ? context.function : "unknown", "%s", message.toUtf8().constData()); +} +#endif + #ifdef Q_OS_ANDROID static void android_default_message_handler(QtMsgType type, const QMessageLogContext &context, @@ -902,6 +1209,18 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con #if defined(QT_USE_SLOG2) slog2_default_handler(type, logMessage.toLocal8Bit().constData()); +#elif defined(QT_USE_JOURNALD) && !defined(QT_BOOTSTRAPPED) + // We use isatty to catch the obvious case of someone running something interactively. + // We also support an environment variable for Qt Creator use, or more complicated cases like subprocesses. + static bool logToConsole = isatty(fileno(stdin)) || !qEnvironmentVariableIsEmpty("QT_NO_JOURNALD_LOG"); + if (Q_LIKELY(!logToConsole)) { + // remove trailing \n, systemd appears to want them newline-less + logMessage.chop(1); + systemd_default_message_handler(type, context, logMessage); + } else { + fprintf(stderr, "%s", logMessage.toUtf8().constData()); + fflush(stderr); + } #elif defined(Q_OS_ANDROID) static bool logToAndroid = qEnvironmentVariableIsEmpty("QT_ANDROID_PLAIN_LOG"); if (logToAndroid) { diff --git a/src/corelib/global/qlogging.h b/src/corelib/global/qlogging.h index 5ae1fb3205..6d651ee8a0 100644 --- a/src/corelib/global/qlogging.h +++ b/src/corelib/global/qlogging.h @@ -82,6 +82,8 @@ private: friend class QDebug; }; +class QLoggingCategory; + class Q_CORE_EXPORT QMessageLogger { Q_DISABLE_COPY(QMessageLogger) @@ -98,6 +100,15 @@ public: void warning(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); void critical(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); + typedef QLoggingCategory &(*CategoryFunction)(); + + void debug(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + void debug(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + void warning(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + void warning(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + void critical(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + void critical(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + #ifndef Q_CC_MSVC Q_NORETURN #endif @@ -105,8 +116,14 @@ public: #ifndef QT_NO_DEBUG_STREAM QDebug debug() const; + QDebug debug(const QLoggingCategory &cat) const; + QDebug debug(CategoryFunction catFunc) const; QDebug warning() const; + QDebug warning(const QLoggingCategory &cat) const; + QDebug warning(CategoryFunction catFunc) const; QDebug critical() const; + QDebug critical(const QLoggingCategory &cat) const; + QDebug critical(CategoryFunction catFunc) const; QNoDebug noDebug() const Q_DECL_NOTHROW; #endif // QT_NO_DEBUG_STREAM diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp index 93a98b1835..8c3ca5fd65 100644 --- a/src/corelib/io/qloggingcategory.cpp +++ b/src/corelib/io/qloggingcategory.cpp @@ -326,6 +326,25 @@ void QLoggingCategory::setFilterRules(const QString &rules) */ /*! + \macro qCDebug(category, const char *message, ...) + \relates QLoggingCategory + \since 5.3 + + Logs a debug message \a message in the logging category \a category. + \a message might contain place holders that are replaced by additional + arguments, similar to the C printf() function. + + Example: + + \snippet qloggingcategory/main.cpp 13 + + \note Arguments might not be processed if debug output for the category is + not enabled, so do not rely on any side effects. + + \sa qDebug() +*/ + +/*! \macro qCWarning(category) \relates QLoggingCategory \since 5.2 @@ -348,6 +367,25 @@ void QLoggingCategory::setFilterRules(const QString &rules) */ /*! + \macro qCWarning(category, const char *message, ...) + \relates QLoggingCategory + \since 5.3 + + Logs a warning message \a message in the logging category \a category. + \a message might contain place holders that are replaced by additional + arguments, similar to the C printf() function. + + Example: + + \snippet qloggingcategory/main.cpp 14 + + \note Arguments might not be processed if warning output for the category is + not enabled, so do not rely on any side effects. + + \sa qWarning() +*/ + +/*! \macro qCCritical(category) \relates QLoggingCategory \since 5.2 @@ -370,6 +408,24 @@ void QLoggingCategory::setFilterRules(const QString &rules) */ /*! + \macro qCCritical(category, const char *message, ...) + \relates QLoggingCategory + \since 5.3 + + Logs a critical message \a message in the logging category \a category. + \a message might contain place holders that are replaced by additional + arguments, similar to the C printf() function. + + Example: + + \snippet qloggingcategory/main.cpp 15 + + \note Arguments might not be processed if critical output for the category + is not enabled, so do not rely on any side effects. + + \sa qCritical() +*/ +/*! \macro Q_DECLARE_LOGGING_CATEGORY(name) \relates QLoggingCategory \since 5.2 diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h index 15c0519827..1e8823e92b 100644 --- a/src/corelib/io/qloggingcategory.h +++ b/src/corelib/io/qloggingcategory.h @@ -94,15 +94,26 @@ private: return category; \ } -#define qCDebug(category) \ +#ifdef Q_COMPILER_VARIADIC_MACROS + +#define qCDebug(category, ...) \ for (bool enabled = category().isDebugEnabled(); Q_UNLIKELY(enabled); enabled = false) \ - QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).debug() -#define qCWarning(category) \ + QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).debug(__VA_ARGS__) +#define qCWarning(category, ...) \ for (bool enabled = category().isWarningEnabled(); enabled; enabled = false) \ - QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).warning() -#define qCCritical(category) \ + QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).warning(__VA_ARGS__) +#define qCCritical(category, ...) \ for (bool enabled = category().isCriticalEnabled(); enabled; enabled = false) \ - QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).critical() + QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).critical(__VA_ARGS__) + +#else + +// check for enabled category inside QMessageLogger. +#define qCDebug qDebug +#define qCWarning qWarning +#define qCCritical qCritical + +#endif // Q_COMPILER_VARIADIC_MACROS #if defined(QT_NO_DEBUG_OUTPUT) # undef qCDebug diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 2dd56423ac..68bec5472f 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2628,10 +2628,12 @@ void QCoreApplication::setEventDispatcher(QAbstractEventDispatcher *eventDispatc \fn void qAddPostRoutine(QtCleanUpFunction ptr) \relates QCoreApplication - Adds a global routine that will be called from the QApplication + Adds a global routine that will be called from the QCoreApplication destructor. This function is normally used to add cleanup routines for program-wide functionality. + The cleanup routines are called in the reverse order of their addition. + The function specified by \a ptr should take no arguments and should return nothing. For example: @@ -2640,8 +2642,11 @@ void QCoreApplication::setEventDispatcher(QAbstractEventDispatcher *eventDispatc Note that for an application- or module-wide cleanup, qAddPostRoutine() is often not suitable. For example, if the program is split into dynamically loaded modules, the relevant - module may be unloaded long before the QApplication destructor is - called. + module may be unloaded long before the QCoreApplication destructor is + called. In such cases, if using qAddPostRoutine() is still desirable, + qRemovePostRoutine() can be used to prevent a routine from being + called by the QCoreApplication destructor. For example, if that + routine was called before the module was unloaded. For modules and libraries, using a reference-counted initialization manager or Qt's parent-child deletion mechanism may @@ -2653,6 +2658,21 @@ void QCoreApplication::setEventDispatcher(QAbstractEventDispatcher *eventDispatc By selecting the right parent object, this can often be made to clean up the module's data at the right moment. + + \sa qRemovePostRoutine() +*/ + +/*! + \fn void qRemovePostRoutine(QtCleanUpFunction ptr) + \relates QCoreApplication + \since 5.3 + + Removes the cleanup routine specified by \a ptr from the list of + routines called by the QCoreApplication destructor. The routine + must have been previously added to the list by a call to + qAddPostRoutine(), otherwise this function has no effect. + + \sa qAddPostRoutine() */ /*! diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index e7a53c0790..6d2cba7703 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -2204,6 +2204,11 @@ static int qt_timezone() long offset; _get_timezone(&offset); return offset; +#elif defined(Q_OS_BSD4) && !defined(Q_OS_DARWIN) + time_t clock = time(NULL); + struct tm t; + localtime_r(&clock, &t); + return t.tm_gmtoff; #else return timezone; #endif // Q_OS_WIN diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp index 4aad7c04c5..3d7656262b 100644 --- a/src/network/ssl/qsslconfiguration.cpp +++ b/src/network/ssl/qsslconfiguration.cpp @@ -663,7 +663,7 @@ int QSslConfiguration::sessionTicketLifeTimeHint() const \li protocol SecureProtocols (meaning either TLS 1.0 or SSL 3 will be used) \li the system's default CA certificate list \li the cipher list equal to the list of the SSL libraries' - supported SSL ciphers + supported SSL ciphers that are 128 bits or more \endlist \sa QSslSocket::supportedCiphers(), setDefaultConfiguration() diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 38b493a769..0f934fa5d6 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -1953,6 +1953,7 @@ void QSslSocketPrivate::init() */ QList<QSslCipher> QSslSocketPrivate::defaultCiphers() { + QSslSocketPrivate::ensureInitialized(); QMutexLocker locker(&globalData()->mutex); return globalData()->config->ciphers; } diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 69b9e53884..ce6b6562b9 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -596,6 +596,7 @@ void QSslSocketPrivate::resetDefaultCiphers() SSL *mySsl = q_SSL_new(myCtx); QList<QSslCipher> ciphers; + QList<QSslCipher> defaultCiphers; STACK_OF(SSL_CIPHER) *supportedCiphers = q_SSL_get_ciphers(mySsl); for (int i = 0; i < q_sk_SSL_CIPHER_num(supportedCiphers); ++i) { @@ -603,8 +604,11 @@ void QSslSocketPrivate::resetDefaultCiphers() if (cipher->valid) { QSslCipher ciph = QSslSocketBackendPrivate::QSslCipher_from_SSL_CIPHER(cipher); if (!ciph.isNull()) { + // Unconditionally exclude ADH ciphers since they offer no MITM protection if (!ciph.name().toLower().startsWith(QLatin1String("adh"))) ciphers << ciph; + if (ciph.usedBits() >= 128) + defaultCiphers << ciph; } } } @@ -614,7 +618,7 @@ void QSslSocketPrivate::resetDefaultCiphers() q_SSL_free(mySsl); setDefaultSupportedCiphers(ciphers); - setDefaultCiphers(ciphers); + setDefaultCiphers(defaultCiphers); } QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates() diff --git a/src/plugins/platforminputcontexts/compose/compose.pro b/src/plugins/platforminputcontexts/compose/compose.pro index 2490a4ffbe..c206e99e57 100644 --- a/src/plugins/platforminputcontexts/compose/compose.pro +++ b/src/plugins/platforminputcontexts/compose/compose.pro @@ -8,6 +8,7 @@ QT += gui-private LIBS += $$QMAKE_LIBS_XKBCOMMON QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XKBCOMMON +DEFINES += COMPOSE_X11_PREFIX='\\"$$QMAKE_X11_PREFIX\\"' SOURCES += $$PWD/main.cpp \ $$PWD/qcomposeplatforminputcontext.cpp \ diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp index 692372c3a9..121e734ec1 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp @@ -73,17 +73,13 @@ TableGenerator::TableGenerator() : m_state(NoErrors), void TableGenerator::initPossibleLocations() { - // AFAICT there is no way to know the exact location - // of the compose files. It depends on how Xlib was configured - // on a specific platform. During the "./configure" process - // xlib generates a config.h file which contains a bunch of defines, - // including XLOCALEDIR which points to the location of the compose file dir. // To add an extra system path use the QTCOMPOSE environment variable if (qEnvironmentVariableIsSet("QTCOMPOSE")) { m_possibleLocations.append(QString(qgetenv("QTCOMPOSE"))); } - m_possibleLocations.append(QStringLiteral("/usr/share/X11/locale")); - m_possibleLocations.append(QStringLiteral("/usr/lib/X11/locale")); + + m_possibleLocations.append(QStringLiteral(COMPOSE_X11_PREFIX "/share/X11/locale")); + m_possibleLocations.append(QStringLiteral(COMPOSE_X11_PREFIX "/lib/X11/locale")); } void TableGenerator::findComposeFile() diff --git a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp index 498f59be88..86d8bf9d1b 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp +++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp @@ -51,9 +51,6 @@ #include <android/native_window.h> #include <android/native_window_jni.h> -#warning remove me -#include <QDebug> - QT_BEGIN_NAMESPACE QAndroidPlatformOpenGLWindow::QAndroidPlatformOpenGLWindow(QWindow *window, EGLDisplay display) @@ -80,7 +77,6 @@ void QAndroidPlatformOpenGLWindow::setGeometry(const QRect &rect) if (rect == geometry()) return; - qDebug() << rect; QAndroidPlatformWindow::setGeometry(rect); QtAndroid::setSurfaceGeometry(m_nativeSurfaceId, rect); } @@ -99,7 +95,6 @@ EGLSurface QAndroidPlatformOpenGLWindow::eglSurface(EGLConfig config) void QAndroidPlatformOpenGLWindow::checkNativeSurface(EGLConfig config) { QMutexLocker lock(&m_surfaceMutex); - qDebug() << geometry() << m_changedAndroidSurface.isValid(); if (m_nativeSurfaceId == -1 || !m_changedAndroidSurface.isValid()) return; @@ -147,7 +142,6 @@ void QAndroidPlatformOpenGLWindow::surfaceChanged(JNIEnv *jniEnv, jobject surfac Q_UNUSED(jniEnv); Q_UNUSED(w); Q_UNUSED(h); - qDebug() << w << h; lockSurface(); m_changedAndroidSurface = surface; m_surfaceWaitCondition.wakeOne(); diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 0cff92dacc..030090d98d 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -1154,6 +1154,7 @@ void QXcbConnection::processXcbEvents() xcb_generic_event_t *event = eventqueue->at(i); if (!event) continue; + QScopedPointer<xcb_generic_event_t, QScopedPointerPodDeleter> eventGuard(event); (*eventqueue)[i] = 0; uint response_type = event->response_type & ~0x80; @@ -1204,8 +1205,6 @@ void QXcbConnection::processXcbEvents() handleXcbEvent(event); m_reader->lock(); } - - free(event); } eventqueue->clear(); diff --git a/src/testlib/qabstracttestlogger_p.h b/src/testlib/qabstracttestlogger_p.h index c471717655..c549233ddb 100644 --- a/src/testlib/qabstracttestlogger_p.h +++ b/src/testlib/qabstracttestlogger_p.h @@ -94,7 +94,7 @@ public: const char *file = 0, int line = 0) = 0; virtual void addBenchmarkResult(const QBenchmarkResult &result) = 0; - virtual void addMessage(MessageTypes type, const char *message, + virtual void addMessage(MessageTypes type, const QString &message, const char *file = 0, int line = 0) = 0; void outputString(const char *msg); diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp index 3f65dc0a6e..39580f22d4 100644 --- a/src/testlib/qplaintestlogger.cpp +++ b/src/testlib/qplaintestlogger.cpp @@ -389,14 +389,14 @@ void QPlainTestLogger::addBenchmarkResult(const QBenchmarkResult &result) printBenchmarkResult(result); } -void QPlainTestLogger::addMessage(MessageTypes type, const char *message, +void QPlainTestLogger::addMessage(MessageTypes type, const QString &message, const char *file, int line) { // suppress non-fatal messages in silent mode if (type != QAbstractTestLogger::QFatal && QTestLog::verboseLevel() < 0) return; - printMessage(QTest::messageType2String(type), message, file, line); + printMessage(QTest::messageType2String(type), qPrintable(message), file, line); } QT_END_NAMESPACE diff --git a/src/testlib/qplaintestlogger_p.h b/src/testlib/qplaintestlogger_p.h index 8aa0d745e9..69dbc89649 100644 --- a/src/testlib/qplaintestlogger_p.h +++ b/src/testlib/qplaintestlogger_p.h @@ -73,7 +73,7 @@ public: const char *file = 0, int line = 0); void addBenchmarkResult(const QBenchmarkResult &result); - void addMessage(MessageTypes type, const char *message, + void addMessage(MessageTypes type, const QString &message, const char *file = 0, int line = 0); private: diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index 037bed643d..74947b3f3a 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -209,7 +209,7 @@ namespace QTest { FOREACH_LOGGER(logger->addBenchmarkResult(result)); } - static void addMessage(QAbstractTestLogger::MessageTypes type, const char *message, + static void addMessage(QAbstractTestLogger::MessageTypes type, const QString &message, const char *file = 0, int line = 0) { FOREACH_LOGGER(logger->addMessage(type, message, file, line)); @@ -242,11 +242,10 @@ namespace QTest { static QtMessageHandler oldMessageHandler; - static bool handleIgnoredMessage(QtMsgType type, const char *msg) + static bool handleIgnoredMessage(QtMsgType type, const QString &message) { if (!ignoreResultList) return false; - const QString message = QString::fromLocal8Bit(msg); IgnoreResultList *last = 0; IgnoreResultList *list = ignoreResultList; while (list) { @@ -279,12 +278,11 @@ namespace QTest { QTEST_ASSERT(QTest::TestLoggers::loggerCount() != 0); } - QByteArray msg = message.toLocal8Bit(); - if (handleIgnoredMessage(type, msg)) + if (handleIgnoredMessage(type, message)) // the message is expected, so just swallow it. return; - msg = qMessageFormatString(type, context, message).toLocal8Bit(); + QString msg = qMessageFormatString(type, context, message); msg.chop(1); // remove trailing newline if (type != QtFatalMsg) { @@ -293,7 +291,7 @@ namespace QTest { if (!counter.deref()) { QTest::TestLoggers::addMessage(QAbstractTestLogger::QSystem, - "Maximum amount of warnings exceeded. Use -maxwarnings to override."); + QStringLiteral("Maximum amount of warnings exceeded. Use -maxwarnings to override.")); return; } } @@ -354,15 +352,15 @@ void QTestLog::leaveTestFunction() void QTestLog::printUnhandledIgnoreMessages() { - char msg[1024]; + QString message; QTest::IgnoreResultList *list = QTest::ignoreResultList; while (list) { if (list->pattern.type() == QVariant::String) { - qsnprintf(msg, 1024, "Did not receive message: \"%s\"", qPrintable(list->pattern.toString())); + message = QStringLiteral("Did not receive message: \"") + list->pattern.toString() + QLatin1Char('"'); } else { - qsnprintf(msg, 1024, "Did not receive any message matching: \"%s\"", qPrintable(list->pattern.toRegularExpression().pattern())); + message = QStringLiteral("Did not receive any message matching: \"") + list->pattern.toRegularExpression().pattern() + QLatin1Char('"'); } - QTest::TestLoggers::addMessage(QAbstractTestLogger::Info, msg); + QTest::TestLoggers::addMessage(QAbstractTestLogger::Info, message); list = list->next; } @@ -419,7 +417,7 @@ void QTestLog::addSkip(const char *msg, const char *file, int line) ++QTest::skips; - QTest::TestLoggers::addMessage(QAbstractTestLogger::Skip, msg, file, line); + QTest::TestLoggers::addMessage(QAbstractTestLogger::Skip, QString::fromUtf8(msg), file, line); } void QTestLog::addBenchmarkResult(const QBenchmarkResult &result) @@ -483,14 +481,14 @@ void QTestLog::warn(const char *msg, const char *file, int line) QTEST_ASSERT(msg); if (QTest::TestLoggers::loggerCount() > 0) - QTest::TestLoggers::addMessage(QAbstractTestLogger::Warn, msg, file, line); + QTest::TestLoggers::addMessage(QAbstractTestLogger::Warn, QString::fromUtf8(msg), file, line); } void QTestLog::info(const char *msg, const char *file, int line) { QTEST_ASSERT(msg); - QTest::TestLoggers::addMessage(QAbstractTestLogger::Info, msg, file, line); + QTest::TestLoggers::addMessage(QAbstractTestLogger::Info, QString::fromUtf8(msg), file, line); } void QTestLog::setVerboseLevel(int level) diff --git a/src/testlib/qxmltestlogger.cpp b/src/testlib/qxmltestlogger.cpp index b4035301d3..3fff753c5c 100644 --- a/src/testlib/qxmltestlogger.cpp +++ b/src/testlib/qxmltestlogger.cpp @@ -271,7 +271,7 @@ void QXmlTestLogger::addBenchmarkResult(const QBenchmarkResult &result) outputString(buf.constData()); } -void QXmlTestLogger::addMessage(MessageTypes type, const char *message, +void QXmlTestLogger::addMessage(MessageTypes type, const QString &message, const char *file, int line) { QTestCharBuffer buf; @@ -288,10 +288,10 @@ void QXmlTestLogger::addMessage(MessageTypes type, const char *message, xmlQuote("edFile, file); xmlCdata(&cdataGtag, gtag); xmlCdata(&cdataTag, tag); - xmlCdata(&cdataDescription, message); + xmlCdata(&cdataDescription, message.toUtf8().constData()); QTest::qt_asprintf(&buf, - QTest::messageFormatString(QTest::isEmpty(message), notag), + QTest::messageFormatString(message.isEmpty(), notag), QTest::xmlMessageType2String(type), quotedFile.constData(), line, cdataGtag.constData(), diff --git a/src/testlib/qxmltestlogger_p.h b/src/testlib/qxmltestlogger_p.h index 65699af3ad..8ca15e47e2 100644 --- a/src/testlib/qxmltestlogger_p.h +++ b/src/testlib/qxmltestlogger_p.h @@ -77,7 +77,7 @@ public: const char *file = 0, int line = 0); void addBenchmarkResult(const QBenchmarkResult &result); - void addMessage(MessageTypes type, const char *message, + void addMessage(MessageTypes type, const QString &message, const char *file = 0, int line = 0); static int xmlCdata(QTestCharBuffer *dest, char const* src); diff --git a/src/testlib/qxunittestlogger.cpp b/src/testlib/qxunittestlogger.cpp index 0a1a5fb6f9..a47f77ae49 100644 --- a/src/testlib/qxunittestlogger.cpp +++ b/src/testlib/qxunittestlogger.cpp @@ -220,7 +220,7 @@ void QXunitTestLogger::addIncident(IncidentTypes type, const char *description, have some information about the expected failure. */ if (type == QAbstractTestLogger::XFail) { - QXunitTestLogger::addMessage(QAbstractTestLogger::Info, description, file, line); + QXunitTestLogger::addMessage(QAbstractTestLogger::Info, QString::fromUtf8(description), file, line); } } @@ -263,7 +263,7 @@ void QXunitTestLogger::addTag(QTestElement* element) element->addAttribute(QTest::AI_Tag, buf.constData()); } -void QXunitTestLogger::addMessage(MessageTypes type, const char *message, const char *file, int line) +void QXunitTestLogger::addMessage(MessageTypes type, const QString &message, const char *file, int line) { QTestElement *errorElement = new QTestElement(QTest::LET_Error); const char *typeBuf = 0; @@ -296,7 +296,7 @@ void QXunitTestLogger::addMessage(MessageTypes type, const char *message, const } errorElement->addAttribute(QTest::AI_Type, typeBuf); - errorElement->addAttribute(QTest::AI_Description, message); + errorElement->addAttribute(QTest::AI_Description, message.toUtf8().constData()); addTag(errorElement); if (file) @@ -314,7 +314,7 @@ void QXunitTestLogger::addMessage(MessageTypes type, const char *message, const // Also add the message to the system error log (i.e. stderr), if one exists if (errorLogElement) { QTestElement *systemErrorElement = new QTestElement(QTest::LET_Error); - systemErrorElement->addAttribute(QTest::AI_Description, message); + systemErrorElement->addAttribute(QTest::AI_Description, message.toUtf8().constData()); errorLogElement->addLogElement(systemErrorElement); } } diff --git a/src/testlib/qxunittestlogger_p.h b/src/testlib/qxunittestlogger_p.h index 2c39fa952c..754462473a 100644 --- a/src/testlib/qxunittestlogger_p.h +++ b/src/testlib/qxunittestlogger_p.h @@ -77,7 +77,7 @@ class QXunitTestLogger : public QAbstractTestLogger void addBenchmarkResult(const QBenchmarkResult &result); void addTag(QTestElement* element); - void addMessage(MessageTypes type, const char *message, + void addMessage(MessageTypes type, const QString &message, const char *file = 0, int line = 0); private: diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 3546d2e395..2d48c50c83 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -244,7 +244,7 @@ void Generator::generateCode() int len = 0; for (int i = 0; i < strings.size(); ++i) len += strings.at(i).length() + 1; - fprintf(out, " char stringdata[%d];\n", len + 1); + fprintf(out, " char stringdata[%d];\n", len); } fprintf(out, "};\n"); @@ -316,7 +316,8 @@ void Generator::generateCode() col += spanLen; } - fputs("\\0", out); + if (i != strings.size() - 1) // skip the last \0 the c++ will add it for us + fputs("\\0", out); col += len + 2; } @@ -637,12 +638,6 @@ void Generator::generateFunctions(const QList<FunctionDef>& list, const char *fu flags |= AccessPublic; else if (f.access == FunctionDef::Protected) flags |= AccessProtected; - if (f.access == FunctionDef::Private) - flags |= AccessPrivate; - else if (f.access == FunctionDef::Public) - flags |= AccessPublic; - else if (f.access == FunctionDef::Protected) - flags |= AccessProtected; if (f.isCompat) flags |= MethodCompatibility; if (f.wasCloned) diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 2f36944b5e..de819e95db 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -1340,11 +1340,9 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption painter->setPen(menuitem->palette.buttonText().color()); - QColor discol; - if (dis) { - discol = menuitem->palette.text().color(); - painter->setPen(discol); - } + const QColor textColor = menuitem->palette.text().color(); + if (dis) + painter->setPen(textColor); int xm = windowsItemFrame + checkcol + windowsItemHMargin; int xpos = menuitem->rect.x() + xm; @@ -1368,7 +1366,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem) font.setBold(true); painter->setFont(font); - painter->setPen(discol); + painter->setPen(textColor); painter->drawText(vTextRect, text_flags, s.left(t)); painter->restore(); } diff --git a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp index 50268f20a4..26f10385b3 100644 --- a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp +++ b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp @@ -376,16 +376,22 @@ private slots: buf = QStringLiteral("default.debug: Check debug with no filter active"); qCDebug(defaultCategory) << "Check debug with no filter active"; QCOMPARE(logMessage, buf); + qCDebug(defaultCategory, "Check debug with no filter active"); + QCOMPARE(logMessage, buf); // Check default warning buf = QStringLiteral("default.warning: Check warning with no filter active"); qCWarning(defaultCategory) << "Check warning with no filter active"; QCOMPARE(logMessage, buf); + qCWarning(defaultCategory, "Check warning with no filter active"); + QCOMPARE(logMessage, buf); // Check default critical buf = QStringLiteral("default.critical: Check critical with no filter active"); qCCritical(defaultCategory) << "Check critical with no filter active"; QCOMPARE(logMessage, buf); + qCCritical(defaultCategory, "Check critical with no filter active"); + QCOMPARE(logMessage, buf); QLoggingCategory customCategory("custom"); @@ -412,6 +418,24 @@ private slots: qCDebug(customCategory) << "Check debug with filter active"; QCOMPARE(logMessage, buf); + // Check different macro/category variants + buf = QStringLiteral("tst.log.debug: Check debug with no filter active"); + qCDebug(TST_LOG) << "Check debug with no filter active"; + QCOMPARE(logMessage, buf); + qCDebug(TST_LOG, "Check debug with no filter active"); + QCOMPARE(logMessage, buf); + buf = QStringLiteral("tst.log.warning: Check warning with no filter active"); + qCWarning(TST_LOG) << "Check warning with no filter active"; + QCOMPARE(logMessage, buf); + qCWarning(TST_LOG, "Check warning with no filter active"); + QCOMPARE(logMessage, buf); + buf = QStringLiteral("tst.log.critical: Check critical with no filter active"); + qCCritical(TST_LOG) << "Check critical with no filter active"; + QCOMPARE(logMessage, buf); + qCCritical(TST_LOG, "Check critical with no filter active"); + QCOMPARE(logMessage, buf); + + // reset to default filter QLoggingCategory::installFilter(0); diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index 06236a9db8..6eb20dd1f5 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -589,13 +589,13 @@ void tst_QSslSocket::ciphers() return; QSslSocket socket; - QCOMPARE(socket.ciphers(), QSslSocket::supportedCiphers()); + QCOMPARE(socket.ciphers(), QSslSocket::defaultCiphers()); socket.setCiphers(QList<QSslCipher>()); QVERIFY(socket.ciphers().isEmpty()); socket.setCiphers(socket.defaultCiphers()); - QCOMPARE(socket.ciphers(), QSslSocket::supportedCiphers()); + QCOMPARE(socket.ciphers(), QSslSocket::defaultCiphers()); socket.setCiphers(socket.defaultCiphers()); - QCOMPARE(socket.ciphers(), QSslSocket::supportedCiphers()); + QCOMPARE(socket.ciphers(), QSslSocket::defaultCiphers()); // Task 164356 socket.setCiphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); @@ -678,6 +678,11 @@ void tst_QSslSocket::sessionCipher() if (!socket->waitForEncrypted(5000)) QSKIP("Skipping flaky test - See QTBUG-29941"); QVERIFY(!socket->sessionCipher().isNull()); + + qDebug() << "Supported Ciphers:" << QSslSocket::supportedCiphers(); + qDebug() << "Default Ciphers:" << QSslSocket::defaultCiphers(); + qDebug() << "Session Cipher:" << socket->sessionCipher(); + QVERIFY(QSslSocket::supportedCiphers().contains(socket->sessionCipher())); socket->disconnectFromHost(); QVERIFY(socket->waitForDisconnected()); @@ -1386,6 +1391,15 @@ void tst_QSslSocket::defaultCaCertificates() void tst_QSslSocket::defaultCiphers() { + if (!QSslSocket::supportsSsl()) + return; + + QList<QSslCipher> ciphers = QSslSocket::defaultCiphers(); + QVERIFY(ciphers.size() > 1); + + QSslSocket socket; + QCOMPARE(socket.defaultCiphers(), ciphers); + QCOMPARE(socket.ciphers(), ciphers); } void tst_QSslSocket::resetDefaultCiphers() @@ -1410,8 +1424,6 @@ void tst_QSslSocket::supportedCiphers() QSslSocket socket; QCOMPARE(socket.supportedCiphers(), ciphers); - QCOMPARE(socket.defaultCiphers(), ciphers); - QCOMPARE(socket.ciphers(), ciphers); } void tst_QSslSocket::systemCaCertificates() diff --git a/tests/auto/testlib/selftests/badxml/tst_badxml.cpp b/tests/auto/testlib/selftests/badxml/tst_badxml.cpp index 1ccbdd7899..3f2385bb30 100644 --- a/tests/auto/testlib/selftests/badxml/tst_badxml.cpp +++ b/tests/auto/testlib/selftests/badxml/tst_badxml.cpp @@ -41,6 +41,7 @@ #include <QtCore/QCoreApplication> +#include <QtCore/QStringList> #include <QtTest/QtTest> #include <private/qmetaobjectbuilder_p.h> @@ -61,6 +62,8 @@ private slots: void failWithNoFile() const; + void encoding(); + public: static QList<QByteArray> const& badStrings(); }; @@ -126,6 +129,24 @@ void tst_BadXml::failWithNoFile() const QTest::qFail("failure message", 0, 0); } +// QTBUG-35743, test whether XML is using correct UTF-8 encoding +// on platforms where the console encoding differs. +void tst_BadXml::encoding() +{ + QStringList arguments = QCoreApplication::arguments(); + arguments.pop_front(); // Prevent match on binary "badxml" + if (arguments.filter(QStringLiteral("xml")).isEmpty()) + QSKIP("Skipped for text due to unpredictable console encoding."); + QString string; + string += QChar(ushort(0xDC)); // German umlaut Ue + string += QStringLiteral("lrich "); + string += QChar(ushort(0xDC)); // German umlaut Ue + string += QStringLiteral("ml"); + string += QChar(ushort(0xE4)); // German umlaut ae + string += QStringLiteral("ut"); + qDebug() << string; +} + /* Outputs a message containing a bad string. */ diff --git a/tests/auto/testlib/selftests/expected_badxml.lightxml b/tests/auto/testlib/selftests/expected_badxml.lightxml index 15981b12be..e4c79e3bb0 100644 --- a/tests/auto/testlib/selftests/expected_badxml.lightxml +++ b/tests/auto/testlib/selftests/expected_badxml.lightxml @@ -4,14 +4,14 @@ </Environment> <TestFunction name="initTestCase"> <Incident type="pass" file="" line="0" /> -<Duration msecs="0"/> + <Duration msecs="0"/> </TestFunction> <TestFunction name="badDataTag"> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[fail end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag> <Description><![CDATA[a message]]></Description> </Message> -<Incident type="fail" file="tst_badxml.cpp" line="111"> +<Incident type="fail" file="tst_badxml.cpp" line="114"> <DataTag><![CDATA[fail end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag> <Description><![CDATA[a failure]]></Description> </Incident> @@ -27,7 +27,7 @@ <DataTag><![CDATA[fail quotes " text" more text]]></DataTag> <Description><![CDATA[a message]]></Description> </Message> -<Incident type="fail" file="tst_badxml.cpp" line="111"> +<Incident type="fail" file="tst_badxml.cpp" line="114"> <DataTag><![CDATA[fail quotes " text" more text]]></DataTag> <Description><![CDATA[a failure]]></Description> </Incident> @@ -43,7 +43,7 @@ <DataTag><![CDATA[fail xml close > open < tags < text]]></DataTag> <Description><![CDATA[a message]]></Description> </Message> -<Incident type="fail" file="tst_badxml.cpp" line="111"> +<Incident type="fail" file="tst_badxml.cpp" line="114"> <DataTag><![CDATA[fail xml close > open < tags < text]]></DataTag> <Description><![CDATA[a failure]]></Description> </Incident> @@ -59,7 +59,7 @@ <DataTag><![CDATA[fail all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag> <Description><![CDATA[a message]]></Description> </Message> -<Incident type="fail" file="tst_badxml.cpp" line="111"> +<Incident type="fail" file="tst_badxml.cpp" line="114"> <DataTag><![CDATA[fail all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag> <Description><![CDATA[a failure]]></Description> </Incident> @@ -71,7 +71,7 @@ <DataTag><![CDATA[pass all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag> </Incident> <BenchmarkResult metric="Events" tag="pass all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs" value="0" iterations="1" /> -<Duration msecs="0"/> + <Duration msecs="0"/> </TestFunction> <TestFunction name="badMessage"> <Message type="qdebug" file="" line="0"> @@ -102,16 +102,23 @@ <Incident type="pass" file="" line="0"> <DataTag><![CDATA[string 3]]></DataTag> </Incident> -<Duration msecs="0"/> + <Duration msecs="0"/> </TestFunction> <TestFunction name="failWithNoFile"> <Incident type="fail" file="" line="0"> <Description><![CDATA[failure message]]></Description> </Incident> -<Duration msecs="0"/> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="encoding"> +<Message type="qdebug" file="" line="0"> + <Description><![CDATA["Ülrich Ümläut"]]></Description> +</Message> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> </TestFunction> <TestFunction name="cleanupTestCase"> <Incident type="pass" file="" line="0" /> -<Duration msecs="0"/> + <Duration msecs="0"/> </TestFunction> <Duration msecs="0"/> diff --git a/tests/auto/testlib/selftests/expected_badxml.txt b/tests/auto/testlib/selftests/expected_badxml.txt index 3c65231529..a42013df0b 100644 --- a/tests/auto/testlib/selftests/expected_badxml.txt +++ b/tests/auto/testlib/selftests/expected_badxml.txt @@ -3,28 +3,28 @@ Config: Using QtTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HER PASS : tst_BadXml::initTestCase() QDEBUG : tst_BadXml::badDataTag(fail end cdata ]]> text ]]> more text) a message FAIL! : tst_BadXml::badDataTag(fail end cdata ]]> text ]]> more text) a failure - Loc: [tst_badxml.cpp(111)] + Loc: [tst_badxml.cpp(114)] QDEBUG : tst_BadXml::badDataTag(pass end cdata ]]> text ]]> more text) a message PASS : tst_BadXml::badDataTag(pass end cdata ]]> text ]]> more text) RESULT : tst_BadXml::badDataTag():"pass end cdata ]]> text ]]> more text": 0 events per iteration (total: 0, iterations: 1) QDEBUG : tst_BadXml::badDataTag(fail quotes " text" more text) a message FAIL! : tst_BadXml::badDataTag(fail quotes " text" more text) a failure - Loc: [tst_badxml.cpp(111)] + Loc: [tst_badxml.cpp(114)] QDEBUG : tst_BadXml::badDataTag(pass quotes " text" more text) a message PASS : tst_BadXml::badDataTag(pass quotes " text" more text) RESULT : tst_BadXml::badDataTag():"pass quotes " text" more text": 0 events per iteration (total: 0, iterations: 1) QDEBUG : tst_BadXml::badDataTag(fail xml close > open < tags < text) a message FAIL! : tst_BadXml::badDataTag(fail xml close > open < tags < text) a failure - Loc: [tst_badxml.cpp(111)] + Loc: [tst_badxml.cpp(114)] QDEBUG : tst_BadXml::badDataTag(pass xml close > open < tags < text) a message PASS : tst_BadXml::badDataTag(pass xml close > open < tags < text) RESULT : tst_BadXml::badDataTag():"pass xml close > open < tags < text": 0 events per iteration (total: 0, iterations: 1) QDEBUG : tst_BadXml::badDataTag(fail all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs) a message FAIL! : tst_BadXml::badDataTag(fail all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs) a failure - Loc: [tst_badxml.cpp(111)] + Loc: [tst_badxml.cpp(114)] QDEBUG : tst_BadXml::badDataTag(pass all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs) a message PASS : tst_BadXml::badDataTag(pass all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs) RESULT : tst_BadXml::badDataTag():"pass all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs": @@ -38,6 +38,8 @@ PASS : tst_BadXml::badMessage(string 2) QDEBUG : tst_BadXml::badMessage(string 3) all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs PASS : tst_BadXml::badMessage(string 3) FAIL! : tst_BadXml::failWithNoFile() failure message +SKIP : tst_BadXml::encoding() Skipped for text due to unpredictable console encoding. + Loc: [tst_badxml.cpp(139)] PASS : tst_BadXml::cleanupTestCase() -Totals: 10 passed, 5 failed, 0 skipped +Totals: 10 passed, 5 failed, 1 skipped ********* Finished testing of tst_BadXml ********* diff --git a/tests/auto/testlib/selftests/expected_badxml.xml b/tests/auto/testlib/selftests/expected_badxml.xml index c3330a6b97..0811db0f3a 100644 --- a/tests/auto/testlib/selftests/expected_badxml.xml +++ b/tests/auto/testlib/selftests/expected_badxml.xml @@ -6,14 +6,14 @@ </Environment> <TestFunction name="initTestCase"> <Incident type="pass" file="" line="0" /> -<Duration msecs="0"/> + <Duration msecs="0"/> </TestFunction> <TestFunction name="badDataTag"> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[fail end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag> <Description><![CDATA[a message]]></Description> </Message> -<Incident type="fail" file="tst_badxml.cpp" line="111"> +<Incident type="fail" file="tst_badxml.cpp" line="114"> <DataTag><![CDATA[fail end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag> <Description><![CDATA[a failure]]></Description> </Incident> @@ -29,7 +29,7 @@ <DataTag><![CDATA[fail quotes " text" more text]]></DataTag> <Description><![CDATA[a message]]></Description> </Message> -<Incident type="fail" file="tst_badxml.cpp" line="111"> +<Incident type="fail" file="tst_badxml.cpp" line="114"> <DataTag><![CDATA[fail quotes " text" more text]]></DataTag> <Description><![CDATA[a failure]]></Description> </Incident> @@ -45,7 +45,7 @@ <DataTag><![CDATA[fail xml close > open < tags < text]]></DataTag> <Description><![CDATA[a message]]></Description> </Message> -<Incident type="fail" file="tst_badxml.cpp" line="111"> +<Incident type="fail" file="tst_badxml.cpp" line="114"> <DataTag><![CDATA[fail xml close > open < tags < text]]></DataTag> <Description><![CDATA[a failure]]></Description> </Incident> @@ -61,7 +61,7 @@ <DataTag><![CDATA[fail all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag> <Description><![CDATA[a message]]></Description> </Message> -<Incident type="fail" file="tst_badxml.cpp" line="111"> +<Incident type="fail" file="tst_badxml.cpp" line="114"> <DataTag><![CDATA[fail all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag> <Description><![CDATA[a failure]]></Description> </Incident> @@ -73,7 +73,7 @@ <DataTag><![CDATA[pass all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag> </Incident> <BenchmarkResult metric="Events" tag="pass all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs" value="0" iterations="1" /> -<Duration msecs="0"/> + <Duration msecs="0"/> </TestFunction> <TestFunction name="badMessage"> <Message type="qdebug" file="" line="0"> @@ -104,17 +104,24 @@ <Incident type="pass" file="" line="0"> <DataTag><![CDATA[string 3]]></DataTag> </Incident> -<Duration msecs="0"/> + <Duration msecs="0"/> </TestFunction> <TestFunction name="failWithNoFile"> <Incident type="fail" file="" line="0"> <Description><![CDATA[failure message]]></Description> </Incident> -<Duration msecs="0"/> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="encoding"> +<Message type="qdebug" file="" line="0"> + <Description><![CDATA["Ülrich Ümläut"]]></Description> +</Message> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> </TestFunction> <TestFunction name="cleanupTestCase"> <Incident type="pass" file="" line="0" /> -<Duration msecs="0"/> + <Duration msecs="0"/> </TestFunction> <Duration msecs="0"/> </TestCase> diff --git a/tests/auto/testlib/selftests/expected_badxml.xunitxml b/tests/auto/testlib/selftests/expected_badxml.xunitxml index 939e887a88..a696da58c9 100644 --- a/tests/auto/testlib/selftests/expected_badxml.xunitxml +++ b/tests/auto/testlib/selftests/expected_badxml.xunitxml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<testsuite errors="12" failures="5" tests="5" name="tst_BadXml"> +<testsuite errors="13" failures="5" tests="6" name="tst_BadXml"> <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> @@ -28,6 +28,9 @@ <testcase result="fail" name="failWithNoFile"> <failure message="failure message" result="fail"/> </testcase> + <testcase result="pass" name="encoding"> + <!-- message=""Ülrich Ümläut"" type="qdebug" --> + </testcase> <testcase result="pass" name="cleanupTestCase"/> <system-err> <![CDATA[a message]]> @@ -42,5 +45,6 @@ <![CDATA[quotes " text" more text]]> <![CDATA[xml close > open < tags < text]]> <![CDATA[all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]> +<![CDATA["Ülrich Ümläut"]]> </system-err> </testsuite> diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index 97083d8d61..c2265ad198 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -486,6 +486,8 @@ void tst_Selftests::runSubTest_data() continue; } } + if (subtest == "badxml" && (loggerSet.name == "all loggers" || loggerSet.name.contains("txt"))) + continue; // XML only, do not mix txt and XML for encoding test. const bool crashes = subtest == QLatin1String("assert") || subtest == QLatin1String("exceptionthrow") || subtest == QLatin1String("fetchbogus") || subtest == QLatin1String("crashedterminate") || subtest == QLatin1String("crashes") || subtest == QLatin1String("silent"); diff --git a/tests/auto/tools/moc/assign-namespace.h b/tests/auto/tools/moc/assign-namespace.h index 8f5ecc23e7..7377b38f6b 100644 --- a/tests/auto/tools/moc/assign-namespace.h +++ b/tests/auto/tools/moc/assign-namespace.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef ASSIGN_NAMESPACE_H +#define ASSIGN_NAMESPACE_H + namespace A { namespace Nested @@ -50,3 +53,4 @@ namespace A namespace Mine = Qt; namespace Theirs = A::Nested::Space; +#endif // ASSIGN_NAMESPACE_H diff --git a/tests/auto/tools/moc/backslash-newlines.h b/tests/auto/tools/moc/backslash-newlines.h index 27c47843a2..29d800f26f 100644 --- a/tests/auto/tools/moc/backslash-newlines.h +++ b/tests/auto/tools/moc/backslash-newlines.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef BACKSLASH_NEWLINES_H +#define BACKSLASH_NEWLINES_H + #include <QObject> const int blackslashNewlinesDummy = 0 @@ -61,3 +64,4 @@ public slots: #undef value +#endif // BACKSLASH_NEWLINES_H diff --git a/tests/auto/tools/moc/c-comments.h b/tests/auto/tools/moc/c-comments.h index bded642737..dff4492287 100644 --- a/tests/auto/tools/moc/c-comments.h +++ b/tests/auto/tools/moc/c-comments.h @@ -38,6 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#ifndef C_COMMENTS_H +#define C_COMMENTS_H #include <qobject.h> /* test support for multi-line comments in preprocessor statements */ @@ -53,3 +56,4 @@ public: }; #endif +#endif // C_COMMENTS_H diff --git a/tests/auto/tools/moc/cstyle-enums.h b/tests/auto/tools/moc/cstyle-enums.h index 38c5932f69..7d1f6d0147 100644 --- a/tests/auto/tools/moc/cstyle-enums.h +++ b/tests/auto/tools/moc/cstyle-enums.h @@ -38,6 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#ifndef CSTYLE_ENUMS_H +#define CSTYLE_ENUMS_H #include <QObject> class CStyleEnums @@ -48,3 +51,4 @@ public: typedef enum { Foo, Bar } Baz; }; +#endif // CSTYLE_ENUMS_H diff --git a/tests/auto/tools/moc/cxx11-enums.h b/tests/auto/tools/moc/cxx11-enums.h index 0bd99b762c..215ae093d9 100644 --- a/tests/auto/tools/moc/cxx11-enums.h +++ b/tests/auto/tools/moc/cxx11-enums.h @@ -38,6 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#ifndef CXX11_ENUMS_H +#define CXX11_ENUMS_H #include <QtCore/QObject> #if defined(Q_COMPILER_CLASS_ENUM) || defined(Q_MOC_RUN) @@ -64,3 +67,4 @@ public: enum TypedEnum { B0, B1 , B2, B3 }; }; #endif +#endif // CXX11_ENUMS_H diff --git a/tests/auto/tools/moc/dir-in-include-path.h b/tests/auto/tools/moc/dir-in-include-path.h index 0d46f69d63..34f96bea6b 100644 --- a/tests/auto/tools/moc/dir-in-include-path.h +++ b/tests/auto/tools/moc/dir-in-include-path.h @@ -38,6 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#ifndef DIR_IN_INCLUDE_PATH_H +#define DIR_IN_INCLUDE_PATH_H #include <Plugin> class DirInIncludePath : public QObject, public MyInterface @@ -45,3 +48,4 @@ class DirInIncludePath : public QObject, public MyInterface Q_OBJECT Q_INTERFACES(MyInterface) }; +#endif // DIR_IN_INCLUDE_PATH_H diff --git a/tests/auto/tools/moc/dollars.h b/tests/auto/tools/moc/dollars.h index 8fab45559c..b136b00881 100644 --- a/tests/auto/tools/moc/dollars.h +++ b/tests/auto/tools/moc/dollars.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef DOLLARS_H +#define DOLLARS_H + /* both GCC and clang allow $ in identifiers * So moc should not throw a parse error if it parses a file that contains such identifiers */ @@ -68,3 +71,4 @@ namespace $NS { }; } +#endif // DOLLARS_H diff --git a/tests/auto/tools/moc/error-on-wrong-notify.h b/tests/auto/tools/moc/error-on-wrong-notify.h index d13e352143..7358f4e77a 100644 --- a/tests/auto/tools/moc/error-on-wrong-notify.h +++ b/tests/auto/tools/moc/error-on-wrong-notify.h @@ -38,6 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#ifndef ERROR_ON_WRONG_NOTIFY_H +#define ERROR_ON_WRONG_NOTIFY_H #include <QObject> class ClassWithWrongNOTIFY : public QObject @@ -51,3 +54,4 @@ public: int foo() { return m_foo; } }; +#endif // ERROR_ON_WRONG_NOTIFY_H diff --git a/tests/auto/tools/moc/escapes-in-string-literals.h b/tests/auto/tools/moc/escapes-in-string-literals.h index e2f044e196..25f9df2e74 100644 --- a/tests/auto/tools/moc/escapes-in-string-literals.h +++ b/tests/auto/tools/moc/escapes-in-string-literals.h @@ -38,6 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#ifndef ESCAPES_IN_STRING_LITERALS_H +#define ESCAPES_IN_STRING_LITERALS_H #include <QObject> class StringLiterals: public QObject @@ -47,3 +50,4 @@ class StringLiterals: public QObject Q_CLASSINFO("Test2", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\123") Q_CLASSINFO("Test3", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\nb") }; +#endif // ESCAPES_IN_STRING_LITERALS_H diff --git a/tests/auto/tools/moc/extraqualification.h b/tests/auto/tools/moc/extraqualification.h index 5c69699067..875eb56184 100644 --- a/tests/auto/tools/moc/extraqualification.h +++ b/tests/auto/tools/moc/extraqualification.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef EXTRAQUALIFICATION_H +#define EXTRAQUALIFICATION_H + #include <QObject> class Test : public QObject @@ -55,3 +58,4 @@ public slots: public: Q_SLOT void Test::anotherOne() {} }; +#endif // EXTRAQUALIFICATION_H diff --git a/tests/auto/tools/moc/forgotten-qinterface.h b/tests/auto/tools/moc/forgotten-qinterface.h index 4c8aa45d92..0c2fd87aa5 100644 --- a/tests/auto/tools/moc/forgotten-qinterface.h +++ b/tests/auto/tools/moc/forgotten-qinterface.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef FORGOTTEN_QINTERFACE_H +#define FORGOTTEN_QINTERFACE_H + #include <QObject> struct MyInterface @@ -53,3 +56,4 @@ class Test : public QObject, public MyInterface { Q_OBJECT }; +#endif // FORGOTTEN_QINTERFACE_H diff --git a/tests/auto/tools/moc/forward-declared-param.h b/tests/auto/tools/moc/forward-declared-param.h index 013c6563e8..441745f9fc 100644 --- a/tests/auto/tools/moc/forward-declared-param.h +++ b/tests/auto/tools/moc/forward-declared-param.h @@ -38,6 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#ifndef FORWARD_DECLARED_PARAM_H +#define FORWARD_DECLARED_PARAM_H #include <qobject.h> #include <qmetatype.h> @@ -73,4 +76,5 @@ signals: void signalQSet(const QSet<int> &); void signalQSet(const QSet<QString> &); void signalQSet(const QSet<FullyDefined> &); -};
\ No newline at end of file +}; +#endif // FORWARD_DECLARED_PARAM_H diff --git a/tests/auto/tools/moc/function-with-attributes.h b/tests/auto/tools/moc/function-with-attributes.h index afa02e6f3a..88f3e3fcb3 100644 --- a/tests/auto/tools/moc/function-with-attributes.h +++ b/tests/auto/tools/moc/function-with-attributes.h @@ -38,6 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#ifndef FUNCTION_WITH_ATTRIBUTES_H +#define FUNCTION_WITH_ATTRIBUTES_H #include <qobject.h> // test support for gcc attributes with functions @@ -62,3 +65,4 @@ public slots: DEPRECATED2 void test2() {} }; +#endif // FUNCTION_WITH_ATTRIBUTES_H diff --git a/tests/auto/tools/moc/interface-from-framework.h b/tests/auto/tools/moc/interface-from-framework.h index 8a4188e5ab..c961d18bb9 100644 --- a/tests/auto/tools/moc/interface-from-framework.h +++ b/tests/auto/tools/moc/interface-from-framework.h @@ -38,7 +38,8 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef INTERFACE_FROM-FRAMEWORK_H + +#ifndef INTERFACE_FROM_FRAMEWORK_H #define INTERFACE_FROM_FRAMEWORK_H #include <Test/testinterface.h> diff --git a/tests/auto/tools/moc/macro-on-cmdline.h b/tests/auto/tools/moc/macro-on-cmdline.h index 9609b7cd31..681340471d 100644 --- a/tests/auto/tools/moc/macro-on-cmdline.h +++ b/tests/auto/tools/moc/macro-on-cmdline.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef MACRO_ON_CMDLINE_H +#define MACRO_ON_CMDLINE_H + #if FOO class Test : public QObject @@ -48,3 +51,4 @@ public: }; #endif +#endif // MACRO_ON_CMDLINE_H diff --git a/tests/auto/tools/moc/namespaced-flags.h b/tests/auto/tools/moc/namespaced-flags.h index 97aecfbf3c..ce1e12d83f 100644 --- a/tests/auto/tools/moc/namespaced-flags.h +++ b/tests/auto/tools/moc/namespaced-flags.h @@ -38,6 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#ifndef NAMESPACED_FLAGS_H +#define NAMESPACED_FLAGS_H #include <QObject> namespace Foo { @@ -78,3 +81,4 @@ namespace Foo { } Q_DECLARE_OPERATORS_FOR_FLAGS( Foo::Bar::Flags ) +#endif // NAMESPACED_FLAGS_H diff --git a/tests/auto/tools/moc/no-keywords.h b/tests/auto/tools/moc/no-keywords.h index ffd5928370..3fa6f089e0 100644 --- a/tests/auto/tools/moc/no-keywords.h +++ b/tests/auto/tools/moc/no-keywords.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef NO_KEYWORDS_H +#define NO_KEYWORDS_H + #define QT_NO_KEYWORDS #undef signals #undef slots @@ -85,3 +88,4 @@ private: #define emit #undef QT_NO_KEYWORDS +#endif // NO_KEYWORDS_H diff --git a/tests/auto/tools/moc/oldstyle-casts.h b/tests/auto/tools/moc/oldstyle-casts.h index 89f90a3504..0c4e9e8e00 100644 --- a/tests/auto/tools/moc/oldstyle-casts.h +++ b/tests/auto/tools/moc/oldstyle-casts.h @@ -38,9 +38,12 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#ifndef OLDSTYLE_CASTS_H +#define OLDSTYLE_CASTS_H #include <QtCore/qobject.h> -class Foo: public QObject +class OldStyleCast: public QObject { Q_OBJECT public: @@ -54,3 +57,4 @@ public slots: inline void slot(int, QObject * const) {} }; +#endif // OLDSTYLE_CASTS_H diff --git a/tests/auto/tools/moc/parse-boost.h b/tests/auto/tools/moc/parse-boost.h index b93eb7130c..4dd7693358 100644 --- a/tests/auto/tools/moc/parse-boost.h +++ b/tests/auto/tools/moc/parse-boost.h @@ -38,6 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#ifndef PARSE_BOOST_H +#define PARSE_BOOST_H #include <boost/aligned_storage.hpp> #include <boost/any.hpp> #include <boost/array.hpp> @@ -124,3 +127,4 @@ #include <boost/version.hpp> #include <boost/visit_each.hpp> #include <boost/weak_ptr.hpp> +#endif // PARSE_BOOST_H diff --git a/tests/auto/tools/moc/pp-dollar-signs.h b/tests/auto/tools/moc/pp-dollar-signs.h index 98134a5019..a90b654ee4 100644 --- a/tests/auto/tools/moc/pp-dollar-signs.h +++ b/tests/auto/tools/moc/pp-dollar-signs.h @@ -39,4 +39,8 @@ ** ****************************************************************************/ +#ifndef PP_DOLLAR_SIGNS_H +#define PP_DOLLAR_SIGNS_H + $$ = parser->createFoo() +#endif // PP_DOLLAR_SIGNS_H diff --git a/tests/auto/tools/moc/pure-virtual-signals.h b/tests/auto/tools/moc/pure-virtual-signals.h index fb23089b30..070f5894a3 100644 --- a/tests/auto/tools/moc/pure-virtual-signals.h +++ b/tests/auto/tools/moc/pure-virtual-signals.h @@ -38,6 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#ifndef PURE_VIRTUAL_SIGNALS_H +#define PURE_VIRTUAL_SIGNALS_H #include <QObject> class PureVirtualSignalsTest : public QObject @@ -58,3 +61,4 @@ signals: void mySignal(); void mySignal2(int foo); }; +#endif // PURE_VIRTUAL_SIGNALS_H diff --git a/tests/auto/tools/moc/qinvokable.h b/tests/auto/tools/moc/qinvokable.h index 9070f2ab8e..a47ae72b2b 100644 --- a/tests/auto/tools/moc/qinvokable.h +++ b/tests/auto/tools/moc/qinvokable.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef QINVOKABLE_H +#define QINVOKABLE_H + #include <QObject> class InvokableBeforeReturnType : public QObject @@ -55,3 +58,4 @@ public: Q_INVOKABLE inline void foo() {} Q_INVOKABLE virtual void bar() {} }; +#endif // QINVOKABLE_H diff --git a/tests/auto/tools/moc/qprivateslots.h b/tests/auto/tools/moc/qprivateslots.h index 5b0db3d27e..82a68270af 100644 --- a/tests/auto/tools/moc/qprivateslots.h +++ b/tests/auto/tools/moc/qprivateslots.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef QPRIVATESLOTS_H +#define QPRIVATESLOTS_H + #include <QObject> struct TestQPrivateSlots_Private @@ -58,3 +61,4 @@ private: TestQPrivateSlots_Private *d; }; +#endif // QPRIVATESLOTS_H diff --git a/tests/auto/tools/moc/qtbug-35657-gadget.h b/tests/auto/tools/moc/qtbug-35657-gadget.h index 1f25ce1b1d..c030405c67 100644 --- a/tests/auto/tools/moc/qtbug-35657-gadget.h +++ b/tests/auto/tools/moc/qtbug-35657-gadget.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef QTBUG_35657_GADGET_H +#define QTBUG_35657_GADGET_H + #include <QObject> namespace QTBUG_35657 { @@ -49,3 +52,5 @@ namespace QTBUG_35657 { enum SomeEnum { SomeEnumValue = 0 }; }; } + +#endif // QTBUG_35657_GADGET_H diff --git a/tests/auto/tools/moc/related-metaobjects-in-gadget.h b/tests/auto/tools/moc/related-metaobjects-in-gadget.h index 5665a79251..556e92efaf 100644 --- a/tests/auto/tools/moc/related-metaobjects-in-gadget.h +++ b/tests/auto/tools/moc/related-metaobjects-in-gadget.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef RELATED_METAOBJECTS_IN_GADGET_H +#define RELATED_METAOBJECTS_IN_GADGET_H + #include <QObject> #include "qtbug-35657-gadget.h" @@ -52,3 +55,5 @@ namespace QTBUG_35657 { A::SomeEnum blah() const { return A::SomeEnumValue; } }; } + +#endif // RELATED_METAOBJECTS_IN_GADGET_H diff --git a/tests/auto/tools/moc/related-metaobjects-in-namespaces.h b/tests/auto/tools/moc/related-metaobjects-in-namespaces.h index 0a3e9ed77d..4be856391f 100644 --- a/tests/auto/tools/moc/related-metaobjects-in-namespaces.h +++ b/tests/auto/tools/moc/related-metaobjects-in-namespaces.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef RELATED_METAOBJECTS_IN_NAMESPACES_H +#define RELATED_METAOBJECTS_IN_NAMESPACES_H + #include <QObject> namespace QTBUG_2151 { @@ -58,3 +61,5 @@ namespace QTBUG_2151 { A::SomeEnum blah() const { return A::SomeEnumValue; } }; } + +#endif // RELATED_METAOBJECTS_IN_NAMESPACES_H diff --git a/tests/auto/tools/moc/single-quote-digit-separator-n3781.h b/tests/auto/tools/moc/single-quote-digit-separator-n3781.h index 0b234011d5..f5f39c7dd7 100644 --- a/tests/auto/tools/moc/single-quote-digit-separator-n3781.h +++ b/tests/auto/tools/moc/single-quote-digit-separator-n3781.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef SINGLE_QUOTE_DIGIT_SEPARATOR_N3781_H +#define SINGLE_QUOTE_DIGIT_SEPARATOR_N3781_H + #include <QObject> class KDAB : public QObject @@ -56,3 +59,4 @@ public: }; Q_ENUMS(Salaries) }; +#endif // SINGLE_QUOTE_DIGIT_SEPARATOR_N3781_H diff --git a/tests/auto/tools/moc/single_function_keyword.h b/tests/auto/tools/moc/single_function_keyword.h index 44a1a41d30..6717509517 100644 --- a/tests/auto/tools/moc/single_function_keyword.h +++ b/tests/auto/tools/moc/single_function_keyword.h @@ -38,6 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#ifndef SINGLE_FUNCTION_KEYWORD_H +#define SINGLE_FUNCTION_KEYWORD_H #include <QObject> class SingleFunctionKeywordBeforeReturnType : public QObject @@ -73,3 +76,4 @@ public: inline Q_SLOT void mySlot() { emit mySignal(); } }; +#endif // SINGLE_FUNCTION_KEYWORD_H diff --git a/tests/auto/tools/moc/slots-with-void-template.h b/tests/auto/tools/moc/slots-with-void-template.h index c38437ca54..524d565345 100644 --- a/tests/auto/tools/moc/slots-with-void-template.h +++ b/tests/auto/tools/moc/slots-with-void-template.h @@ -38,6 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#ifndef SLOTS_WITH_VOID_TEMPLATE_H +#define SLOTS_WITH_VOID_TEMPLATE_H #include <QObject> template <typename T> @@ -59,3 +62,4 @@ signals: void myVoidSignal(); void myVoidSignal2(void); }; +#endif // SLOTS_WITH_VOID_TEMPLATE_H diff --git a/tests/auto/tools/moc/task192552.h b/tests/auto/tools/moc/task192552.h index 23665bbb07..b221984d7d 100644 --- a/tests/auto/tools/moc/task192552.h +++ b/tests/auto/tools/moc/task192552.h @@ -38,6 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#ifndef TASK192552_H +#define TASK192552_H /* <:: is not valid C++, but we want moc to treat it as < :: since this is usually the intention @@ -53,3 +56,4 @@ public: QList<::QObject*> m_objects; #endif }; +#endif // TASK192552_H diff --git a/tests/auto/tools/moc/task234909.h b/tests/auto/tools/moc/task234909.h index 2ad8b9a410..37948441eb 100644 --- a/tests/auto/tools/moc/task234909.h +++ b/tests/auto/tools/moc/task234909.h @@ -38,6 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#ifndef TASK234909_H +#define TASK234909_H #include <qobject.h> namespace NS_A { @@ -71,3 +74,4 @@ namespace NS_Main { } } +#endif // TASK234909_H diff --git a/tests/auto/tools/moc/task87883.h b/tests/auto/tools/moc/task87883.h index d6687588f7..65988221f1 100644 --- a/tests/auto/tools/moc/task87883.h +++ b/tests/auto/tools/moc/task87883.h @@ -38,6 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#ifndef TASK87883_H +#define TASK87883_H /* The bug is triggered only if there is a multiline comment after an #include statement that in the following line contains a single quote but lacks a finishing @@ -55,3 +58,4 @@ public: inline Task87883() {} }; +#endif // TASK87883_H diff --git a/tests/auto/tools/moc/template-gtgt.h b/tests/auto/tools/moc/template-gtgt.h index 2c2f56c34d..b5d83b5796 100644 --- a/tests/auto/tools/moc/template-gtgt.h +++ b/tests/auto/tools/moc/template-gtgt.h @@ -38,6 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#ifndef TEMPLATE_GTGT_H +#define TEMPLATE_GTGT_H template<class TYPE, size_t COUNT> class myTemplate : QString, @@ -58,3 +61,4 @@ public: { } }; +#endif // TEMPLATE_GTGT_H diff --git a/tests/auto/tools/moc/trigraphs.h b/tests/auto/tools/moc/trigraphs.h index cc1824190e..301ea35265 100644 --- a/tests/auto/tools/moc/trigraphs.h +++ b/tests/auto/tools/moc/trigraphs.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef TRIGRAPHS_H +#define TRIGRAPHS_H + #include <QObject> namespace AAA { @@ -61,3 +64,4 @@ namespace BBB { }; } +#endif // TRIGRAPHS_H diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 38d31509d5..72e24c282c 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -692,8 +692,8 @@ void tst_Moc::warnOnExtraSignalSlotQualifiaction() QVERIFY(!mocOut.isEmpty()); QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError()); QCOMPARE(mocWarning, header + - QString(":53: Warning: Function declaration Test::badFunctionDeclaration contains extra qualification. Ignoring as signal or slot.\n") + - header + QString(":56: Warning: parsemaybe: Function declaration Test::anotherOne contains extra qualification. Ignoring as signal or slot.\n")); + QString(":56: Warning: Function declaration Test::badFunctionDeclaration contains extra qualification. Ignoring as signal or slot.\n") + + header + QString(":59: Warning: parsemaybe: Function declaration Test::anotherOne contains extra qualification. Ignoring as signal or slot.\n")); #else QSKIP("Only tested on linux/gcc"); #endif @@ -971,7 +971,7 @@ void tst_Moc::warnOnMultipleInheritance() QVERIFY(!mocOut.isEmpty()); QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError()); QCOMPARE(mocWarning, header + - QString(":53: Warning: Class Bar inherits from two QObject subclasses QWindow and Foo. This is not supported!\n")); + QString(":56: Warning: Class Bar inherits from two QObject subclasses QWindow and Foo. This is not supported!\n")); #else QSKIP("Only tested on linux/gcc"); #endif @@ -1034,7 +1034,7 @@ void tst_Moc::forgottenQInterface() QVERIFY(!mocOut.isEmpty()); QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError()); QCOMPARE(mocWarning, header + - QString(":55: Warning: Class Test implements the interface MyInterface but does not list it in Q_INTERFACES. qobject_cast to MyInterface will not work!\n")); + QString(":58: Warning: Class Test implements the interface MyInterface but does not list it in Q_INTERFACES. qobject_cast to MyInterface will not work!\n")); #else QSKIP("Only tested on linux/gcc"); #endif @@ -1350,7 +1350,7 @@ void tst_Moc::warnOnPropertyWithoutREAD() QVERIFY(!mocOut.isEmpty()); QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError()); QCOMPARE(mocWarning, header + - QString(":46: Warning: Property declaration foo has no READ accessor function or associated MEMBER variable. The property will be invalid.\n")); + QString(":49: Warning: Property declaration foo has no READ accessor function or associated MEMBER variable. The property will be invalid.\n")); #else QSKIP("Only tested on linux/gcc"); #endif @@ -1460,8 +1460,8 @@ void tst_Moc::warnOnVirtualSignal() QByteArray mocOut = proc.readAllStandardOutput(); QVERIFY(!mocOut.isEmpty()); QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError()); - QCOMPARE(mocWarning, header + QString(":48: Warning: Signals cannot be declared virtual\n") + - header + QString(":50: Warning: Signals cannot be declared virtual\n")); + QCOMPARE(mocWarning, header + QString(":51: Warning: Signals cannot be declared virtual\n") + + header + QString(":53: Warning: Signals cannot be declared virtual\n")); #else QSKIP("Only tested on linux/gcc"); #endif @@ -1575,7 +1575,7 @@ void tst_Moc::notifyError() QVERIFY(mocOut.isEmpty()); QString mocError = QString::fromLocal8Bit(proc.readAllStandardError()); QCOMPARE(mocError, header + - QString(":52: Error: NOTIFY signal 'fooChanged' of property 'foo' does not exist in class ClassWithWrongNOTIFY.\n")); + QString(":55: Error: NOTIFY signal 'fooChanged' of property 'foo' does not exist in class ClassWithWrongNOTIFY.\n")); #else QSKIP("Only tested on linux/gcc"); #endif diff --git a/tests/auto/tools/moc/unterminated-function-macro.h b/tests/auto/tools/moc/unterminated-function-macro.h index 813d60f0e4..60595d1536 100644 --- a/tests/auto/tools/moc/unterminated-function-macro.h +++ b/tests/auto/tools/moc/unterminated-function-macro.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef UNTERMINATED_FUNCTION_MACRO_H +#define UNTERMINATED_FUNCTION_MACRO_H + class Dummy : public QObject { Q_OBJECT } @@ -49,3 +52,4 @@ static void foo() { MACRO(foo } +#endif // UNTERMINATED_FUNCTION_MACRO_H diff --git a/tests/auto/tools/moc/using-namespaces.h b/tests/auto/tools/moc/using-namespaces.h index c662bb762a..64ffa96a21 100644 --- a/tests/auto/tools/moc/using-namespaces.h +++ b/tests/auto/tools/moc/using-namespaces.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef USING_NAMESPACES_H +#define USING_NAMESPACES_H + namespace Foo {} namespace Bar { @@ -54,3 +57,4 @@ using namespace Foo; using namespace Bar::Huh; using namespace ::Top; +#endif // USING_NAMESPACES_H diff --git a/tests/auto/tools/moc/warn-on-multiple-qobject-subclasses.h b/tests/auto/tools/moc/warn-on-multiple-qobject-subclasses.h index 346909cca1..bbe416f7f0 100644 --- a/tests/auto/tools/moc/warn-on-multiple-qobject-subclasses.h +++ b/tests/auto/tools/moc/warn-on-multiple-qobject-subclasses.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef WARN_ON_MULTIPLE_QOBJECT_SUBCLASSES_H +#define WARN_ON_MULTIPLE_QOBJECT_SUBCLASSES_H + #include <QtGui> class Foo : public QObject @@ -53,3 +56,4 @@ class Bar : public QWindow, public Foo }; +#endif // WARN_ON_MULTIPLE_QOBJECT_SUBCLASSES_H diff --git a/tests/auto/tools/moc/warn-on-property-without-read.h b/tests/auto/tools/moc/warn-on-property-without-read.h index 75d2953aa1..85c092d240 100644 --- a/tests/auto/tools/moc/warn-on-property-without-read.h +++ b/tests/auto/tools/moc/warn-on-property-without-read.h @@ -38,6 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#ifndef WARN_ON_PROPERTY_WITHOUT_READ_H +#define WARN_ON_PROPERTY_WITHOUT_READ_H #include <QObject> class ClassWithPropertyWithoutREAD : public QObject @@ -46,3 +49,4 @@ class ClassWithPropertyWithoutREAD : public QObject Q_PROPERTY(int foo) Q_PROPERTY(int bar READ bar) }; +#endif // WARN_ON_PROPERTY_WITHOUT_READ_H |