diff options
author | Nicolai Hähnle <[email protected]> | 2017-09-07 12:16:14 +0200 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2017-09-13 18:26:56 +0200 |
commit | b2b07028684bc3998052428232edddf57ba68d7d (patch) | |
tree | 84faba1c8c55805f5fa87093487802db0ff92076 | |
parent | 113ecc2bfadac487013c1b8d1de60636a5f20efa (diff) |
ac/addrlib: enable assertions in debug builds
Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r-- | src/amd/addrlib/core/addrcommon.h | 26 |
1 files 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 <assert.h> #include <stdlib.h> #include <string.h> #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"); //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// |