Remove usages of QT_ARCH and QT_ARCH_* from qtbase

The architecture is detected at compile time based on the predefined
macros from the compiler. Don't use QT_ARCH in .pro, .pri, or .prf
files.  The PNG_NO_ASSEMBLER_CODE define from libpng.pri is not present
in the current copy of src/3rdparty/libpng, so no change in
functionality is expected.

The conditional for the SUPPORT_JIT define in pcre.pri is moved to
src/3rdparty/pcre/config.h, again so that we can use the compiler's
predefined macros to detect the architecture at compile time.

Replace QT_ARCH_ARM, QT_ARCH_MIPS, and QT_ARCH_SPARC with their
Q_PROCESSOR_* equivalents.

Replace QT_ARCH_INTEGRITY, QT_ARCH_VXWORKS, and QT_ARCH_WINDOWSCE with
their Q_OS_* equivalents.

Note that this commit also effectively disables the SPARC atomic
implementation. An inline implementation for SPARC needs to be added,
or we remove the current code and instead rely on the GCC intrinsic or
C++11 std::atomic support on SPARC.

Note also that this commit does not remove QT_ARCH from configure or
qconfig.h. This will continue to be set until all Qt 5 projects can be
moved away from using QT_ARCH.

Change-Id: I5de747cc4436d21941329974cff3016970f497b8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
Bradley T. Hughes 2012-02-10 15:50:47 +01:00 committed by Qt by Nokia
parent e7b8c92271
commit f0f78eb0a9
20 changed files with 37 additions and 38 deletions

View File

