From: Nicolai Hähnle <nicolai.haeh...@amd.com> --- 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 @@ -29,70 +29,78 @@ * @file addrcommon.h * @brief Contains the helper function and constants. **************************************************************************************************** */ #ifndef __ADDR_COMMON_H__ #define __ADDR_COMMON_H__ #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 #define ADDR_DBG_BREAK() { __debugbreak(); } #endif #else #define ADDR_DBG_BREAK() #endif //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// // Debug assertions used in AddrLib //////////////////////////////////////////////////////////////////////////////////////////////////// #if defined(_WIN32) && (_MSC_VER >= 1400) #define ADDR_ANALYSIS_ASSUME(expr) __analysis_assume(expr) #else #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"); //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// // Debug print macro from legacy address library //////////////////////////////////////////////////////////////////////////////////////////////////// #if DEBUG #define ADDR_PRNT(a) Object::DebugPrint a /// @brief Macro for reporting informational messages -- 2.11.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev