summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-01-26 00:37:14 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2017-01-26 00:37:14 +0000
commit398a7e736cb42ac42f0887989585b1121b7e6e62 (patch)
tree916854b706b9b057fa1483f76dd48998a8aa28a0 /src/corelib/global
parent4d3a35f63788fa5ff7a11a5bb7bd6176bd2ac70e (diff)
parent318b58562ae89453fb98e8145cd0440e14ba60b0 (diff)
Merge "Merge remote-tracking branch 'origin/5.8' into dev" into refs/staging/dev
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qcompilerdetection.h17
-rw-r--r--src/corelib/global/qconfig-bootstrapped.h9
-rw-r--r--src/corelib/global/qglobal.cpp7
-rw-r--r--src/corelib/global/qglobal.h2
-rw-r--r--src/corelib/global/qlibraryinfo.cpp130
-rw-r--r--src/corelib/global/qlibraryinfo.h2
-rw-r--r--src/corelib/global/qnamespace.qdoc7
7 files changed, 58 insertions, 116 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 723611e1d8..a9922bb31d 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -996,11 +996,20 @@
#ifdef __cplusplus
# include <utility>
# if defined(Q_OS_QNX)
-// QNX: test if we are using libcpp (Dinkumware-based).
-// Older versions (QNX 650) do not support C++11 features
+// By default, QNX 7.0 uses libc++ (from LLVM) and
+// QNX 6.X uses Dinkumware's libcpp. In all versions,
+// it is also possible to use GNU libstdc++.
+
+// For Dinkumware, some features must be disabled
+// (mostly because of library problems).
+// Dinkumware is assumed when __GLIBCXX__ (GNU libstdc++)
+// and _LIBCPP_VERSION (LLVM libc++) are both absent.
+# if !defined(__GLIBCXX__) && !defined(_LIBCPP_VERSION)
+
+// Older versions of libcpp (QNX 650) do not support C++11 features
// _HAS_* macros are set to 1 by toolchains that actually include
// Dinkum C++11 libcpp.
-# if !defined(__GLIBCXX__)
+
# if !defined(_HAS_CPP0X) || !_HAS_CPP0X
// Disable C++11 features that depend on library support
# undef Q_COMPILER_INITIALIZER_LISTS
@@ -1017,7 +1026,7 @@
// Disable constexpr support on QNX even if the compiler supports it
# undef Q_COMPILER_CONSTEXPR
# endif // !_HAS_CONSTEXPR
-# endif // !__GLIBCXX__
+# endif // !__GLIBCXX__ && !_LIBCPP_VERSION
# endif // Q_OS_QNX
# if (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) && defined(__GNUC_LIBSTD__) \
&& ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402)
diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h
index d0e45478cc..d7849d4699 100644
--- a/src/corelib/global/qconfig-bootstrapped.h
+++ b/src/corelib/global/qconfig-bootstrapped.h
@@ -83,11 +83,14 @@
#define QT_NO_TRANSLATION
#define QT_FEATURE_translation -1
#define QT_NO_GEOM_VARIANT
+#define QT_FEATURE_sharedmemory -1
+#define QT_FEATURE_systemsemaphore -1
-#if defined(QT_BUILD_QMAKE) || defined(QT_BUILD_CONFIGURE)
+#ifdef QT_BUILD_QMAKE
#define QT_FEATURE_commandlineparser -1
#define QT_NO_COMPRESS
#define QT_JSON_READONLY
+#define QT_NO_STANDARDPATHS
#define QT_NO_TEXTCODEC
#define QT_FEATURE_textcodec -1
#else
@@ -97,8 +100,4 @@
#define QT_FEATURE_textcodec 1
#endif
-#if defined(QT_BUILD_QMAKE)
-#define QT_NO_STANDARDPATHS
-#endif
-
#endif // QT_BOOTSTRAPPED
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index b34e8ec659..010f2c18c4 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1516,6 +1516,13 @@ bool qSharedBuild() Q_DECL_NOTHROW
*/
/*!
+ \macro Q_CC_CLANG
+ \relates <QtGlobal>
+
+ Defined if the application is compiled using Clang.
+*/
+
+/*!
\macro Q_CC_BOR
\relates <QtGlobal>
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index a020be7fb2..e6d4848491 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -83,7 +83,7 @@
1: The feature is available
*/
#define QT_CONFIG(feature) (1/QT_FEATURE_##feature == 1)
-#define QT_REQUIRE_CONFIG(feature) Q_STATIC_ASSERT_X(QT_FEATURE_##feature == 1, "Required feature " #feature " for file " __FILE__ " not vailable.")
+#define QT_REQUIRE_CONFIG(feature) Q_STATIC_ASSERT_X(QT_FEATURE_##feature == 1, "Required feature " #feature " for file " __FILE__ " not available.")
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
# define QT_NO_UNSHARABLE_CONTAINERS
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 87ee75fa45..0de8b50900 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -41,18 +41,15 @@
#include "qdir.h"
#include "qstringlist.h"
#include "qfile.h"
-#include "qtemporaryfile.h"
#include "qsettings.h"
#include "qlibraryinfo.h"
#include "qscopedpointer.h"
#ifdef QT_BUILD_QMAKE
QT_BEGIN_NAMESPACE
-extern QString qmake_absoluteLocation();
extern QString qmake_libraryInfoFile();
QT_END_NAMESPACE
#else
-# include "qconfig.cpp"
# include "qcoreapplication.h"
#endif
@@ -60,6 +57,10 @@ QT_END_NAMESPACE
# include "private/qcore_mac_p.h"
#endif
+#ifndef QT_BUILD_QMAKE_BOOTSTRAP
+# include "qconfig.cpp"
+#endif
+
#include "archdetect.cpp"
QT_BEGIN_NAMESPACE
@@ -72,16 +73,9 @@ struct QLibrarySettings
{
QLibrarySettings();
void load();
-#ifdef QT_BUILD_QMAKE
- void loadBuiltinValues(QSettings *config);
-#endif
QScopedPointer<QSettings> settings;
#ifdef QT_BUILD_QMAKE
- QString builtinValues[QLibraryInfo::LastHostPath + 1];
-# ifndef Q_OS_WIN
- QString builtinSettingsPath;
-# endif
bool haveDevicePaths;
bool haveEffectiveSourcePaths;
bool haveEffectivePaths;
@@ -113,25 +107,6 @@ public:
? ls->haveDevicePaths
: ls->havePaths) : false;
}
- static bool sysrootify()
- {
- // This is actually bogus, as it does not consider post-configure settings.
- QLibrarySettings *ls = qt_library_settings();
- return ls ? (!ls->builtinValues[QLibraryInfo::SysrootPath].isEmpty()
- && ls->builtinValues[QLibraryInfo::ExtPrefixPath].isEmpty()) : false;
- }
- static QString builtinValue(int loc)
- {
- QLibrarySettings *ls = qt_library_settings();
- return ls ? ls->builtinValues[loc] : QString();
- }
-# ifndef Q_OS_WIN
- static QString builtinSettingsPath()
- {
- QLibrarySettings *ls = qt_library_settings();
- return ls ? ls->builtinSettingsPath : QString();
- }
-# endif
#endif
static QSettings *configuration()
{
@@ -155,20 +130,6 @@ QLibrarySettings::QLibrarySettings()
load();
}
-#ifdef QT_BUILD_QMAKE
-static QByteArray qtconfSeparator()
-{
-# ifdef Q_OS_WIN
- QByteArray header = QByteArrayLiteral("\r\n===========================================================\r\n");
-# else
- QByteArray header = QByteArrayLiteral("\n===========================================================\n");
-# endif
- QByteArray content = QByteArrayLiteral("==================== qt.conf beginning ====================");
- // Assemble from pieces to avoid that the string appears in a raw executable
- return header + content + header;
-}
-#endif
-
void QLibrarySettings::load()
{
// If we get any settings here, those won't change when the application shows up.
@@ -206,27 +167,6 @@ void QLibrarySettings::load()
havePaths = false;
#endif
}
-
-#ifdef QT_BUILD_QMAKE
- // Try to use an embedded qt.conf appended to the QMake executable.
- QFile qmakeFile(qmake_absoluteLocation());
- if (!qmakeFile.open(QIODevice::ReadOnly))
- return;
- qmakeFile.seek(qmakeFile.size() - 10000);
- QByteArray tail = qmakeFile.read(10000);
- QByteArray separator = qtconfSeparator();
- int qtconfOffset = tail.lastIndexOf(separator);
- if (qtconfOffset < 0)
- return;
- tail.remove(0, qtconfOffset + separator.size());
- // If QSettings had a c'tor taking a QIODevice, we'd pass a QBuffer ...
- QTemporaryFile tmpFile;
- tmpFile.open();
- tmpFile.write(tail);
- tmpFile.close();
- QSettings builtinSettings(tmpFile.fileName(), QSettings::IniFormat);
- loadBuiltinValues(&builtinSettings);
-#endif
}
QSettings *QLibraryInfoPrivate::findConfiguration()
@@ -483,29 +423,17 @@ static const struct {
{ "Tests", "tests" },
#ifdef QT_BUILD_QMAKE
{ "Sysroot", "" },
+ { "SysrootifyPrefix", "" },
{ "HostBinaries", "bin" },
{ "HostLibraries", "lib" },
{ "HostData", "." },
{ "TargetSpec", "" },
{ "HostSpec", "" },
- { "ExtPrefix", "" },
{ "HostPrefix", "" },
#endif
};
#ifdef QT_BUILD_QMAKE
-void QLibrarySettings::loadBuiltinValues(QSettings *config)
-{
- config->beginGroup(QLatin1String("Paths"));
- for (int i = 0; i <= QLibraryInfo::LastHostPath; i++)
- builtinValues[i] = config->value(QLatin1String(qtConfEntries[i].key),
- QLatin1String(qtConfEntries[i].value)).toString();
-# ifndef Q_OS_WIN
- builtinSettingsPath = config->value(QLatin1String("Settings")).toString();
-# endif
- config->endGroup();
-}
-
void QLibraryInfo::reload()
{
QLibraryInfoPrivate::reload();
@@ -522,13 +450,17 @@ QLibraryInfo::location(LibraryLocation loc)
QString ret = rawLocation(loc, FinalPaths);
// Automatically prepend the sysroot to target paths
- if ((loc < SysrootPath || loc > LastHostPath) && QLibraryInfoPrivate::sysrootify()) {
+ if (loc < SysrootPath || loc > LastHostPath) {
QString sysroot = rawLocation(SysrootPath, FinalPaths);
- if (!sysroot.isEmpty() && ret.length() > 2 && ret.at(1) == QLatin1Char(':')
- && (ret.at(2) == QLatin1Char('/') || ret.at(2) == QLatin1Char('\\')))
- ret.replace(0, 2, sysroot); // Strip out the drive on Windows targets
- else
- ret.prepend(sysroot);
+ if (!sysroot.isEmpty()
+ && QVariant::fromValue(rawLocation(SysrootifyPrefixPath, FinalPaths)).toBool()) {
+ if (ret.length() > 2 && ret.at(1) == QLatin1Char(':')
+ && (ret.at(2) == QLatin1Char('/') || ret.at(2) == QLatin1Char('\\'))) {
+ ret.replace(0, 2, sysroot); // Strip out the drive on Windows targets
+ } else {
+ ret.prepend(sysroot);
+ }
+ }
}
return ret;
@@ -591,7 +523,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
if (loc == HostPrefixPath)
ret = config->value(QLatin1String(qtConfEntries[PrefixPath].key),
QLatin1String(qtConfEntries[PrefixPath].value)).toString();
- else if (loc == TargetSpecPath || loc == HostSpecPath)
+ else if (loc == TargetSpecPath || loc == HostSpecPath || loc == SysrootifyPrefixPath)
fromConf = false;
// The last case here is SysrootPath, which can be legitimately empty.
// All other keys have non-empty fallbacks to start with.
@@ -615,38 +547,36 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
}
#endif // QT_NO_SETTINGS
+#ifndef QT_BUILD_QMAKE_BOOTSTRAP
if (!fromConf) {
-#ifdef QT_BUILD_QMAKE
- if ((unsigned)loc <= (unsigned)LastHostPath) {
- if (loc == PrefixPath && group != DevicePaths)
- ret = QLibraryInfoPrivate::builtinValue(ExtPrefixPath);
- else
- ret = QLibraryInfoPrivate::builtinValue(loc);
-# ifndef Q_OS_WIN // On Windows we use the registry
- } else if (loc == SettingsPath) {
- ret = QLibraryInfoPrivate::builtinSettingsPath();
-# endif
- }
-#else // QT_BUILD_QMAKE
const char * volatile path = 0;
if (loc == PrefixPath) {
- path = QT_CONFIGURE_PREFIX_PATH;
+ path =
+# ifdef QT_BUILD_QMAKE
+ (group != DevicePaths) ?
+ QT_CONFIGURE_EXT_PREFIX_PATH :
+# endif
+ QT_CONFIGURE_PREFIX_PATH;
} else if (unsigned(loc) <= sizeof(qt_configure_str_offsets)/sizeof(qt_configure_str_offsets[0])) {
path = qt_configure_strs + qt_configure_str_offsets[loc - 1];
#ifndef Q_OS_WIN // On Windows we use the registry
} else if (loc == SettingsPath) {
path = QT_CONFIGURE_SETTINGS_PATH;
#endif
+# ifdef QT_BUILD_QMAKE
+ } else if (loc == HostPrefixPath) {
+ path = QT_CONFIGURE_HOST_PREFIX_PATH;
+# endif
}
if (path)
ret = QString::fromLocal8Bit(path);
-#endif
}
+#endif
#ifdef QT_BUILD_QMAKE
- // The specs need to be returned verbatim.
- if (loc == TargetSpecPath || loc == HostSpecPath)
+ // These values aren't actually paths and thus need to be returned verbatim.
+ if (loc == TargetSpecPath || loc == HostSpecPath || loc == SysrootifyPrefixPath)
return ret;
#endif
diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
index 9d794ce1da..809813d99d 100644
--- a/src/corelib/global/qlibraryinfo.h
+++ b/src/corelib/global/qlibraryinfo.h
@@ -91,12 +91,12 @@ public:
#ifdef QT_BUILD_QMAKE
// These are not subject to binary compatibility constraints
SysrootPath,
+ SysrootifyPrefixPath,
HostBinariesPath,
HostLibrariesPath,
HostDataPath,
TargetSpecPath,
HostSpecPath,
- ExtPrefixPath,
HostPrefixPath,
LastHostPath = HostPrefixPath,
#endif
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index dfecc3e2d3..af485a1832 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -123,16 +123,14 @@
\value AA_PluginApplication Indicates that Qt is used to author a plugin. Depending
on the operating system, it suppresses specific initializations that do not
necessarily make sense in the plugin case.
-
For example on OS X, this includes avoiding loading our nib for the main
menu and not taking possession of the native menu bar. Setting this
attribute to true will also set the AA_DontUseNativeMenuBar attribute
to true. It also disables native event filters.
-
This attribute has been added in Qt 5.7. It must be set before
\l {QGuiApplication}{Q(Gui)Application} is constructed.
- \value AA_MacPluginApplication This attribute has been deprecated.
+ \value AA_MacPluginApplication This attribute has been deprecated.
Use AA_PluginApplication instead.
\value AA_DontUseNativeMenuBar All menubars created while this attribute is
@@ -166,7 +164,6 @@
\value AA_UseHighDpiPixmaps Make QIcon::pixmap() generate high-dpi pixmaps
that can be larger than the requested size. Such pixmaps will have
\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.
@@ -2660,7 +2657,7 @@
\value FontRole The font used for items rendered with the default
delegate. (QFont)
\value TextAlignmentRole The alignment of the text for items rendered with the
- default delegate. (Qt::AlignmentFlag)
+ default delegate. (Qt::Alignment)
\value BackgroundRole The background brush used for items rendered with
the default delegate. (QBrush)
\value BackgroundColorRole This role is obsolete. Use BackgroundRole instead.