@ -11,8 +11,7 @@ qt_install_headers {
INSTALL_HEADERS = $$SYNCQT.HEADER_FILES
equals(TARGET, QtCore) {
#headers created by configure
INSTALL_HEADERS *= $$QT_BUILD_TREE/src/corelib/global/qconfig.h \
$$QT_SOURCE_TREE/src/corelib/arch/$$QT_ARCH/arch
INSTALL_HEADERS *= $$QT_BUILD_TREE/src/corelib/global/qconfig.h
}
equals(TARGET, phonon) {

View File

@ -17,7 +17,6 @@ INCLUDEPATH *= $$MODULE_PRIVATE_INCLUDES
INCLUDEPATH *= $$MODULE_PRIVATE_INCLUDES/$$TARGET
INCLUDEPATH *= $$MODULE_INCLUDES $$MODULE_INCLUDES/.. #just for today to have some compat
!isEmpty(RCC_DIR): INCLUDEPATH += $$RCC_DIR
isEmpty(QT_ARCH):!isEmpty(ARCH):QT_ARCH=$$ARCH #another compat that will rot for change #215700
TEMPLATE = lib
isEmpty(QT_MAJOR_VERSION) {
VERSION=5.0.0

View File

@ -1,5 +1,4 @@
DEFINES *= QT_USE_BUNDLED_LIBPNG
!isEqual(QT_ARCH, i386):!isEqual(QT_ARCH, x86_64):DEFINES += PNG_NO_ASSEMBLER_CODE
INCLUDEPATH += $$PWD/libpng
SOURCES += $$PWD/libpng/png.c \
$$PWD/libpng/pngerror.c \

View File

@ -1,14 +1,5 @@
DEFINES += PCRE_HAVE_CONFIG_H
# man 3 pcrejit for a list of supported platforms;
# as PCRE 8.30, stable JIT support is available for:
# - ARM v5, v7, and Thumb2
# - x86/x86-64
# - MIPS 32bit
equals(QT_ARCH, "i386")|equals(QT_ARCH, "x86_64")|equals(QT_ARCH, "arm")|if(equals(QT_ARCH, "mips"):!*-64) {
DEFINES += SUPPORT_JIT
}
win32:DEFINES += PCRE_STATIC
INCLUDEPATH += $$PWD/pcre

View File

@ -13,3 +13,20 @@
#define SUPPORT_UCP
#define SUPPORT_UTF16
/*
man 3 pcrejit for a list of supported platforms;
as PCRE 8.30, stable JIT support is available for:
- ARM v5, v7, and Thumb2
- x86/x86-64
- MIPS 32bit
*/
#if \
/* ARM */ \
defined(__arm__) || defined(__TARGET_ARCH_ARM) \
/* x86 32/64 */ \
|| defined(__i386) || defined(__i386__) || defined(_M_IX86) \
|| defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64) \
/* MIPS32 */ \
|| defined(__mips) || defined(__mips__) || defined(_M_MRX000) && !(defined(_MIPS_ARCH_MIPS64) || defined(__mips64))
# define SUPPORT_JIT
#endif

View File

@ -25,9 +25,3 @@ unix {
HEADERS += arch/qatomic_unix.h
SOURCES += arch/qatomic_unix.cpp
}
QT_ARCH_CPP = $$QT_SOURCE_TREE/src/corelib/arch/$$QT_ARCH
exists($$QT_ARCH_CPP) {
DEPENDPATH += $$QT_ARCH_CPP
include($$QT_ARCH_CPP/arch.pri, "", true)
}

View File

@ -2,9 +2,9 @@
# SPARC architecture
#
*-64* {
SOURCES += $$QT_ARCH_CPP/qatomic64.s
SOURCES += $$PWD/qatomic64.s
}
else {
SOURCES += $$QT_ARCH_CPP/qatomic32.s \
$$QT_ARCH_CPP/qatomic_sparc.cpp
SOURCES += $$PWD/qatomic32.s \
$$PWD/qatomic_sparc.cpp
}

View File

@ -463,7 +463,7 @@ typedef int QNoImplicitBoolCast;
// This logic must match the one in qmetatype.h
#if defined(QT_COORD_TYPE)
typedef QT_COORD_TYPE qreal;
#elif defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE)
#elif defined(QT_NO_FPU) || defined(Q_PROCESSOR_ARM) || defined(Q_OS_WINCE)
typedef float qreal;
#else
typedef double qreal;

View File

@ -203,7 +203,7 @@ public:
// This logic must match the one in qglobal.h
#if defined(QT_COORD_TYPE)
QReal = 0,
#elif defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE)
#elif defined(QT_NO_FPU) || defined(Q_PROCESSOR_ARM) || defined(Q_OS_WINCE)
QReal = Float,
#else
QReal = Double,

View File

@ -67,7 +67,7 @@ struct Q_CORE_EXPORT QVectorData
QtPrivate::RefCount ref;
int alloc;
int size;
#if defined(QT_ARCH_SPARC) && defined(Q_CC_GNU) && defined(__LP64__) && defined(QT_BOOTSTRAPPED)
#if defined(Q_PROCESSOR_SPARC) && defined(Q_CC_GNU) && defined(__LP64__) && defined(QT_BOOTSTRAPPED)
// workaround for bug in gcc 3.4.2
uint sharable;
uint capacity;

View File

@ -264,7 +264,7 @@ namespace QTest
template <typename T1, typename T2>
bool qCompare(T1 const &, T2 const &, const char *, const char *, const char *, int);
#if defined(QT_COORD_TYPE) && (defined(QT_ARCH_ARM) || defined(QT_NO_FPU) || defined(QT_ARCH_WINDOWSCE))
#if defined(QT_COORD_TYPE) && (defined(Q_PROCESSOR_ARM) || defined(QT_NO_FPU) || defined(Q_OS_WINCE))
template <>
inline bool qCompare<qreal, float>(qreal const &t1, float const &t2, const char *actual,
const char *expected, const char *file, int line)
@ -279,7 +279,7 @@ namespace QTest
return qCompare<qreal>(qreal(t1), t2, actual, expected, file, line);
}
#elif defined(QT_COORD_TYPE) || defined(QT_ARCH_ARM) || defined(QT_NO_FPU) || defined(QT_ARCH_WINDOWSCE)
#elif defined(QT_COORD_TYPE) || defined(Q_PROCESSOR_ARM) || defined(QT_NO_FPU) || defined(Q_OS_WINCE)
template <>
inline bool qCompare<qreal, double>(qreal const &t1, double const &t2, const char *actual,
const char *expected, const char *file, int line)

View File

@ -14,7 +14,7 @@ HEADERS += uic.h
SOURCES += main.cpp \
uic.cpp
linux-g++-maemo:contains(QT_ARCH, arm) {
linux-g++-maemo {
# UIC will crash when running inside QEMU if built with -O2
QMAKE_CFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE -= -O2

View File

@ -62,7 +62,7 @@ private slots:
static const int iterations = 10;
// Note: some tests rely on ThreadCount being multiple of 2
#if defined(Q_OS_SOLARIS) || ( defined(Q_OS_LINUX) && defined(QT_ARCH_ARMV6) )
#if defined(Q_OS_SOLARIS) || ( defined(Q_OS_LINUX) && defined(Q_PROCESSOR_ARM) )
static const int ThreadCount = 4;
#else
static const int ThreadCount = 10;

View File

@ -1574,7 +1574,7 @@ void tst_QGraphicsProxyWidget::resize_simple_data()
QTest::addColumn<QSizeF>("size");
QTest::newRow("200, 200") << QSizeF(200, 200);
#if !defined(QT_ARCH_ARM) && !defined(Q_OS_WINCE)
#if !defined(Q_PROCESSOR_ARM) && !defined(Q_OS_WINCE)
QTest::newRow("1000, 1000") << QSizeF(1000, 1000);
// Since 4.5, 10000x10000 runs out of memory.
// QTest::newRow("10000, 10000") << QSizeF(10000, 10000);

View File

@ -365,7 +365,7 @@ void tst_QGraphicsScene::itemIndexMethod()
QGraphicsScene scene;
QCOMPARE(scene.itemIndexMethod(), QGraphicsScene::BspTreeIndex);
#ifdef QT_ARCH_ARM
#ifdef Q_PROCESSOR_ARM
const int minY = -500;
const int maxY = 500;
const int minX = -500;
@ -426,7 +426,7 @@ void tst_QGraphicsScene::bspTreeDepth()
void tst_QGraphicsScene::items()
{
#ifdef QT_ARCH_ARM
#ifdef Q_PROCESSOR_ARM
const int minY = -500;
const int maxY = 500;
const int minX = -500;

View File

@ -1656,7 +1656,7 @@ void tst_QGraphicsView::mapToScene()
QCOMPARE(view.size(), viewSize);
// First once without setting the scene rect
#ifdef QT_ARCH_ARM
#ifdef Q_PROCESSOR_ARM
const int step = 20;
#else
const int step = 1;

View File

@ -286,7 +286,7 @@ void tst_QItemView::populate()
{
treeModel = new CheckerModel;
QModelIndex parent;
#if defined(QT_ARCH_ARM)
#if defined(Q_PROCESSOR_ARM)
const int baseInsert = 4;
#else
const int baseInsert = 26;

View File

@ -765,7 +765,7 @@ void tst_QComboBox::virtualAutocompletion()
// We need to set the keyboard input interval to a higher value
// as the processEvent() call takes too much time, so it restarts
// the keyboard search then
#if defined(QT_ARCH_ARM) || defined(QT_ARCH_MIPS)
#if defined(Q_PROCESSOR_ARM) || defined(Q_PROCESSOR_MIPS)
int oldInterval = QApplication::keyboardInputInterval();
QApplication::setKeyboardInputInterval(1500);
#endif
@ -797,7 +797,7 @@ void tst_QComboBox::virtualAutocompletion()
QApplication::sendEvent(testWidget, &kr2);
qApp->processEvents(); // Process events to trigger autocompletion
QTRY_COMPARE(testWidget->currentIndex(), 3);
#if defined(QT_ARCH_ARM) || defined(QT_ARCH_MIPS)
#if defined(Q_PROCESSOR_ARM) || defined(Q_PROCESSOR_MIPS)
QApplication::setKeyboardInputInterval(oldInterval);
#endif
}

View File

@ -219,7 +219,7 @@ void tst_QPlainTextEdit::getSetCheck()
QCOMPARE(0, obj1.tabStopWidth());
obj1.setTabStopWidth(INT_MIN);
QCOMPARE(0, obj1.tabStopWidth()); // Makes no sense to set a negative tabstop value
#if defined(QT_ARCH_WINDOWSCE)
#if defined(Q_OS_WINCE)
// due to rounding error in qRound when qreal==float
// we cannot use INT_MAX for this check
obj1.setTabStopWidth(SHRT_MAX*2);

View File

@ -288,7 +288,7 @@ void tst_QTextEdit::getSetCheck()
QCOMPARE(0, obj1.tabStopWidth());
obj1.setTabStopWidth(INT_MIN);
QCOMPARE(0, obj1.tabStopWidth()); // Makes no sense to set a negative tabstop value
#if defined(QT_ARCH_WINDOWSCE)
#if defined(Q_OS_WINCE)
// due to rounding error in qRound when qreal==float
// we cannot use INT_MAX for this check
obj1.setTabStopWidth(SHRT_MAX*2);