121 Star 0 Fork 42

src-openEuler/qt

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-Redo-the-Q_FOREACH-loop-control-without-GCC-statemen.patch 1.68 KB
一键复制 编辑 原始数据 按行查看 历史
lizhenhua 提交于 2020-05-22 16:11 . Add yaml file
From 4c052f763fbc799cebb08273a3bb9de3a03b1f27 Mon Sep 17 00:00:00 2001
From: lizhenhua <lizhenhua@sina.com>
Date: Fri, 22 May 2020 15:58:42 +0800
Subject: [PATCH] Redo the Q_FOREACH loop control without GCC statement
expressions
---
src/corelib/global/qglobal.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 3c3bc32a..48f105b1 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -2482,22 +2482,22 @@ 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;
};
#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
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/qt.git
git@gitee.com:src-openeuler/qt.git
src-openeuler
qt
qt
master

搜索帮助