From 3bac1d884500d956f9160c4c20281d9304cc9966 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sun, 18 Feb 2024 19:20:58 +0000 Subject: [PATCH] utils: BUG_ON was not doing what the comment says It should abort if the expr is true, but is doing the other way around Signed-off-by: Yuxuan Shui --- src/utils.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils.h b/src/utils.h index 81b2ca3f..43927381 100644 --- a/src/utils.h +++ b/src/utils.h @@ -49,9 +49,9 @@ safe_isnan(double a) { #define BUG_ON(expr) \ do { \ bool __bug_on_tmp = (expr); \ - assert(__bug_on_tmp && "original expr: " #expr); \ - if (!__bug_on_tmp) { \ - fprintf(stderr, "BUG_ON: check \"%s\" failed \n", #expr); \ + assert(!__bug_on_tmp && "Original expr: " #expr); \ + if (__bug_on_tmp) { \ + fprintf(stderr, "BUG_ON: \"%s\"\n", #expr); \ abort(); \ } \ } while (0)