aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2019-08-29 11:32:28 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2019-09-09 17:51:10 +0000
commitf98f1a09575d4bf2cacace173401d2e14c9f3236 (patch)
tree382264aee9eb82dfc84051502f95c5031bdb45ec
parent34d424aab432bfb3e0d599ba3ee659b6c7c4a907 (diff)
Handle Q_DECL_NOEXCEPT_EXPR()'s more common casesv5.12.5-packaging
Unfortunately, the way matching and purging is done gets into trouble if one line contains two matches to a pattern and only one of them has been changed. Since noexcept()'s condition often is itself a noexcept() expression, noexcept(noexcept(...)) happens and we need to not match it (as the inner noexcept never used the macro). So this only a partially handle the replacement, but at least it catches the more common cases. Added a FIXME comment explaining the problem that prevents solving this better. Change-Id: I14b555c67dd9521bdc42adbce82267745ae7a56a Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
-rwxr-xr-xpackaging-tools/resetboring.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/packaging-tools/resetboring.py b/packaging-tools/resetboring.py
index 263b42091..5c3a28250 100755
--- a/packaging-tools/resetboring.py
+++ b/packaging-tools/resetboring.py
@@ -402,6 +402,12 @@ class Selector(object): # Select interesting changes, discard boring.
only differences between them are boring.
"""
tokens = cls.__split(text)
+ # FIXME: if several recipes apply, the returned selection
+ # of variants should represent the result of applying each
+ # subset of those recipes; this includes the case of
+ # applying one recipe repeatedly, where each candidate
+ # application may be included or omitted independently.
+ # But this would complicate harmonize() ...
for test, purge in cls.recipe:
if test(tokens):
tokens = purge(tokens)
@@ -667,10 +673,14 @@ class Selector(object): # Select interesting changes, discard boring.
# 5.10: common switch from while (0) to while (false)
# 5.12: Q_DECL_EQ_DELETE -> = delete
- # 5.14: qMove -> std::move
+ # 5.14: qMove -> std::move, Q_DECL_NOEXCEPT_EXPR(...) -> noexcept(...)
for swap in ((('while', '(', '0', ')'), ('while', '(', 'false', ')')),
(('Q_DECL_EQ_DELETE', ';'), ('=', 'delete', ';')),
(('qMove',), ('std', '::', 'move')),
+ # Needs to happen before handling of Q_DECL_NOEXCEPT (as both replace "noexcept"):
+ # Gets complicated by the first case being common:
+ (('Q_DECL_NOEXCEPT_EXPR', '(', 'noexcept', '('), ('noexcept', '(', 'noexcept', '(')),
+ (('Q_DECL_NOEXCEPT_EXPR', '(', '('), ('noexcept', '(', '(')),
):
def find(words, after=swap[1]):
try: