Skip to content

Commit 994a984

Browse files
uextmjordankanter
authored andcommitted
log : fix MSVC compile errors (ggml-org#5643)
MSVC gives the following error with the existing macros: `Error C2059 : syntax error: ','` This patch adds `##` as a prefix to `__VA_ARGS__` to address this error.
1 parent 4f932f0 commit 994a984

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

common/log.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ inline std::string log_filename_generator_impl(LogTriState multilog, const std::
297297
#ifndef _MSC_VER
298298
#define LOG(...) LOG_IMPL(__VA_ARGS__, "")
299299
#else
300-
#define LOG(str, ...) LOG_IMPL("%s" str, "", __VA_ARGS__, "")
300+
#define LOG(str, ...) LOG_IMPL("%s" str, "", ##__VA_ARGS__, "")
301301
#endif
302302

303303
// Main TEE macro.
@@ -311,16 +311,16 @@ inline std::string log_filename_generator_impl(LogTriState multilog, const std::
311311
#ifndef _MSC_VER
312312
#define LOG_TEE(...) LOG_TEE_IMPL(__VA_ARGS__, "")
313313
#else
314-
#define LOG_TEE(str, ...) LOG_TEE_IMPL("%s" str, "", __VA_ARGS__, "")
314+
#define LOG_TEE(str, ...) LOG_TEE_IMPL("%s" str, "", ##__VA_ARGS__, "")
315315
#endif
316316

317317
// LOG macro variants with auto endline.
318318
#ifndef _MSC_VER
319319
#define LOGLN(...) LOG_IMPL(__VA_ARGS__, "\n")
320320
#define LOG_TEELN(...) LOG_TEE_IMPL(__VA_ARGS__, "\n")
321321
#else
322-
#define LOGLN(str, ...) LOG_IMPL("%s" str, "", __VA_ARGS__, "\n")
323-
#define LOG_TEELN(str, ...) LOG_TEE_IMPL("%s" str, "", __VA_ARGS__, "\n")
322+
#define LOGLN(str, ...) LOG_IMPL("%s" str, "", ##__VA_ARGS__, "\n")
323+
#define LOG_TEELN(str, ...) LOG_TEE_IMPL("%s" str, "", ##__VA_ARGS__, "\n")
324324
#endif
325325

326326
// INTERNAL, DO NOT USE

0 commit comments

Comments
 (0)