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 ;)
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2022-05-11 16:42:13 +02:00
parent 1ec7c15613
commit 011a03a3fa
4 changed files with 16 additions and 5 deletions

View File

@@ -67,6 +67,10 @@ static bool prohibit_ipc = false;
* use here. */
static char *log_abort_msg = NULL;
#if LOG_MESSAGE_VERIFICATION || defined(__COVERITY__)
bool _log_message_dummy = false; /* Always false */
#endif
/* An assert to use in logging functions that does not call recursively
* into our logging functions (since that might lead to a loop). */
#define assert_raw(expr) \

View File

@@ -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