Skip to content

Commit 670f7cc

Browse files
committed
Fix DebugDefs.h for OMNeT++ 6.4 compatibility
Add PREPEND_MESSAGE_FORMAT macro to conditionally prepend "%s", to prependMessage() calls, as the API changed in OMNeT++ 6.4 (>=0x0604) to require an explicit format string argument.
1 parent f23c58a commit 670f7cc

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/inet/common/DebugDefs.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,20 @@ static inline bool _dbg_function_enabled(const char *function)
148148
#endif
149149
#endif
150150

151+
#if OMNETPP_VERSION >= 0x0604
152+
#define PREPEND_MESSAGE_FORMAT "%s",
153+
#else
154+
#define PREPEND_MESSAGE_FORMAT
155+
#endif
156+
151157
#if DEBUG_CHECK_IMPLEMENTATION
152158
#define DEBUG_CMP(o1, cmp, o2) { \
153159
bool _old_dbg_global_enabled = _dbg_global_enabled; _dbg_global_enabled = false; auto _o1 = (o1); auto _o2 = (o2); _dbg_global_enabled = _old_dbg_global_enabled; \
154160
if (!(_o1 cmp _o2)) { \
155161
_dbg_global_enabled = true; _o1 = (o1); _o2 = (o2); \
156162
std::ostringstream oss; oss << "ASSERT: Condition '" << #o1 << " " << #cmp << " " << #o2 << "' as '" << _o1 << " " << #cmp << " " << _o2 << "' does not hold"; \
157163
omnetpp::cRuntimeError error("in function '%s()' at %s:%d", __FUNCTION__, __FILE__, __LINE__); \
158-
error.prependMessage("%s", oss.str().c_str()); \
164+
error.prependMessage(PREPEND_MESSAGE_FORMAT oss.str().c_str()); \
159165
throw error; \
160166
} \
161167
}

0 commit comments

Comments
 (0)