Remove workarounds for RVCT compiler bugs

This does not try to remove support for RVCT. There has been no report
of it working or failing to work, so the status continues to be unknown.
In particular, the inline assembly code in atomic_armv[56].h remains in
place.

This commit only removes workarounds for compiler bugs or bogus
warnings, assuming that anyone using this compiler has updated since Qt
last tried to use it for Symbian in 2011. Note also how anonymous unions
are now part of the language in C++11.

Change-Id: Idc4fab092beb31239eb08b7e139bce2602adae81
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
Thiago Macieira 2014-12-17 18:10:19 -08:00
parent ccef8261d4
commit dd8b75d8fb
10 changed files with 5 additions and 153 deletions

View File

@ -624,14 +624,7 @@ Q_CORE_EXPORT bool qSharedBuild() Q_DECL_NOTHROW;
/* /*
Avoid "unused parameter" warnings Avoid "unused parameter" warnings
*/ */
#define Q_UNUSED(x) (void)x;
#if defined(Q_CC_RVCT)
template <typename T>
inline void qUnused(T &x) { (void)x; }
# define Q_UNUSED(x) qUnused(x);
#else
# define Q_UNUSED(x) (void)x;
#endif
/* /*
Debugging and error handling Debugging and error handling
@ -865,7 +858,7 @@ QT_WARNING_DISABLE_MSVC(4530) /* C++ exception handler used, but unwind semantic
# endif # endif
#endif #endif
#if defined(Q_COMPILER_DECLTYPE) || (defined(Q_CC_GNU) && !defined(Q_CC_RVCT)) #if defined(Q_COMPILER_DECLTYPE) || defined(Q_CC_GNU)
/* make use of decltype or GCC's __typeof__ extension */ /* make use of decltype or GCC's __typeof__ extension */
template <typename T> template <typename T>
class QForeachContainer { class QForeachContainer {

View File

@ -733,12 +733,6 @@ qint64 QIODevice::bytesToWrite() const
return qint64(0); return qint64(0);
} }
#ifdef Q_CC_RVCT
// arm mode makes the 64-bit integer operations much faster in RVCT 2.2
#pragma push
#pragma arm
#endif
/*! /*!
Reads at most \a maxSize bytes from the device into \a data, and Reads at most \a maxSize bytes from the device into \a data, and
returns the number of bytes read. If an error occurs, such as when returns the number of bytes read. If an error occurs, such as when
@ -902,10 +896,6 @@ qint64 QIODevice::read(char *data, qint64 maxSize)
return readSoFar; return readSoFar;
} }
#ifdef Q_CC_RVCT
#pragma pop
#endif
/*! /*!
\overload \overload
@ -1018,12 +1008,6 @@ QByteArray QIODevice::readAll()
return result; return result;
} }
#ifdef Q_CC_RVCT
// arm mode makes the 64-bit integer operations much faster in RVCT 2.2
#pragma push
#pragma arm
#endif
/*! /*!
This function reads a line of ASCII characters from the device, up This function reads a line of ASCII characters from the device, up
to a maximum of \a maxSize - 1 bytes, stores the characters in \a to a maximum of \a maxSize - 1 bytes, stores the characters in \a
@ -1243,10 +1227,6 @@ qint64 QIODevice::readLineData(char *data, qint64 maxSize)
return readSoFar; return readSoFar;
} }
#ifdef Q_CC_RVCT
#pragma pop
#endif
/*! /*!
Returns \c true if a complete line of data can be read from the device; Returns \c true if a complete line of data can be read from the device;
otherwise returns \c false. otherwise returns \c false.

View File

@ -57,14 +57,8 @@
# include "QtCore/qfunctions_winrt.h" # include "QtCore/qfunctions_winrt.h"
#endif #endif
#ifdef Q_CC_RVCT #define Q_STATIC_GLOBAL_OPERATOR static
// rvct doesn't see static operators when using our qalgorithms #define Q_STATIC_GLOBAL_INLINE_OPERATOR static inline
# define Q_STATIC_GLOBAL_OPERATOR inline
# define Q_STATIC_GLOBAL_INLINE_OPERATOR inline
#else
# define Q_STATIC_GLOBAL_OPERATOR static
# define Q_STATIC_GLOBAL_INLINE_OPERATOR static inline
#endif
#endif #endif

View File

@ -66,11 +66,6 @@ public:
private: private:
QByteArrayMatcherPrivate *d; QByteArrayMatcherPrivate *d;
QByteArray q_pattern; QByteArray q_pattern;
#ifdef Q_CC_RVCT
// explicitly allow anonymous unions for RVCT to prevent compiler warnings
# pragma push
# pragma anon_unions
#endif
struct Data { struct Data {
uchar q_skiptable[256]; uchar q_skiptable[256];
const uchar *p; const uchar *p;
@ -80,9 +75,6 @@ private:
uint dummy[256]; uint dummy[256];
Data p; Data p;
}; };
#ifdef Q_CC_RVCT
# pragma pop
#endif
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -977,29 +977,11 @@ public:
inline QMultiHash operator+(const QMultiHash &other) const inline QMultiHash operator+(const QMultiHash &other) const
{ QMultiHash result = *this; result += other; return result; } { QMultiHash result = *this; result += other; return result; }
#if !defined(Q_CC_RVCT)
// RVCT compiler doesn't handle using-keyword right when used functions are overloaded in child class
using QHash<Key, T>::contains; using QHash<Key, T>::contains;
using QHash<Key, T>::remove; using QHash<Key, T>::remove;
using QHash<Key, T>::count; using QHash<Key, T>::count;
using QHash<Key, T>::find; using QHash<Key, T>::find;
using QHash<Key, T>::constFind; using QHash<Key, T>::constFind;
#else
inline bool contains(const Key &key) const
{ return QHash<Key, T>::contains(key); }
inline int remove(const Key &key)
{ return QHash<Key, T>::remove(key); }
inline int count(const Key &key) const
{ return QHash<Key, T>::count(key); }
inline int count() const
{ return QHash<Key, T>::count(); }
inline typename QHash<Key, T>::iterator find(const Key &key)
{ return QHash<Key, T>::find(key); }
inline typename QHash<Key, T>::const_iterator find(const Key &key) const
{ return QHash<Key, T>::find(key); }
inline typename QHash<Key, T>::const_iterator constFind(const Key &key) const
{ return QHash<Key, T>::constFind(key); }
#endif
bool contains(const Key &key, const T &value) const; bool contains(const Key &key, const T &value) const;

View File

@ -1157,29 +1157,11 @@ public:
inline QMultiMap operator+(const QMultiMap &other) const inline QMultiMap operator+(const QMultiMap &other) const
{ QMultiMap result = *this; result += other; return result; } { QMultiMap result = *this; result += other; return result; }
#if !defined(Q_CC_RVCT)
// RVCT compiler doesn't handle using-keyword right when used functions are overloaded in child class
using QMap<Key, T>::contains; using QMap<Key, T>::contains;
using QMap<Key, T>::remove; using QMap<Key, T>::remove;
using QMap<Key, T>::count; using QMap<Key, T>::count;
using QMap<Key, T>::find; using QMap<Key, T>::find;
using QMap<Key, T>::constFind; using QMap<Key, T>::constFind;
#else
inline bool contains(const Key &key) const
{ return QMap<Key, T>::contains(key); }
inline int remove(const Key &key)
{ return QMap<Key, T>::remove(key); }
inline int count(const Key &key) const
{ return QMap<Key, T>::count(key); }
inline int count() const
{ return QMap<Key, T>::count(); }
inline typename QMap<Key, T>::iterator find(const Key &key)
{ return QMap<Key, T>::find(key); }
inline typename QMap<Key, T>::const_iterator find(const Key &key) const
{ return QMap<Key, T>::find(key); }
inline typename QMap<Key, T>::const_iterator constFind(const Key &key) const
{ return QMap<Key, T>::constFind(key); }
#endif
bool contains(const Key &key, const T &value) const; bool contains(const Key &key, const T &value) const;

View File

@ -66,11 +66,6 @@ private:
QStringMatcherPrivate *d_ptr; QStringMatcherPrivate *d_ptr;
QString q_pattern; QString q_pattern;
Qt::CaseSensitivity q_cs; Qt::CaseSensitivity q_cs;
#ifdef Q_CC_RVCT
// explicitly allow anonymous unions for RVCT to prevent compiler warnings
# pragma push
# pragma anon_unions
#endif
struct Data { struct Data {
uchar q_skiptable[256]; uchar q_skiptable[256];
const QChar *uc; const QChar *uc;
@ -80,9 +75,6 @@ private:
uint q_data[256]; uint q_data[256];
Data p; Data p;
}; };
#ifdef Q_CC_RVCT
# pragma pop
#endif
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -2648,32 +2648,10 @@ static const uint * QT_FASTCALL qt_fetch_conical_gradient(uint *buffer, const Op
return b; return b;
} }
#if defined(Q_CC_RVCT)
// Force ARM code generation for comp_func_* -methods
# pragma push
# pragma arm
# if defined(Q_PROCESSOR_ARM_V6)
static __forceinline void preload(const uint *start)
{
asm( "pld [start]" );
}
static const uint L2CacheLineLength = 32;
static const uint L2CacheLineLengthInInts = L2CacheLineLength/sizeof(uint);
# define PRELOAD_INIT(x) preload(x);
# define PRELOAD_INIT2(x,y) PRELOAD_INIT(x) PRELOAD_INIT(y)
# define PRELOAD_COND(x) if (((uint)&x[i])%L2CacheLineLength == 0) preload(&x[i] + L2CacheLineLengthInInts);
// Two consecutive preloads stall, so space them out a bit by using different modulus.
# define PRELOAD_COND2(x,y) if (((uint)&x[i])%L2CacheLineLength == 0) preload(&x[i] + L2CacheLineLengthInInts); \
if (((uint)&y[i])%L2CacheLineLength == 16) preload(&y[i] + L2CacheLineLengthInInts);
# endif // Q_PROCESSOR_ARM_V6
#endif // Q_CC_RVCT
#if !defined(Q_CC_RVCT) || !defined(Q_PROCESSOR_ARM_V6)
# define PRELOAD_INIT(x) # define PRELOAD_INIT(x)
# define PRELOAD_INIT2(x,y) # define PRELOAD_INIT2(x,y)
# define PRELOAD_COND(x) # define PRELOAD_COND(x)
# define PRELOAD_COND2(x,y) # define PRELOAD_COND2(x,y)
#endif
/* The constant alpha factor describes an alpha factor that gets applied /* The constant alpha factor describes an alpha factor that gets applied
to the result of the composition operation combining it with the destination. to the result of the composition operation combining it with the destination.
@ -3828,11 +3806,7 @@ static inline int soft_light_op(int dst, int src, int da, int sa)
else if (4 * dst <= da) else if (4 * dst <= da)
return (dst * sa * 255 + da * (src2 - sa) * ((((16 * dst_np - 12 * 255) * dst_np + 3 * 65025) * dst_np) / 65025) + temp) / 65025; return (dst * sa * 255 + da * (src2 - sa) * ((((16 * dst_np - 12 * 255) * dst_np + 3 * 65025) * dst_np) / 65025) + temp) / 65025;
else { else {
# ifdef Q_CC_RVCT // needed to avoid compiler crash in RVCT 2.2
return (dst * sa * 255 + da * (src2 - sa) * (qIntSqrtInt(dst_np * 255) - dst_np) + temp) / 65025;
# else
return (dst * sa * 255 + da * (src2 - sa) * (int(qSqrt(qreal(dst_np * 255))) - dst_np) + temp) / 65025; return (dst * sa * 255 + da * (src2 - sa) * (int(qSqrt(qreal(dst_np * 255))) - dst_np) + temp) / 65025;
# endif
} }
} }
@ -4040,11 +4014,6 @@ void QT_FASTCALL comp_func_Exclusion(uint *Q_DECL_RESTRICT dest, const uint *Q_D
comp_func_Exclusion_impl(dest, src, length, QPartialCoverage(const_alpha)); comp_func_Exclusion_impl(dest, src, length, QPartialCoverage(const_alpha));
} }
#if defined(Q_CC_RVCT)
// Restore pragma state from previous #pragma arm
# pragma pop
#endif
void QT_FASTCALL rasterop_solid_SourceOrDestination(uint *dest, void QT_FASTCALL rasterop_solid_SourceOrDestination(uint *dest,
int length, int length,
uint color, uint color,

View File

@ -59,12 +59,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#if defined(Q_CC_RVCT) #if defined(Q_CC_GNU)
// RVCT doesn't like static template functions
# define Q_STATIC_TEMPLATE_FUNCTION
# define Q_ALWAYS_INLINE __forceinline
# define Q_DECL_RESTRICT
#elif defined(Q_CC_GNU)
# define Q_STATIC_TEMPLATE_FUNCTION static # define Q_STATIC_TEMPLATE_FUNCTION static
# define Q_ALWAYS_INLINE inline __attribute__((always_inline)) # define Q_ALWAYS_INLINE inline __attribute__((always_inline))
# define Q_DECL_RESTRICT __restrict__ # define Q_DECL_RESTRICT __restrict__
@ -555,10 +550,6 @@ public:
} }
}; };
#if defined(Q_CC_RVCT)
# pragma push
# pragma arm
#endif
static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) { static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) {
uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8; t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
@ -570,9 +561,6 @@ static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b
x |= t; x |= t;
return x; return x;
} }
#if defined(Q_CC_RVCT)
# pragma pop
#endif
#if QT_POINTER_SIZE == 8 // 64-bit versions #if QT_POINTER_SIZE == 8 // 64-bit versions
@ -604,10 +592,6 @@ static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b
return x; return x;
} }
#if defined(Q_CC_RVCT)
# pragma push
# pragma arm
#endif
static Q_ALWAYS_INLINE uint BYTE_MUL(uint x, uint a) { static Q_ALWAYS_INLINE uint BYTE_MUL(uint x, uint a) {
uint t = (x & 0xff00ff) * a; uint t = (x & 0xff00ff) * a;
t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8; t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
@ -619,10 +603,6 @@ static Q_ALWAYS_INLINE uint BYTE_MUL(uint x, uint a) {
x |= t; x |= t;
return x; return x;
} }
#if defined(Q_CC_RVCT)
# pragma pop
#endif
#endif #endif
@ -664,14 +644,7 @@ static Q_ALWAYS_INLINE uint BYTE_MUL_RGB16_32(uint x, uint a) {
return t; return t;
} }
#if defined(Q_CC_RVCT)
# pragma push
# pragma arm
#endif
static Q_ALWAYS_INLINE int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; } static Q_ALWAYS_INLINE int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; }
#if defined(Q_CC_RVCT)
# pragma pop
#endif
static Q_ALWAYS_INLINE uint BYTE_MUL_RGB30(uint x, uint a) { static Q_ALWAYS_INLINE uint BYTE_MUL_RGB30(uint x, uint a) {
uint xa = x >> 30; uint xa = x >> 30;

View File

@ -615,13 +615,8 @@ QDebug operator<<(QDebug debug, const QNetworkInterface &networkInterface)
<< ", hardware address = " << networkInterface.hardwareAddress() << ", hardware address = " << networkInterface.hardwareAddress()
<< ", flags = "; << ", flags = ";
flagsDebug(debug, networkInterface.flags()); flagsDebug(debug, networkInterface.flags());
#if defined(Q_CC_RVCT)
// RVCT gets confused with << networkInterface.addressEntries(), reason unknown.
debug.nospace() << ")\n";
#else
debug.nospace() << ", entries = " << networkInterface.addressEntries() debug.nospace() << ", entries = " << networkInterface.addressEntries()
<< ")\n"; << ")\n";
#endif
return debug.space(); return debug.space();
} }
#endif #endif