7 #define FW_ASSERT_FIRST_ARG(ARG_0, ...) ARG_0 9 #define FW_ASSERT_NO_FIRST_ARG(ARG_0, ...) __VA_ARGS__ 11 #if FW_ASSERT_LEVEL == FW_NO_ASSERT 14 #define FW_ASSERT(...) ((void)(FW_ASSERT_FIRST_ARG(__VA_ARGS__))) 16 #define FILE_NAME_ARG const CHAR* 17 #else // ASSERT is defined 21 #if FW_ASSERT_LEVEL == FW_FILEID_ASSERT && defined ASSERT_FILE_ID 22 #define FILE_NAME_ARG U32 23 #define FW_ASSERT(...) \ 24 ((FW_ASSERT_FIRST_ARG(__VA_ARGS__, 0)) \ 26 : (Fw::SwAssert(ASSERT_FILE_ID, FW_ASSERT_NO_FIRST_ARG(__VA_ARGS__, __LINE__)))) 27 #elif FW_ASSERT_LEVEL == FW_FILEID_ASSERT && !defined ASSERT_FILE_ID 28 #define FILE_NAME_ARG U32 29 #define FW_ASSERT(...) \ 30 ((FW_ASSERT_FIRST_ARG(__VA_ARGS__, 0)) \ 32 : (Fw::SwAssert(static_cast<U32>(0), FW_ASSERT_NO_FIRST_ARG(__VA_ARGS__, __LINE__)))) 33 #elif FW_ASSERT_LEVEL == FW_RELATIVE_PATH_ASSERT && defined ASSERT_RELATIVE_PATH 34 #define FILE_NAME_ARG const CHAR* 35 #define FW_ASSERT(...) \ 36 ((FW_ASSERT_FIRST_ARG(__VA_ARGS__, 0)) \ 38 : (Fw::SwAssert(ASSERT_RELATIVE_PATH, FW_ASSERT_NO_FIRST_ARG(__VA_ARGS__, __LINE__)))) 40 #define FILE_NAME_ARG const CHAR* 41 #define FW_ASSERT(...) \ 42 ((FW_ASSERT_FIRST_ARG(__VA_ARGS__, 0)) ? ((void)0) \ 43 : (Fw::SwAssert(__FILE__, FW_ASSERT_NO_FIRST_ARG(__VA_ARGS__, __LINE__)))) 45 #endif // if ASSERT is defined 48 #define FW_ASSERT_NO_OVERFLOW(value, T) \ 49 FW_ASSERT((value) <= std::numeric_limits<T>::max(), static_cast<FwAssertArgType>(value)) 51 #if FW_ASSERTIONS_ALWAYS_ABORT 52 #define FW_ASSERT_NORETURN __attribute__((noreturn)) 58 #ifndef FW_ASSERT_NORETURN 60 #define __has_feature(x) 0 // Compatibility with non-clang compilers. 62 #if __has_feature(attribute_analyzer_noreturn) 63 #define FW_ASSERT_NORETURN __attribute__((analyzer_noreturn)) 65 #define FW_ASSERT_NORETURN 73 #ifndef __has_attribute 74 #define __has_attribute(x) 0 76 #if __has_attribute(noinline) 77 #define NOINLINE __attribute__((noinline)) 173 #endif // FW_ASSERT_HPP PlatformSizeType FwSizeType
static AssertHook * getRegisteredHook()
void SwAssert(FILE_NAME_ARG file, FwSizeType lineNo)
Assert with no arguments.
virtual void reportAssert(FILE_NAME_ARG file, FwSizeType lineNo, FwSizeType numArgs, FwAssertArgType arg1, FwAssertArgType arg2, FwAssertArgType arg3, FwAssertArgType arg4, FwAssertArgType arg5, FwAssertArgType arg6)
destructor
virtual ~AssertHook()
constructor
virtual void printAssert(const CHAR *msg)
Implementation of malloc based allocator.
#define FW_ASSERT_NORETURN
PlatformAssertArgType FwAssertArgType
The type of arguments to assert functions.