summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure28
-rw-r--r--src/corelib/global/qcompilerdetection.h22
-rw-r--r--src/corelib/global/qglobal.h2
3 files changed, 31 insertions, 21 deletions
diff --git a/configure b/configure
index 295644ce45..e6b92f1610 100755
--- a/configure
+++ b/configure
@@ -6207,28 +6207,16 @@ fi
# Add compiler sub-architecture support
echo "" >>"$outpath/src/corelib/global/qconfig.h.new"
echo "// Compiler sub-arch support" >>"$outpath/src/corelib/global/qconfig.h.new"
-for SUBARCH in X86: SSE2 SSE3 SSSE3 SSE4_1 SSE4_2 AVX AVX2 : \
- ARM: IWMMXT NEON : \
- MIPS: MIPS_DSP MIPS_DSPR2 :
-do
- line=""
- case $SUBARCH in
- :)
- line="#endif"
- ;;
- *:)
- line="#ifdef Q_PROCESSOR_$(echo $SUBARCH | sed 's/:$//')"
- ;;
- *)
- eval "VAL=\$CFG_$SUBARCH"
- case "$VAL" in
- yes)
- line=" #define QT_COMPILER_SUPPORTS_$SUBARCH"
- ;;
- esac
+for SUBARCH in SSE2 SSE3 SSSE3 SSE4_1 SSE4_2 AVX AVX2 \
+ IWMMXT NEON \
+ MIPS_DSP MIPS_DSPR2; do
+ eval "VAL=\$CFG_$SUBARCH"
+ case "$VAL" in
+ yes)
+ echo "#define QT_COMPILER_SUPPORTS_$SUBARCH" \
+ >>"$outpath/src/corelib/global/qconfig.h.new"
;;
esac
- [ -n "$line" ] && echo "$line" >>"$outpath/src/corelib/global/qconfig.h.new"
done
echo "" >>"$outpath/src/corelib/global/qconfig.h.new"
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 9b609f76d0..ada69d081d 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -877,4 +877,26 @@
Q_UNUSED(valueOfExpression); /* the value may not be used if Q_ASSERT_X and Q_ASSUME_IMPL are noop */\
} while (0)
+
+/*
+ Sanitize compiler feature availability
+*/
+#if !defined(Q_PROCESSOR_X86)
+# undef QT_COMPILER_SUPPORTS_SSE2
+# undef QT_COMPILER_SUPPORTS_SSE3
+# undef QT_COMPILER_SUPPORTS_SSSE3
+# undef QT_COMPILER_SUPPORTS_SSE4_1
+# undef QT_COMPILER_SUPPORTS_SSE4_2
+# undef QT_COMPILER_SUPPORTS_AVX
+# undef QT_COMPILER_SUPPORTS_AVX2
+#endif
+#if !defined(Q_PROCESSOR_ARM)
+# undef QT_COMPILER_SUPPORTS_IWMMXT
+# undef QT_COMPILER_SUPPORTS_NEON
+#endif
+#if !defined(Q_PROCESSOR_MIPS)
+# undef QT_COMPILER_SUPPORTS_MIPS_DSP
+# undef QT_COMPILER_SUPPORTS_MIPS_DSPR2
+#endif
+
#endif // QCOMPILERDETECTION_H
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index c50235767a..0d8a5b1428 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -68,8 +68,8 @@
#define QT_STRINGIFY(x) QT_STRINGIFY2(x)
#include <QtCore/qsystemdetection.h>
-#include <QtCore/qcompilerdetection.h>
#include <QtCore/qprocessordetection.h>
+#include <QtCore/qcompilerdetection.h>
#if defined (__ELF__)
# define Q_OF_ELF