summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2016-11-18 13:32:19 +0100
committerLars Knoll <lars.knoll@qt.io>2016-11-29 19:04:37 +0000
commite3555fe9705a44072a05b95cca36579745e14125 (patch)
tree1685f95a262415e2f458fb0e75fcc255835a48af
parent0c8f3229de8ec4a8e70d4b41672074b94a45b1fe (diff)
Properly use QT_CONFIG macro to check for ICU
And remove the QT_USE_ICU define. Change-Id: I8134ee18af7c90ed7070926ca31b3a57b3ec37dd Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
-rw-r--r--src/corelib/codecs/qtextcodec.cpp18
-rw-r--r--src/corelib/global/qconfig-bootstrapped.h1
-rw-r--r--src/corelib/tools/qcollator_p.h6
-rw-r--r--src/corelib/tools/qlocale.cpp4
-rw-r--r--src/corelib/tools/qlocale_p.h2
-rw-r--r--src/corelib/tools/qstring.cpp4
-rw-r--r--src/corelib/tools/qtimezone.cpp12
-rw-r--r--src/corelib/tools/qtimezoneprivate.cpp2
-rw-r--r--src/corelib/tools/qtimezoneprivate_p.h12
-rw-r--r--src/corelib/tools/qtimezoneprivate_tz.cpp20
-rw-r--r--src/corelib/tools/tools.pri1
11 files changed, 41 insertions, 41 deletions
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 0c9036aadf..aed3532024 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -58,7 +58,7 @@
#if !defined(QT_BOOTSTRAPPED)
# include "qtsciicodec_p.h"
# include "qisciicodec_p.h"
-#if defined(QT_USE_ICU)
+#if QT_CONFIG(icu)
#include "qicucodec_p.h"
#else
#if QT_CONFIG(iconv)
@@ -79,7 +79,7 @@
# endif // !Q_OS_INTEGRITY
#endif // !QT_NO_BIG_CODECS
-#endif // QT_USE_ICU
+#endif // icu
#endif // QT_BOOTSTRAPPED
#include "qmutex.h"
@@ -99,7 +99,7 @@ typedef QList<QByteArray>::ConstIterator ByteArrayListConstIt;
Q_GLOBAL_STATIC_WITH_ARGS(QMutex, textCodecsMutex, (QMutex::Recursive));
QMutex *qTextCodecsMutex() { return textCodecsMutex(); }
-#if !defined(QT_USE_ICU)
+#if !QT_CONFIG(icu)
static char qtolower(char c)
{ if (c >= 'A' && c <= 'Z') return c + 0x20; return c; }
static bool qisalnum(char c)
@@ -306,7 +306,7 @@ static void setup()
}
#else
static void setup() {}
-#endif // QT_USE_ICU
+#endif // icu
/*!
\enum QTextCodec::ConversionFlag
@@ -519,7 +519,7 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name)
return 0;
setup();
-#ifndef QT_USE_ICU
+#if !QT_CONFIG(icu)
QTextCodecCache *cache = &globalData->codecCache;
QTextCodec *codec;
if (cache) {
@@ -586,7 +586,7 @@ QTextCodec* QTextCodec::codecForMib(int mib)
}
}
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
return QIcuCodec::codecForMibUnlocked(mib);
#else
return 0;
@@ -618,7 +618,7 @@ QList<QByteArray> QTextCodec::availableCodecs()
codecs += (*it)->aliases();
}
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
codecs += QIcuCodec::availableCodecs();
#endif
@@ -634,7 +634,7 @@ QList<QByteArray> QTextCodec::availableCodecs()
*/
QList<int> QTextCodec::availableMibs()
{
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
return QIcuCodec::availableMibs();
#else
QMutexLocker locker(textCodecsMutex());
@@ -688,7 +688,7 @@ QTextCodec* QTextCodec::codecForLocale()
QTextCodec *codec = globalData->codecForLocale.loadAcquire();
if (!codec) {
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
textCodecsMutex()->lock();
codec = QIcuCodec::defaultCodecUnlocked();
textCodecsMutex()->unlock();
diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h
index 0cbd52c205..d0e45478cc 100644
--- a/src/corelib/global/qconfig-bootstrapped.h
+++ b/src/corelib/global/qconfig-bootstrapped.h
@@ -69,6 +69,7 @@
#define QT_CRYPTOGRAPHICHASH_ONLY_SHA1
#define QT_NO_DATASTREAM
#define QT_FEATURE_iconv -1
+#define QT_FEATURE_icu -1
#define QT_FEATURE_journald -1
#define QT_NO_LIBRARY
#define QT_FEATURE_library -1
diff --git a/src/corelib/tools/qcollator_p.h b/src/corelib/tools/qcollator_p.h
index fbbce00676..423ba0325a 100644
--- a/src/corelib/tools/qcollator_p.h
+++ b/src/corelib/tools/qcollator_p.h
@@ -55,7 +55,7 @@
#include <QtCore/private/qglobal_p.h>
#include "qcollator.h"
#include <QVector>
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
#include <unicode/ucol.h>
#elif defined(Q_OS_OSX)
#include <CoreServices/CoreServices.h>
@@ -65,7 +65,7 @@
QT_BEGIN_NAMESPACE
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
typedef UCollator *CollatorType;
typedef QByteArray CollatorKeyType;
@@ -90,7 +90,7 @@ class Q_CORE_EXPORT QCollatorPrivate
public:
QAtomicInt ref;
QLocale locale;
-#if defined(Q_OS_WIN) && !defined(QT_USE_ICU)
+#if defined(Q_OS_WIN) && !QT_CONFIG(icu)
#ifdef USE_COMPARESTRINGEX
QString localeName;
#else
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 847fc2d55e..f499681ca9 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -2431,7 +2431,7 @@ Qt::LayoutDirection QLocale::textDirection() const
*/
QString QLocale::toUpper(const QString &str) const
{
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
bool ok = true;
QString result = QIcu::toUpper(d->bcp47Name('_'), str, &ok);
if (ok)
@@ -2455,7 +2455,7 @@ QString QLocale::toUpper(const QString &str) const
*/
QString QLocale::toLower(const QString &str) const
{
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
bool ok = true;
const QString result = QIcu::toLower(d->bcp47Name('_'), str, &ok);
if (ok)
diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h
index c83c9d3333..20eff8fd64 100644
--- a/src/corelib/tools/qlocale_p.h
+++ b/src/corelib/tools/qlocale_p.h
@@ -134,7 +134,7 @@ Q_DECLARE_TYPEINFO(QSystemLocale::QueryType, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(QSystemLocale::CurrencyToStringArgument, Q_MOVABLE_TYPE);
#endif
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
namespace QIcu {
QString toUpper(const QByteArray &localeId, const QString &str, bool *ok);
QString toLower(const QByteArray &localeId, const QString &str, bool *ok);
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index eef375fe72..8888eced87 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -5575,7 +5575,7 @@ int QString::localeAwareCompare(const QString &other) const
return localeAwareCompare_helper(constData(), length(), other.constData(), other.length());
}
-#if defined(QT_USE_ICU) && !defined(Q_OS_WIN32) && !defined(Q_OS_DARWIN)
+#if QT_CONFIG(icu) && !defined(Q_OS_WIN32) && !defined(Q_OS_DARWIN)
Q_GLOBAL_STATIC(QThreadStorage<QCollator>, defaultCollator)
#endif
@@ -5621,7 +5621,7 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1,
CFRelease(thisString);
CFRelease(otherString);
return result;
-#elif defined(QT_USE_ICU)
+#elif QT_CONFIG(icu)
if (!defaultCollator()->hasLocalData())
defaultCollator()->setLocalData(QCollator());
return defaultCollator()->localData().compare(data1, length1, data2, length2);
diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp
index e423d9af0c..359c2d0bdb 100644
--- a/src/corelib/tools/qtimezone.cpp
+++ b/src/corelib/tools/qtimezone.cpp
@@ -54,11 +54,11 @@ QT_BEGIN_NAMESPACE
static QTimeZonePrivate *newBackendTimeZone()
{
#ifdef QT_NO_SYSTEMLOCALE
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
return new QIcuTimeZonePrivate();
#else
return new QUtcTimeZonePrivate();
-#endif // QT_USE_ICU
+#endif
#else
#if defined Q_OS_MAC
return new QMacTimeZonePrivate();
@@ -69,7 +69,7 @@ static QTimeZonePrivate *newBackendTimeZone()
// Registry based timezone backend not available on WinRT
#elif defined Q_OS_WIN
return new QWinTimeZonePrivate();
-#elif defined QT_USE_ICU
+#elif QT_CONFIG(icu)
return new QIcuTimeZonePrivate();
#else
return new QUtcTimeZonePrivate();
@@ -81,11 +81,11 @@ static QTimeZonePrivate *newBackendTimeZone()
static QTimeZonePrivate *newBackendTimeZone(const QByteArray &ianaId)
{
#ifdef QT_NO_SYSTEMLOCALE
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
return new QIcuTimeZonePrivate(ianaId);
#else
return new QUtcTimeZonePrivate(ianaId);
-#endif // QT_USE_ICU
+#endif
#else
#if defined Q_OS_MAC
return new QMacTimeZonePrivate(ianaId);
@@ -96,7 +96,7 @@ static QTimeZonePrivate *newBackendTimeZone(const QByteArray &ianaId)
// Registry based timezone backend not available on WinRT
#elif defined Q_OS_WIN
return new QWinTimeZonePrivate(ianaId);
-#elif defined QT_USE_ICU
+#elif QT_CONFIG(icu)
return new QIcuTimeZonePrivate(ianaId);
#else
return new QUtcTimeZonePrivate(ianaId);
diff --git a/src/corelib/tools/qtimezoneprivate.cpp b/src/corelib/tools/qtimezoneprivate.cpp
index 56da197542..2ff03eddec 100644
--- a/src/corelib/tools/qtimezoneprivate.cpp
+++ b/src/corelib/tools/qtimezoneprivate.cpp
@@ -590,7 +590,7 @@ template<> QTimeZonePrivate *QSharedDataPointer<QTimeZonePrivate>::clone()
}
/*
- UTC Offset implementation, used when QT_NO_SYSTEMLOCALE set and QT_USE_ICU not set,
+ UTC Offset implementation, used when QT_NO_SYSTEMLOCALE set and ICU is not being used,
or for QDateTimes with a Qt:Spec of Qt::OffsetFromUtc.
*/
diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h
index d7fbb12344..d06784b0f9 100644
--- a/src/corelib/tools/qtimezoneprivate_p.h
+++ b/src/corelib/tools/qtimezoneprivate_p.h
@@ -56,9 +56,9 @@
#include "qlocale_p.h"
#include "qvector.h"
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
#include <unicode/ucal.h>
-#endif // QT_USE_ICU
+#endif
#ifdef Q_OS_MAC
#ifdef __OBJC__
@@ -227,7 +227,7 @@ private:
int m_offsetFromUtc;
};
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
class Q_AUTOTEST_EXPORT QIcuTimeZonePrivate Q_DECL_FINAL : public QTimeZonePrivate
{
public:
@@ -268,7 +268,7 @@ private:
UCalendar *m_ucal;
};
-#endif // QT_USE_ICU
+#endif
#if defined Q_OS_UNIX && !defined Q_OS_MAC && !defined Q_OS_ANDROID
struct QTzTransitionTime
@@ -337,9 +337,9 @@ private:
QVector<QTzTransitionTime> m_tranTimes;
QVector<QTzTransitionRule> m_tranRules;
QList<QByteArray> m_abbreviations;
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
mutable QSharedDataPointer<QTimeZonePrivate> m_icu;
-#endif // QT_USE_ICU
+#endif
QByteArray m_posixRule;
};
#endif // Q_OS_UNIX
diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp
index 96d04df0e2..10b61c3a40 100644
--- a/src/corelib/tools/qtimezoneprivate_tz.cpp
+++ b/src/corelib/tools/qtimezoneprivate_tz.cpp
@@ -598,18 +598,18 @@ static QVector<QTimeZonePrivate::Data> calculatePosixTransitions(const QByteArra
// Create the system default time zone
QTzTimeZonePrivate::QTzTimeZonePrivate()
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
: m_icu(0)
-#endif // QT_USE_ICU
+#endif
{
init(systemTimeZoneId());
}
// Create a named time zone
QTzTimeZonePrivate::QTzTimeZonePrivate(const QByteArray &ianaId)
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
: m_icu(0)
-#endif // QT_USE_ICU
+#endif
{
init(ianaId);
}
@@ -617,9 +617,9 @@ QTzTimeZonePrivate::QTzTimeZonePrivate(const QByteArray &ianaId)
QTzTimeZonePrivate::QTzTimeZonePrivate(const QTzTimeZonePrivate &other)
: QTimeZonePrivate(other), m_tranTimes(other.m_tranTimes),
m_tranRules(other.m_tranRules), m_abbreviations(other.m_abbreviations),
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
m_icu(other.m_icu),
-#endif // QT_USE_ICU
+#endif
m_posixRule(other.m_posixRule)
{
}
@@ -778,7 +778,7 @@ QString QTzTimeZonePrivate::displayName(qint64 atMSecsSinceEpoch,
QTimeZone::NameType nameType,
const QLocale &locale) const
{
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
if (!m_icu)
m_icu = new QIcuTimeZonePrivate(m_id);
// TODO small risk may not match if tran times differ due to outdated files
@@ -788,7 +788,7 @@ QString QTzTimeZonePrivate::displayName(qint64 atMSecsSinceEpoch,
#else
Q_UNUSED(nameType)
Q_UNUSED(locale)
-#endif // QT_USE_ICU
+#endif
return abbreviation(atMSecsSinceEpoch);
}
@@ -796,7 +796,7 @@ QString QTzTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
QTimeZone::NameType nameType,
const QLocale &locale) const
{
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
if (!m_icu)
m_icu = new QIcuTimeZonePrivate(m_id);
// TODO small risk may not match if tran times differ due to outdated files
@@ -807,7 +807,7 @@ QString QTzTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
Q_UNUSED(timeType)
Q_UNUSED(nameType)
Q_UNUSED(locale)
-#endif // QT_USE_ICU
+#endif
// If no ICU available then have to use abbreviations instead
// Abbreviations don't have GenericTime
if (timeType == QTimeZone::GenericTime)
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index fb80bbd6b8..fa8e07abbc 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -144,7 +144,6 @@ qtConfig(icu) {
SOURCES += tools/qlocale_icu.cpp \
tools/qcollator_icu.cpp
- DEFINES += QT_USE_ICU
} else: win32 {
SOURCES += tools/qcollator_win.cpp
} else: macx {