File: gcc_6.3.diff

package info (click to toggle)
qtbase-opensource-src 5.7.1%2Bdfsg-3%2Bdeb9u2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 283,652 kB
  • sloc: cpp: 1,754,662; ansic: 433,142; xml: 100,291; python: 9,650; sh: 7,671; java: 6,543; asm: 4,283; perl: 2,217; yacc: 1,733; lex: 1,194; makefile: 333; objc: 70
file content (31 lines) | stat: -rw-r--r-- 1,348 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Description: fix build with gcc 6.3 and newer versions
 The builtins clzs and ctzs have been removed. Additionally they were
 never proper internal GCC builtins and shouldn't have been used in a
 constexpr function in the first place. This patch removes the assumption
 that they exist when BMI is available, and let GCC fall back to using
 __builtin_clz and __builtin_ctz.
Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=bb0f29f82b934b48
 Manually rebased against the 5.7.1 release by Dmitry Shachnev.
Bug: https://bugs.debian.org/846996
Last-Update: 2016-12-23

--- a/src/corelib/tools/qalgorithms.h
+++ b/src/corelib/tools/qalgorithms.h
@@ -626,7 +626,7 @@
 Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint16 v) Q_DECL_NOTHROW
 {
 #if defined(Q_CC_GNU)
-#  if QT_HAS_BUILTIN(__builtin_ctzs) || (defined(__LZCNT__) && defined(__BMI__))
+#  if QT_HAS_BUILTIN(__builtin_ctzs)
     return v ? __builtin_ctzs(v) : 16U;
 #  else
     return v ? __builtin_ctz(v) : 16U;
@@ -689,7 +689,7 @@
 Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint16 v) Q_DECL_NOTHROW
 {
 #if defined(Q_CC_GNU)
-#  if QT_HAS_BUILTIN(__builtin_clzs) || (defined(__LZCNT__) && defined(__BMI__))
+#  if QT_HAS_BUILTIN(__builtin_clzs)
     return v ? __builtin_clzs(v) : 16U;
 #  else
     return v ? __builtin_clz(v)-16U : 16U;