[graphics/krita] libs/global: Fix ASSERT_BREAK not working

Merge Service null at kde.org
Fri Feb 24 20:41:16 GMT 2023


Git commit 1e645da49a941b65d4a13ced4c9a80e045830b49 by Merge Service, on behalf of Agata Cacko.
Committed on 24/02/2023 at 20:40.
Pushed by merge-service into branch 'master'.

Fix ASSERT_BREAK not working

Putting do_while block around "break" prevents the ASSERT_BREAK
from working. This commit partially reverts b9f7132e88358e4ab86fc8
and removes the block so the asserts can work again.

CCMAIL:kimageshop at kde.org
CID 436418

Part-of: <https://invent.kde.org/graphics/krita/-/merge_requests/1757>

M  +2    -2    libs/global/kis_assert.h

https://invent.kde.org/graphics/krita/commit/1e645da49a941b65d4a13ced4c9a80e045830b49

diff --git a/libs/global/kis_assert.h b/libs/global/kis_assert.h
index f7e46179be..19a19e2460 100644
--- a/libs/global/kis_assert.h
+++ b/libs/global/kis_assert.h
@@ -62,7 +62,7 @@ KRITAGLOBAL_EXPORT void kis_safe_assert_recoverable(const char *assertion, const
  * }
  *
  */
-#define KIS_ASSERT_RECOVER_BREAK(cond) do { KIS_ASSERT_RECOVER(cond) { break; } } while (0)
+#define KIS_ASSERT_RECOVER_BREAK(cond) KIS_ASSERT_RECOVER(cond) { break; }
 
 /**
  * Equivalent of the following:
@@ -124,7 +124,7 @@ KRITAGLOBAL_EXPORT void kis_safe_assert_recoverable(const char *assertion, const
  */
 
 #define KIS_SAFE_ASSERT_RECOVER(cond) if (!(cond) && (kis_safe_assert_recoverable(#cond,__FILE__,__LINE__), true))
-#define KIS_SAFE_ASSERT_RECOVER_BREAK(cond) do { KIS_SAFE_ASSERT_RECOVER(cond) { break; } } while (0)
+#define KIS_SAFE_ASSERT_RECOVER_BREAK(cond) KIS_SAFE_ASSERT_RECOVER(cond) { break; }
 #define KIS_SAFE_ASSERT_RECOVER_RETURN(cond) do { KIS_SAFE_ASSERT_RECOVER(cond) { return; } } while (0)
 #define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val) do { KIS_SAFE_ASSERT_RECOVER(cond) { return (val); } } while (0)
 #define KIS_SAFE_ASSERT_RECOVER_NOOP(cond) do { KIS_SAFE_ASSERT_RECOVER(cond) { qt_noop(); } } while (0)


More information about the kimageshop mailing list