SWDEV-245381 : Updated guarantee error messages to print based on BUILD_TYPE

Change-Id: Ia21039326b440f6d807a6495a9a05dd52b384c76
This commit is contained in:
agodavar
2021-01-05 04:53:59 -05:00
parent 7bcd555602
commit 69a786e8d1
5 changed files with 16 additions and 9 deletions
+5 -1
View File
@@ -46,7 +46,11 @@ extern "C" void breakpoint(void) {
void report_fatal(const char* file, int line, const char* message) {
// FIXME_lmoriche: Obfuscate the message string
fprintf(stderr, "%s:%d: %s\n", file, line, message);
#if (defined(DEBUG))
fprintf(stderr, "%s:%d: %s\n", file, line, message);
#else
fprintf(stderr, "%s\n", message);
#endif
::abort();
}
+6 -3
View File
@@ -90,13 +90,16 @@ extern void log_printf(LogLevel level, const char* file, int line, uint64_t *sta
#endif // __INTEL_COMPILER
//! \brief Abort the program if the invariant \a cond is false.
#define guarantee(cond) \
#define guarantee(cond, ...) \
if (!(cond)) { \
amd::report_fatal(__FILE__, __LINE__, "guarantee(" XSTR(cond) ")"); \
if(strlen(#__VA_ARGS__) == 0) \
amd::report_fatal(__FILE__, __LINE__, XSTR(cond) ); \
else \
amd::report_fatal(__FILE__, __LINE__, XSTR(__VA_ARGS__) ); \
amd::breakpoint(); \
}
#define fixme_guarantee(cond) guarantee(cond)
#define fixme_guarantee(cond, ...) guarantee(cond, __VA_ARGS__)
//! \brief Abort the program with a fatal error message.
#define fatal(msg) \