#3 Add patch to fix longstanding bug in gcc that was fixed in gcc 9.
Merged 5 years ago by rdieter. Opened 5 years ago by hobbes1069.
rpms/ hobbes1069/qt master  into  master

@@ -0,0 +1,40 @@ 

+ --- a/src/corelib/global/qglobal.h

+ +++ b/src/corelib/global/qglobal.h

+ @@ -2482,22 +2482,32 @@ typedef uint Flags;

+  

+  #endif /* Q_NO_TYPESAFE_FLAGS */

+  

+ -#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_RVCT)

+ +#if (defined(Q_CC_GNU) && !defined(Q_CC_RVCT))

+  /* make use of typeof-extension */

+  template <typename T>

+  class QForeachContainer {

+  public:

+ -    inline QForeachContainer(const T& t) : c(t), brk(0), i(c.begin()), e(c.end()) { }

+ +    inline QForeachContainer(const T& t) : c(t), i(c.begin()), e(c.end()), control(1) { }

+      const T c;

+      int brk;

+      typename T::const_iterator i, e;

+ +    int control;

+  };

+  

+ +// Explanation of the control word:

+ +//  - it's initialized to 1

+ +//  - that means both the inner and outer loops start

+ +//  - if there were no breaks, at the end of the inner loop, it's set to 0, which

+ +//    causes it to exit (the inner loop is run exactly once)

+ +//  - at the end of the outer loop, it's inverted, so it becomes 1 again, allowing

+ +//    the outer loop to continue executing

+ +//  - if there was a break inside the inner loop, it will exit with control still

+ +//    set to 1; in that case, the outer loop will invert it to 0 and will exit too

+  #define Q_FOREACH(variable, container)                                \

+  for (QForeachContainer<__typeof__(container)> _container_(container); \

+ -     !_container_.brk && _container_.i != _container_.e;              \

+ -     __extension__  ({ ++_container_.brk; ++_container_.i; }))                       \

+ -    for (variable = *_container_.i;; __extension__ ({--_container_.brk; break;}))

+ +     _container_.control && _container_.i != _container_.e;         \

+ +     ++_container_.i, _container_.control ^= 1)                     \

+ +    for (variable = *_container_.i; _container_.control; _container_.control = 0)

+  

+  #else

+  

file modified
+5
@@ -215,6 +215,10 @@ 

  # aarch64 support, https://bugreports.qt-project.org/browse/QTBUG-35442

  Patch180: qt-aarch64.patch

  

+ # Fix problem caused by gcc 9 fixing a longstanding bug.

+ # https://github.com/qt/qtbase/commit/c35a3f519007af44c3b364b9af86f6a336f6411b.patch

+ Patch181: qt-everywhere-opensource-src-4.8.7-qforeach.patch

+ 

  ## upstream git

  

  ## security patches
@@ -638,6 +642,7 @@ 

  %patch113 -p1 -b .QTBUG-22829

  

  %patch180 -p1 -b .aarch64

+ %patch181 -p1 -b .qforeach

  

  # upstream git

  

Qt relied on a longstanding incorrect behavior in gcc that was fixed in version 9. The following patch was based on a commit to qt 5 which corrected the bug.

https://github.com/qt/qtbase/commit/c35a3f519007af44c3b364b9af86f6a336f6411b

Thanks, looks good to me (mostly).

It's missing a changelog entry, but that's largely cosmetic and we can add that later.

Pull-Request has been merged by rdieter

5 years ago

Yup, wasn't sure if I should have bumped the release since it hadn't been built, or just add my own changelog entry with the same release. :)