From: David Matlack Subject: [kvm-unit-tests PATCH 19/32] lib: added assert_msg macro Date: Thu, 20 Apr 2017 17:49:51 -0700 Message-ID: <20170421005004.137260-20-dmatlack@google.com> References: <20170421005004.137260-1-dmatlack@google.com> Cc: Peter Feiner , David Matlack To: kvm@vger.kernel.org Return-path: Received: from mail-oi0-f53.google.com ([209.85.218.53]:35012 "EHLO mail-oi0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033953AbdDUAu2 (ORCPT ); Thu, 20 Apr 2017 20:50:28 -0400 Received: by mail-oi0-f53.google.com with SMTP id j201so73636910oih.2 for ; Thu, 20 Apr 2017 17:50:27 -0700 (PDT) In-Reply-To: <20170421005004.137260-1-dmatlack@google.com> Sender: kvm-owner@vger.kernel.org List-ID: From: Peter Feiner Signed-off-by: Peter Feiner Signed-off-by: David Matlack --- lib/libcflat.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/libcflat.h b/lib/libcflat.h index 1d2eba980e1a..5d356df75f1f 100644 --- a/lib/libcflat.h +++ b/lib/libcflat.h @@ -126,6 +126,16 @@ do { \ } \ } while (0) +#define assert_msg(cond, fmt, args...) \ +do { \ + if (!(cond)) { \ + printf("%s:%d: assert failed: %s: " fmt, \ + __FILE__, __LINE__, #cond, ## args); \ + dump_stack(); \ + abort(); \ + } \ +} while (0) + static inline bool is_power_of_2(unsigned long n) { return n && !(n & (n - 1)); -- 2.12.2.816.g2cccc81164-goog