From 283c230fa18abd5ededce0f34d1c0865f65b3d8e Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Thu, 13 Aug 2020 16:39:30 -0400 Subject: [PATCH] Improve ASSERT_RETURN in SkScan_Path When this assert happens in a Chromium bug report it just states "assert(false)". While the line number is present the line numbers aren't always stable or easy to track down over time, so having the condition that actually asserted present gives better certainty about where in the code and which condition failed to hold in relation to the crash report. Change-Id: I7b0deb05c1736ba90c7642c90d8be44d2d17e9f4 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310156 Reviewed-by: Mike Klein Commit-Queue: Ben Wagner --- src/core/SkScan_Path.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/SkScan_Path.cpp b/src/core/SkScan_Path.cpp index d15d169881..b30b40090a 100644 --- a/src/core/SkScan_Path.cpp +++ b/src/core/SkScan_Path.cpp @@ -210,12 +210,12 @@ static bool update_edge(SkEdge* edge, int last_y) { } // Unexpected conditions for which we need to return -#define ASSERT_RETURN(cond) \ - do { \ - if (!(cond)) { \ - SkASSERT(false); \ - return; \ - } \ +#define ASSERT_RETURN(cond) \ + do { \ + if (!(cond)) { \ + SkDEBUGFAILF("assert(%s)", #cond); \ + return; \ + } \ } while (0) // Needs Y to only change once (looser than convex in X)