Skip to content

Commit 5dd5883

Browse files
lwaern-intelmandolaerik
authored andcommitted
dmllib.h: Only use VT_log_warning if available
Otherwise, use `SIM_LOG_ERROR`. Needed for compatibility with packages with a Base dependency lower than 6.0.188.
1 parent f63d4d3 commit 5dd5883

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

include/simics/dmllib.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,19 @@ static inline uint64 DML_shlu(uint64 a, uint64 b)
4141
return b > 63 ? 0 : a << b;
4242
}
4343

44+
// This is used instead of SIM_LOG_WARNING directly, as a SIM_get_api_function
45+
// indirection is needed to work with old 6 base packages
46+
// TODO scrap this once the base dependency of every package is bumped
47+
// to 6.0.188 or above.
48+
#define _DMLLIB_LOG_WARNING(dev, grps, ...) do { \
49+
GET_API_FUNCTION(log_warning, VT_log_warning); \
50+
if (log_warning) { \
51+
log_warning(dev, grps, __VA_ARGS__); \
52+
} else { \
53+
SIM_LOG_ERROR(dev, grps, __VA_ARGS__); \
54+
} \
55+
} while (0)
56+
4457
PRINTF_FORMAT(1, 2) UNUSED static void
4558
_signal_critical_error(const char *restrict format, ...) {
4659
va_list va;
@@ -1303,7 +1316,7 @@ _DML_pre_delete_cancel_immediate_afters(conf_object_t *dev,
13031316
if (QEMPTY(state->queue)) return;
13041317

13051318
if (state->warn_upon_deletion) {
1306-
SIM_LOG_WARNING(
1319+
_DMLLIB_LOG_WARNING(
13071320
dev, 0,
13081321
"DML device deleted while immediate after callbacks of it are "
13091322
"still pending! These are now canceled. "

0 commit comments

Comments
 (0)