From ef077750ce47212570c9bc1ce6367309678440f6 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 20 Jun 2014 12:30:58 +0200 Subject: [PATCH] QDebug: Remove handling of FORCE_UREF define This is the only place in Qt source code we use FORCE_UREF, and can be traced back to the very first qt.git commit. In any case, it's broken: It returns a reference to a local variable, since the debug argument is _not_ a reference. Using a reference both for the argument and the return value would be actually the canonical solution, but that breaks with QDebug << operator(QDebug, const QVariant &), exported in QtCore. The C++ lookup rules apparently prefer this overload then to be used for outputting containers ... Change-Id: Iaf5e5dd89d4f3ebe6454eba219046b4f25b0d717 Reviewed-by: hjk --- src/corelib/io/qdebug.h | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 94b19f9cab4..584d6bf41fc 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -151,13 +151,8 @@ inline QDebug &QDebug::operator=(const QDebug &other) return *this; } -#if defined(FORCE_UREF) -template -inline QDebug &operator<<(QDebug debug, const QList &list) -#else template inline QDebug operator<<(QDebug debug, const QList &list) -#endif { const bool oldSetting = debug.autoInsertSpaces(); debug.nospace() << '('; @@ -171,13 +166,8 @@ inline QDebug operator<<(QDebug debug, const QList &list) return debug.maybeSpace(); } -#if defined(FORCE_UREF) -template -inline QDebug &operator<<(QDebug debug, const QVector &vec) -#else template inline QDebug operator<<(QDebug debug, const QVector &vec) -#endif { const bool oldSetting = debug.autoInsertSpaces(); debug.nospace() << "QVector"; @@ -185,13 +175,8 @@ inline QDebug operator<<(QDebug debug, const QVector &vec) return operator<<(debug, vec.toList()); } -#if defined(FORCE_UREF) -template -inline QDebug &operator<<(QDebug debug, const QMap &map) -#else template inline QDebug operator<<(QDebug debug, const QMap &map) -#endif { const bool oldSetting = debug.autoInsertSpaces(); debug.nospace() << "QMap("; @@ -204,13 +189,8 @@ inline QDebug operator<<(QDebug debug, const QMap &map) return debug.maybeSpace(); } -#if defined(FORCE_UREF) -template -inline QDebug &operator<<(QDebug debug, const QHash &hash) -#else template inline QDebug operator<<(QDebug debug, const QHash &hash) -#endif { const bool oldSetting = debug.autoInsertSpaces(); debug.nospace() << "QHash("; @@ -222,13 +202,8 @@ inline QDebug operator<<(QDebug debug, const QHash &hash) return debug.maybeSpace(); } -#if defined(FORCE_UREF) -template -inline QDebug &operator<<(QDebug debug, const QPair &pair) -#else template inline QDebug operator<<(QDebug debug, const QPair &pair) -#endif { const bool oldSetting = debug.autoInsertSpaces(); debug.nospace() << "QPair(" << pair.first << ',' << pair.second << ')'; @@ -245,13 +220,8 @@ inline QDebug operator<<(QDebug debug, const QSet &set) return operator<<(debug, set.toList()); } -#if defined(FORCE_UREF) -template -inline QDebug &operator<<(QDebug debug, const QContiguousCache &cache) -#else template inline QDebug operator<<(QDebug debug, const QContiguousCache &cache) -#endif { const bool oldSetting = debug.autoInsertSpaces(); debug.nospace() << "QContiguousCache("; @@ -265,13 +235,8 @@ inline QDebug operator<<(QDebug debug, const QContiguousCache &cache) return debug.maybeSpace(); } -#if defined(FORCE_UREF) -template -inline QDebug &operator<<(QDebug debug, const QFlags &flags) -#else template inline QDebug operator<<(QDebug debug, const QFlags &flags) -#endif { const bool oldSetting = debug.autoInsertSpaces(); debug.nospace() << "QFlags(";