SWDEV-378006 - Adding a new guarantee macro to support printing args.

Change-Id: I9c838644e31a84d96a44b2bd10525a08d805a047
This commit is contained in:
kjayapra-amd authored and Karthik Jayaprakash committed 2023-01-21 06:26:50 -05:00
1 parent 8c421b62f2
commit b968394b4e
5 files changed
+15 -35

No files matched your search

-11
Vedi File
@@ -49,17 +49,6 @@ extern "C" void breakpoint(void) {
}
//! \endcond
// ================================================================================================
void report_fatal(const char* file, int line, const char* message) {
// FIXME_lmoriche: Obfuscate the message string
#if (defined(DEBUG))
fprintf(outFile, "%s:%d: %s\n", file, line, message);
#else
fprintf(outFile, "%s\n", message);
#endif
::abort();
}
// ================================================================================================
void report_warning(const char* message) { fprintf(outFile, "Warning: %s\n", message); }
+3 -6
Vedi File
@@ -66,9 +66,6 @@ extern FILE* outFile;
extern "C" void breakpoint();
//! \endcond
//! \brief Report a Fatal exception message and abort.
extern void report_fatal(const char* file, int line, const char* message);
//! \brief Display a warning message.
extern void report_warning(const char* message);
@@ -94,10 +91,10 @@ 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, message) \
#define guarantee(cond, format, ...) \
if (!(cond)) { \
amd::report_fatal(__FILE__, __LINE__, XSTR(message) ); \
amd::breakpoint(); \
amd::log_printf(amd::LOG_NONE, __FILE__, __LINE__, format, ##__VA_ARGS__); \
::abort(); \
}
#define fixme_guarantee(cond, ...) guarantee(cond, __VA_ARGS__)