From 34d424aab432bfb3e0d599ba3ee659b6c7c4a907 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 29 Aug 2019 11:26:16 +0200 Subject: Cope with the new alias for noexcept We can now have Q_DECL_NOTHROW converted to Q_DECL_NOEXCEPT, or either of these converted to noexcept. A later commit shall also deal with Q_DECL_NOEXCEPT_EXPR(), which shall need to happen before this (as it also turns into noexpr(), albeit with parentheses). Combine with the other three-step cascade and move both later than it was. Change-Id: I11b78af9a6eb0948990e4ba50f702c4f93739bb6 Reviewed-by: Frederik Gladhorn --- packaging-tools/resetboring.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/packaging-tools/resetboring.py b/packaging-tools/resetboring.py index a9f01e8c6..263b42091 100755 --- a/packaging-tools/resetboring.py +++ b/packaging-tools/resetboring.py @@ -617,7 +617,7 @@ class Selector(object): # Select interesting changes, discard boring. for pair in (('Q_QDOC', 'Q_CLANG_QDOC'), ('Q_DECL_FINAL', 'final'), ('Q_DECL_CONSTEXPR', 'constexpr'), - ('Q_DECL_NOTHROW', 'noexcept')): + ): def test(words, k=pair[1]): return k in words def purge(words, p=pair): @@ -653,14 +653,6 @@ class Selector(object): # Select interesting changes, discard boring. # but the brace-matching is a bit much for this parser; and it # tends to get split across lines anyway ... - # Synonyms for 0: - for key in ('Q_NULLPTR', 'nullptr'): - def test(words, z=key): - return z in words - def purge(words, z=key): - return [('0', 'Q_NULLPTR', 'nullptr') if w == z else w for w in words] - yield test, purge - # Filter out various common end-of-line comments: for sought in (('//', '=', 'default'), ('//', 'LCOV_EXCL_LINE')): def test(tokens, sought=sought, size=len(sought)): @@ -705,6 +697,18 @@ class Selector(object): # Select interesting changes, discard boring. return words yield test, purge + # Multi-step transitions (oldest first in each tuple): + for seq in (('0', 'Q_NULLPTR', 'nullptr'), + # Needs to happen after handling of Q_DECL_NOEXCEPT_EXPR(): + ('Q_DECL_NOTHROW', 'Q_DECL_NOEXCEPT', 'noexcept'), + ): + for key in seq[1:]: + def test(words, z=key): + return z in words + def purge(words, z=key, s=seq): + return [s if w == z else w for w in words] + yield test, purge + # Used by next two #if-ery mungers: def find(words, key): assert None in key # so result *does* get set if we succeed -- cgit v1.2.3