summaryrefslogtreecommitdiff
path: root/src/basic/log.h
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-05-11 16:42:13 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-05-11 18:18:59 +0200
commit011a03a3fae25f2b715f2d88bc16b4cb8f8f2da2 (patch)
tree1eba248a5bda812af84c9b4de70504fb4f400de1 /src/basic/log.h
parent1ec7c15613028c75cf160a56bec0642a99109551 (diff)
downloadsystemd-011a03a3fae25f2b715f2d88bc16b4cb8f8f2da2.tar.gz
meson: turn on log-message-verification by default in developer builds
I'm not _quite_ convinced that this a good idea… I'm at least keeping it separate to make it easy to revert ;)
Diffstat (limited to 'src/basic/log.h')
-rw-r--r--src/basic/log.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/basic/log.h b/src/basic/log.h
index 7b89c4df63..b7b0a42e49 100644
--- a/src/basic/log.h
+++ b/src/basic/log.h
@@ -301,9 +301,10 @@ bool log_on_console(void) _pure_;
/* Helper to wrap the main message in structured logging. The macro doesn't do much,
* except to provide visual grouping of the format string and its arguments. */
#if LOG_MESSAGE_VERIFICATION || defined(__COVERITY__)
-/* Do a fake formatting of the message string to let the scanner verify the arguments
- * against the format message. */
-# define LOG_MESSAGE(fmt, ...) "MESSAGE=%.0d" fmt, printf(fmt, ##__VA_ARGS__), ##__VA_ARGS__
+/* Do a fake formatting of the message string to let the scanner verify the arguments against the format
+ * message. The variable will never be set to true, but we don't tell the compiler that :) */
+extern bool _log_message_dummy;
+# define LOG_MESSAGE(fmt, ...) "MESSAGE=%.0d" fmt, (_log_message_dummy && printf(fmt, ##__VA_ARGS__)), ##__VA_ARGS__
#else
# define LOG_MESSAGE(fmt, ...) "MESSAGE=" fmt, ##__VA_ARGS__
#endif