From: Vladimír Čunát Date: Thu, 22 Nov 2018 14:11:37 +0000 (+0100) Subject: QRVERBOSE: avoid a -Wpedantic warning X-Git-Tag: v3.2.0~25^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=934b5f5946f797fdc6d66cd21fa12cd7cba3b50e;p=thirdparty%2Fknot-resolver.git QRVERBOSE: avoid a -Wpedantic warning It's about a hundred of them. The price is making two printf calls instead of one. That seems acceptable; these warning tools can help us in future, and the likelihood of mixing outputs from different processes seems relatively small. --- diff --git a/lib/layer.h b/lib/layer.h index c3db71c51..f94c2d1ee 100644 --- a/lib/layer.h +++ b/lib/layer.h @@ -21,20 +21,23 @@ #ifndef NOVERBOSELOG /** @internal Print a debug message related to resolution. */ - #define QRVERBOSE(query, cls, fmt, ...) { \ - const struct kr_query *q = (query); \ - if (kr_log_trace_enabled(q)) { \ - kr_log_trace(q, cls, fmt, ## __VA_ARGS__); \ - } else WITH_VERBOSE(q) { \ - unsigned _ind = 0; \ - uint32_t _q_uid = q ? q->uid : 0; \ - uint32_t _req_uid = q && q->request ? q->request->uid : 0; \ - for (; q; q = q->parent, _ind += 2); \ - kr_log_verbose("[%05u.%02u][%s] %*s" fmt, _req_uid, _q_uid, cls, _ind, "", ## __VA_ARGS__); \ - } \ + #define QRVERBOSE(query, cls, ...) { \ + const struct kr_query *q = (query); \ + if (kr_log_trace_enabled(q)) { \ + kr_log_trace(q, cls, __VA_ARGS__); \ + } else if (VERBOSE_STATUS) { \ + unsigned _ind = 0; \ + uint32_t _q_uid = q ? q->uid : 0; \ + uint32_t _req_uid = q && q->request ? q->request->uid : 0; \ + for (; q; q = q->parent, _ind += 2); \ + /* simplified kr_log_verbose() calls */ \ + printf("[%05u.%02u][%s] %*s", _req_uid, _q_uid, cls, _ind, ""); \ + printf(__VA_ARGS__); \ + fflush(stdout); \ + } \ } #else - #define QRVERBOSE(query, cls, fmt, ...) + #define QRVERBOSE(query, cls, ...) #endif /** Layer processing states. Only one value at a time (but see TODO).