summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2014-11-24 13:37:06 +0100
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2014-11-24 13:39:13 +0100
commit34aba4724f196e34ed02cf50073f41968f119bb6 (patch)
tree0ebdfcabda989ab76ee6de53c6461553c7a767a5 /src/corelib/global
parentb86b2a742afae118bf974c82ba966ddb0cae4afb (diff)
parentb1cf07f495e10c93e53651ac03e46ebdaea0a97e (diff)
Merge remote-tracking branch 'origin/5.4' into dev
Conflicts: src/corelib/io/qiodevice.cpp src/plugins/bearer/linux_common/qofonoservice_linux.cpp src/plugins/bearer/linux_common/qofonoservice_linux_p.h src/plugins/platforms/android/qandroidplatformtheme.cpp src/tools/bootstrap/bootstrap.pro src/widgets/styles/qmacstyle_mac.mm Change-Id: Ia02aab6c4598ce74e9c30bb4666d5e2ef000f99b
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qcompilerdetection.h66
-rw-r--r--src/corelib/global/qglobal.h2
-rw-r--r--src/corelib/global/qlibraryinfo.cpp10
-rw-r--r--src/corelib/global/qlogging.cpp23
-rw-r--r--src/corelib/global/qnamespace.qdoc25
-rw-r--r--src/corelib/global/qprocessordetection.h4
6 files changed, 75 insertions, 55 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 8ac84599f2..ee396409d8 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -78,7 +78,7 @@
# define Q_NO_USING_KEYWORD
#elif defined(_MSC_VER)
-# define Q_CC_MSVC
+# define Q_CC_MSVC (_MSC_VER)
# define Q_CC_MSVC_NET
# define Q_OUTOFLINE_TEMPLATE inline
# if _MSC_VER < 1600
@@ -137,14 +137,14 @@
# endif
#elif defined(__GNUC__)
-# define Q_CC_GNU
+# define Q_CC_GNU (__GNUC__ * 100 + __GNUC_MINOR__)
# define Q_C_CALLBACKS
# if defined(__MINGW32__)
# define Q_CC_MINGW
# endif
# if defined(__INTEL_COMPILER)
/* Intel C++ also masquerades as GCC */
-# define Q_CC_INTEL
+# define Q_CC_INTEL (__INTEL_COMPILER)
# define Q_ASSUME_IMPL(expr) __assume(expr)
# define Q_UNREACHABLE_IMPL() __builtin_unreachable()
# if __INTEL_COMPILER >= 1300 && !defined(__APPLE__)
@@ -152,7 +152,26 @@
# endif
# elif defined(__clang__)
/* Clang also masquerades as GCC */
-# define Q_CC_CLANG
+# if defined(__apple_build_version__)
+# /* http://en.wikipedia.org/wiki/Xcode#Toolchain_Versions */
+# if __apple_build_version__ >= 600051
+# define Q_CC_CLANG 305
+# elif __apple_build_version__ >= 503038
+# define Q_CC_CLANG 304
+# elif __apple_build_version__ >= 500275
+# define Q_CC_CLANG 303
+# elif __apple_build_version__ >= 425024
+# define Q_CC_CLANG 302
+# elif __apple_build_version__ >= 318045
+# define Q_CC_CLANG 301
+# elif __apple_build_version__ >= 211101
+# define Q_CC_CLANG 300
+# else
+# error "Unknown Apple Clang version"
+# endif
+# else
+# define Q_CC_CLANG ((__clang_major__ * 100) + __clang_minor__)
+# endif
# define Q_ASSUME_IMPL(expr) if (expr){} else __builtin_unreachable()
# define Q_UNREACHABLE_IMPL() __builtin_unreachable()
# if !defined(__has_extension)
@@ -168,7 +187,7 @@
# endif
# else
/* Plain GCC */
-# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
+# if Q_CC_GNU >= 405
# define Q_ASSUME_IMPL(expr) if (expr){} else __builtin_unreachable()
# define Q_UNREACHABLE_IMPL() __builtin_unreachable()
# define Q_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text)))
@@ -202,7 +221,7 @@
# define QT_NO_ARM_EABI
# endif
# endif
-# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403 && !defined(Q_CC_CLANG)
+# if Q_CC_GNU >= 403 && !defined(Q_CC_CLANG)
# define Q_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
# endif
@@ -308,7 +327,7 @@
/* Using the `using' keyword avoids Intel C++ for Linux warnings */
# elif defined(__INTEL_COMPILER)
-# define Q_CC_INTEL
+# define Q_CC_INTEL (__INTEL_COMPILER)
/* Uses CFront, make sure to read the manual how to tweak templates. */
# elif defined(__ghs)
@@ -566,7 +585,7 @@
# endif
// Variadic macros are supported for gnu++98, c++11, c99 ... since 2.9
-# if ((__clang_major__ * 100) + __clang_minor__) >= 209
+# if Q_CC_CLANG >= 209
# if !defined(__STRICT_ANSI__) || defined(__GXX_EXPERIMENTAL_CXX0X__) \
|| (defined(__cplusplus) && (__cplusplus >= 201103L)) \
|| (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
@@ -581,7 +600,7 @@
# define Q_COMPILER_ALIGNAS
# define Q_COMPILER_ALIGNOF
# endif
-# if 0 /* not implemented in clang yet */
+# if __has_feature(cxx_atomic) && __has_include(<atomic>)
# define Q_COMPILER_ATOMICS
# endif
# if __has_feature(cxx_attributes)
@@ -668,7 +687,7 @@
# define Q_COMPILER_VARIADIC_TEMPLATES
# endif
/* Features that have no __has_feature() check */
-# if ((__clang_major__ * 100) + __clang_minor__) >= 209 /* since clang 2.9 */
+# if Q_CC_CLANG >= 209 /* since clang 2.9 */
# define Q_COMPILER_EXTERN_TEMPLATES
# endif
# endif
@@ -709,7 +728,7 @@
#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_CLANG)
# define Q_COMPILER_RESTRICTED_VLA
# define Q_COMPILER_THREADSAFE_STATICS
-# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403
+# if Q_CC_GNU >= 403
// GCC supports binary literals in C, C++98 and C++11 modes
# define Q_COMPILER_BINARY_LITERALS
# endif
@@ -720,13 +739,13 @@
# define Q_COMPILER_VARIADIC_MACROS
# endif
# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
-# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403
+# if Q_CC_GNU >= 403
/* C++11 features supported in GCC 4.3: */
# define Q_COMPILER_DECLTYPE
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_STATIC_ASSERT
# endif
-# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404
+# if Q_CC_GNU >= 404
/* C++11 features supported in GCC 4.4: */
# define Q_COMPILER_AUTO_FUNCTION
# define Q_COMPILER_AUTO_TYPE
@@ -735,7 +754,7 @@
# define Q_COMPILER_UNICODE_STRINGS
# define Q_COMPILER_VARIADIC_TEMPLATES
# endif
-# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
+# if Q_CC_GNU >= 405
/* C++11 features supported in GCC 4.5: */
# define Q_COMPILER_EXPLICIT_CONVERSIONS
/* GCC 4.4 implements initializer_list but does not define typedefs required
@@ -745,7 +764,7 @@
# define Q_COMPILER_RAW_STRINGS
# define Q_COMPILER_CLASS_ENUM
# endif
-# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
+# if Q_CC_GNU >= 406
/* Pre-4.6 compilers implement a non-final snapshot of N2346, hence default and delete
* functions are supported only if they are public. Starting from 4.6, GCC handles
* final version - the access modifier is not relevant. */
@@ -757,7 +776,7 @@
# define Q_COMPILER_UNRESTRICTED_UNIONS
# define Q_COMPILER_RANGE_FOR
# endif
-# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407
+# if Q_CC_GNU >= 407
/* GCC 4.4 implemented <atomic> and std::atomic using its old intrinsics.
* However, the implementation is incomplete for most platforms until GCC 4.7:
* instead, std::atomic would use an external lock. Since we need an std::atomic
@@ -773,20 +792,20 @@
# define Q_COMPILER_TEMPLATE_ALIAS
# define Q_COMPILER_UDL
# endif
-# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408
+# if Q_CC_GNU >= 408
# define Q_COMPILER_ATTRIBUTES
# define Q_COMPILER_ALIGNAS
# define Q_COMPILER_ALIGNOF
# define Q_COMPILER_INHERITING_CONSTRUCTORS
# define Q_COMPILER_THREAD_LOCAL
-# if (__GNUC__ * 100 + __GNUC_MINOR__) > 408 || __GNUC_PATCHLEVEL__ >= 1
+# if Q_CC_GNU > 408 || __GNUC_PATCHLEVEL__ >= 1
# define Q_COMPILER_REF_QUALIFIERS
# endif
# endif
/* C++11 features are complete as of GCC 4.8.1 */
# endif
# if __cplusplus > 201103L
-# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409
+# if Q_CC_GNU >= 409
/* C++1y features in GCC 4.9 - deprecated, do not update this list */
//# define Q_COMPILER_BINARY_LITERALS // already supported since GCC 4.3 as an extension
# define Q_COMPILER_LAMBDA_CAPTURES
@@ -880,6 +899,15 @@
# undef Q_COMPILER_INITIALIZER_LISTS
# undef Q_COMPILER_RVALUE_REFS
# undef Q_COMPILER_REF_QUALIFIERS
+// Also disable <atomic>, since it's clearly not there
+# undef Q_COMPILER_ATOMICS
+# endif
+# if defined(_LIBCPP_VERSION)
+// libc++ uses __has_feature(cxx_atomic), so disable the feature if the compiler
+// doesn't support it. That's required for the Intel compiler on OS X, for example.
+# if !__has_feature(cxx_atomic)
+# undef Q_COMPILER_ATOMICS
+# endif
# endif
# if defined(Q_COMPILER_THREADSAFE_STATICS) && defined(Q_OS_MAC)
// Mac OS X: Apple's low-level implementation of the C++ support library
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 4a21ab88d8..4e8721f7d7 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -877,7 +877,7 @@ public:
// (http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#382).
// GCC 4.3 and 4.4 have support for decltype, but are affected by DR 382.
# if defined(Q_COMPILER_DECLTYPE) && \
- (defined(Q_CC_CLANG) || defined(Q_CC_INTEL) || !defined(Q_CC_GNU) || (__GNUC__ * 100 + __GNUC_MINOR__) >= 405)
+ (defined(Q_CC_CLANG) || defined(Q_CC_INTEL) || !defined(Q_CC_GNU) || Q_CC_GNU >= 405)
# define QT_FOREACH_DECLTYPE(x) typename QtPrivate::remove_reference<decltype(x)>::type
# else
# define QT_FOREACH_DECLTYPE(x) __typeof__((x))
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index c3ec2bc7f6..7ca0aa7f0b 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -84,14 +84,7 @@ class QLibraryInfoPrivate
{
public:
static QSettings *findConfiguration();
-#ifndef QT_BOOTSTRAPPED
- static void cleanup()
- {
- QLibrarySettings *ls = qt_library_settings();
- if (ls)
- ls->settings.reset(0);
- }
-#else
+#ifdef QT_BOOTSTRAPPED
static bool haveGroup(QLibraryInfo::PathGroup group)
{
QLibrarySettings *ls = qt_library_settings();
@@ -114,7 +107,6 @@ QLibrarySettings::QLibrarySettings()
: settings(QLibraryInfoPrivate::findConfiguration())
{
#ifndef QT_BOOTSTRAPPED
- qAddPostRoutine(QLibraryInfoPrivate::cleanup);
bool haveEffectivePaths;
bool havePaths;
#endif
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index f356bab42d..39c5ac602e 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -1101,14 +1101,9 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con
if (!pattern) {
// after destruction of static QMessagePattern instance
message.append(str);
- message.append(QLatin1Char('\n'));
return message;
}
- // don't print anything if pattern was empty
- if (pattern->tokens[0] == 0)
- return message;
-
bool skip = false;
// we do not convert file, function, line literals to local encoding due to overhead
@@ -1227,7 +1222,6 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con
message.append(QLatin1String(token));
}
}
- message.append(QLatin1Char('\n'));
return message;
}
@@ -1289,7 +1283,7 @@ static void android_default_message_handler(QtMsgType type,
case QtFatalMsg: priority = ANDROID_LOG_FATAL; break;
};
- __android_log_print(priority, "Qt", "%s:%d (%s): %s",
+ __android_log_print(priority, "Qt", "%s:%d (%s): %s\n",
context.file, context.line,
context.function, qPrintable(message));
}
@@ -1303,16 +1297,21 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con
{
QString logMessage = qFormatLogMessage(type, context, buf);
+ // print nothing if message pattern didn't apply / was empty.
+ // (still print empty lines, e.g. because message itself was empty)
+ if (logMessage.isNull())
+ return;
+
if (!qt_logging_to_console()) {
#if defined(Q_OS_WIN)
+ logMessage.append(QLatin1Char('\n'));
OutputDebugString(reinterpret_cast<const wchar_t *>(logMessage.utf16()));
return;
#elif defined(QT_USE_SLOG2)
+ logMessage.append(QLatin1Char('\n'));
slog2_default_handler(type, logMessage.toLocal8Bit().constData());
return;
#elif defined(QT_USE_JOURNALD) && !defined(QT_BOOTSTRAPPED)
- // remove trailing \n, systemd appears to want them newline-less
- logMessage.chop(1);
systemd_default_message_handler(type, context, logMessage);
return;
#elif defined(Q_OS_ANDROID)
@@ -1320,7 +1319,7 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con
return;
#endif
}
- fprintf(stderr, "%s", logMessage.toLocal8Bit().constData());
+ fprintf(stderr, "%s\n", logMessage.toLocal8Bit().constData());
fflush(stderr);
}
@@ -1380,7 +1379,7 @@ static void qt_message_print(QtMsgType msgType, const QMessageLogContext &contex
}
ungrabMessageHandler();
} else {
- fprintf(stderr, "%s", message.toLocal8Bit().constData());
+ fprintf(stderr, "%s\n", message.toLocal8Bit().constData());
}
}
@@ -1579,7 +1578,7 @@ void qErrnoWarning(int code, const char *msg, ...)
The default \a pattern is "%{if-category}%{category}: %{endif}%{message}".
The \a pattern can also be changed at runtime by setting the QT_MESSAGE_PATTERN
- environment variable; if both qSetMessagePattern() is called and QT_MESSAGE_PATTERN is
+ environment variable; if both \l qSetMessagePattern() is called and QT_MESSAGE_PATTERN is
set, the environment variable takes precedence.
Custom message handlers can use qFormatLogMessage() to take \a pattern into account.
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 4e074bcdb5..53d2b7b58b 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -134,7 +134,7 @@
\value AA_MacDontSwapCtrlAndMeta On Mac OS X by default, Qt swaps the
Control and Meta (Command) keys (i.e., whenever Control is pressed, Qt
sends Meta, and whenever Meta is pressed Control is sent). When this
- attribute is true, Qt will not do the flip. QKeySequence::StandardShortcuts
+ attribute is true, Qt will not do the flip. \l QKeySequence::StandardKey
will also flip accordingly (i.e., QKeySequence::Copy will be
Command+C on the keyboard regardless of the value set, though what is output for
QKeySequence::toString(QKeySequence::PortableText) will be different).
@@ -144,7 +144,7 @@
to be consistent in pixels-per-point across devices rather than
defining 1 point as 1/72 inch.
- \value AA_X11InitThreads Calls XInitThreads() as part of the QApplication
+ \value AA_X11InitThreads Calls \c XInitThreads() as part of the QApplication
construction in order to make Xlib calls thread-safe. This
attribute must be set before QApplication is constructed.
@@ -159,10 +159,11 @@
\value AA_UseHighDpiPixmaps Make QIcon::pixmap() generate high-dpi pixmaps
that can be larger than the requested size. Such pixmaps will have
- devicePixelRatio set to a value higher than 1. After setting this
- attribute application code that uses pixmap sizes in layout geometry
- calculations should typically divide by QPixmap::devicePixelRatio()
- to get device-independent layout geometry.
+ \l {QPixmap::devicePixelRatio}{devicePixelRatio()} set to a value higher than 1.
+
+ After setting this attribute, application code that uses pixmap
+ sizes in layout geometry calculations should typically divide by
+ \l {QPixmap::devicePixelRatio}{devicePixelRatio()} to get device-independent layout geometry.
\value AA_ForceRasterWidgets Make top-level widgets use pure raster surfaces,
and do not support non-native GL-based child widgets.
@@ -182,7 +183,7 @@
\l{http://www.mesa3d.org/llvmpipe.html}{Mesa llvmpipe}, providing
OpenGL 2.1. The value may have no effect if no such OpenGL
implementation is available. The default name of this library is
- opengl32sw.dll and can be overridden by setting the environment
+ \c opengl32sw.dll and can be overridden by setting the environment
variable \e QT_OPENGL_DLL. See the platform-specific pages, for
instance \l{Qt for Windows}, for more information. This value has
been added in Qt 5.4.
@@ -221,7 +222,7 @@
\value AllButtons This value corresponds to a mask of all
possible mouse buttons. Use to set the 'acceptedButtons'
- property of a mouseArea to accept ALL mouse buttons.
+ property of a MouseArea to accept ALL mouse buttons.
\value LeftButton The left button is pressed, or an event refers
to the left button. (The left button may be the right button on
@@ -2443,7 +2444,7 @@
\value ImhExclusiveInputMask This mask yields nonzero if any of the exclusive flags are used.
- \note If several exclusive flags are ORed together, the resulting character set will
+ \note If several exclusive flags are OR-ed together, the resulting character set will
consist of the union of the specified sets. For instance specifying \c ImhNumbersOnly and
\c ImhUppercaseOnly would yield a set consisting of numbers and uppercase letters.
@@ -2803,11 +2804,11 @@
This enum type describes the state of a gesture.
+ \value NoGesture No gesture has been detected.
\value GestureStarted A continuous gesture has started.
\value GestureUpdated A gesture continues.
\value GestureFinished A gesture has finished.
\value GestureCanceled A gesture was canceled.
- \omitvalue NoGesture
\sa QGesture
*/
@@ -2969,8 +2970,8 @@
This enum provides additional information concerning a QMouseEvent.
\value MouseEventCreatedDoubleClick Indicates that Qt has created a
- MouseButtonDblClick event from this event. The flag is set in the causing
- MouseButtonPress, and not in the resulting MouseButtonDblCLick.
+ \l {QEvent::MouseButtonDblClick}{MouseButtonDblClick} event from this event. The flag is set in the causing
+ \l {QEvent::MouseButtonPress}{MouseButtonPress}, and not in the resulting \l {QEvent::MouseButtonDblClick}{MouseButtonDblClick}.
\omitvalue MouseEventFlagMask
*/
diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h
index 26ac56396b..55cb31c62b 100644
--- a/src/corelib/global/qprocessordetection.h
+++ b/src/corelib/global/qprocessordetection.h
@@ -87,9 +87,9 @@
ARM is bi-endian, detect using __ARMEL__ or __ARMEB__, falling back to
auto-detection implemented below.
*/
-#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(__arm64__)
+#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(__aarch64__)
# define Q_PROCESSOR_ARM
-# if defined(__arm64__)
+# if defined(__aarch64__)
# define Q_PROCESSOR_ARM_64
# else
# define Q_PROCESSOR_ARM_32