Skip to content

Commit 15dd78e

Browse files
committed
libcore: Ensure MCLog() macros can be called with only a string
GCC doesn't like variadic templates with empty variadic argument lists. This meant that using `MCLog("message")` in code that used libcore's log macros would fail to compile. However, this can be worked around by making libcore's `MCLog()` a variadic macro with no named arguments. This was already the case in libfoundation.
1 parent 198e091 commit 15dd78e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libcore/include/core.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,15 @@ extern void __MCAssert(const char *file, uint32_t line, const char *message);
168168
#define MCAssert(m_expr) (void)( (!!(m_expr)) || (__MCAssert(__FILE__, __LINE__, #m_expr), 0) )
169169

170170
extern void __MCLog(const char *file, uint32_t line, const char *format, ...);
171-
#define MCLog(m_format, ...) __MCLog(__FILE__, __LINE__, m_format, __VA_ARGS__)
171+
#define MCLog(...) __MCLog(__FILE__, __LINE__, __VA_ARGS__)
172172

173173
extern void __MCLogWithTrace(const char *file, uint32_t line, const char *format, ...);
174-
#define MCLogWithTrace(m_format, ...) __MCLogWithTrace(__FILE__, __LINE__, m_format, __VA_ARGS__)
174+
#define MCLogWithTrace(...) __MCLogWithTrace(__FILE__, __LINE__, __VA_ARGS__)
175175

176176
#else
177177
#define MCAssert(expr)
178-
#define MCLog(m_format, ...)
179-
#define MCLogWithTrace(m_format, ...)
178+
#define MCLog(...)
179+
#define MCLogWithTrace(...)
180180
#endif
181181

182182
#define MC_CONCAT(X,Y) MC_CONCAT_(X,Y)

0 commit comments

Comments
 (0)