Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Alpine 3.11 w/ GCC 9 patch (not working yet) #18

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile-alpine.template
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ RUN apk add --no-cache \
&& patch -p1 -i /tmp/patches/qt-musl-iconv-no-bom.patch \
&& patch -p1 -i /tmp/patches/qt-recursive-global-mutex.patch \
&& patch -p1 -i /tmp/patches/qt-gcc6.patch \
&& patch -p1 -i /tmp/patches/qt-gcc9-foreach.patch \
\
# Modify qmake config
&& sed -i "s|-O2|$CXXFLAGS|" mkspecs/common/g++.conf \
Expand Down
42 changes: 42 additions & 0 deletions conf/qt-gcc9-foreach.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 7b69922b89..1cbb1d5702 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -2482,22 +2482,31 @@ 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;}))
+for (QForeachContainer<__typeof__((container))> _container_((container)); \
+ _container_.control && _container_.i != _container_.e; \
+ ++_container_.i, _container_.control ^= 1) \
+ for (variable = *_container_.i; _container_.control; _container_.control = 0)

#else
10 changes: 5 additions & 5 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ for version in \

# Supported base images
for image in \
alpine:3.10 \
node:12.18.2-alpine3.10 \
python:3.8.3-alpine3.10 \
alpine:3.11 \
node:12.18.3-alpine3.11 \
python:3.8.5-alpine3.11 \
; do
# Parse image string
base="${image%%:*}"
Expand Down Expand Up @@ -94,12 +94,12 @@ for version in \
;;
node*)
replaceRules+="
s/%%BUILDER%%/alpine:3.10/g;
s/%%BUILDER%%/alpine:3.11/g;
"
;;
python*)
replaceRules+="
s/%%BUILDER%%/alpine:3.10/g;
s/%%BUILDER%%/alpine:3.11/g;
"
;;
*)
Expand Down