From b2b07028684bc3998052428232edddf57ba68d7d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolai=20H=C3=A4hnle?= Date: Thu, 7 Sep 2017 12:16:14 +0200 Subject: [PATCH] ac/addrlib: enable assertions in debug builds MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák --- src/amd/addrlib/core/addrcommon.h | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/amd/addrlib/core/addrcommon.h b/src/amd/addrlib/core/addrcommon.h index 66424a84ba9..8f5f1bfb374 100644 --- a/src/amd/addrlib/core/addrcommon.h +++ b/src/amd/addrlib/core/addrcommon.h @@ -36,22 +36,30 @@ #include "addrinterface.h" - // ADDR_LNX_KERNEL_BUILD is for internal build // Moved from addrinterface.h so __KERNEL__ is not needed any more #if ADDR_LNX_KERNEL_BUILD // || (defined(__GNUC__) && defined(__KERNEL__)) #include "lnx_common_defs.h" // ported from cmmqs #elif !defined(__APPLE__) || defined(HAVE_TSERVER) + #include #include #include #endif +#if BRAHMA_BUILD && !defined(DEBUG) +#ifdef NDEBUG +#define DEBUG 0 +#else +#define DEBUG 1 +#endif +#endif + //////////////////////////////////////////////////////////////////////////////////////////////////// // Platform specific debug break defines //////////////////////////////////////////////////////////////////////////////////////////////////// #if DEBUG #if defined(__GNUC__) - #define ADDR_DBG_BREAK() + #define ADDR_DBG_BREAK() assert(false) #elif defined(__APPLE__) #define ADDR_DBG_BREAK() { IOPanic("");} #else @@ -71,21 +79,21 @@ #define ADDR_ANALYSIS_ASSUME(expr) do { (void)(expr); } while (0) #endif -#if DEBUG +#if BRAHMA_BUILD + #define ADDR_ASSERT(__e) assert(__e) +#elif DEBUG #define ADDR_ASSERT(__e) \ do { \ ADDR_ANALYSIS_ASSUME(__e); \ if ( !((__e) ? TRUE : FALSE)) { ADDR_DBG_BREAK(); } \ } while (0) - #define ADDR_ASSERT_ALWAYS() ADDR_DBG_BREAK() - #define ADDR_UNHANDLED_CASE() ADDR_ASSERT(!"Unhandled case") - #define ADDR_NOT_IMPLEMENTED() ADDR_ASSERT(!"Not implemented"); #else //DEBUG #define ADDR_ASSERT(__e) ADDR_ANALYSIS_ASSUME(__e) - #define ADDR_ASSERT_ALWAYS() - #define ADDR_UNHANDLED_CASE() - #define ADDR_NOT_IMPLEMENTED() #endif //DEBUG + +#define ADDR_ASSERT_ALWAYS() ADDR_DBG_BREAK() +#define ADDR_UNHANDLED_CASE() ADDR_ASSERT(!"Unhandled case") +#define ADDR_NOT_IMPLEMENTED() ADDR_ASSERT(!"Not implemented"); //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// -- 2.30.2