diff options
author | rl1987 <rl1987@sdf.lonestar.org> | 2019-03-05 17:02:03 +0200 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-03-29 14:25:59 -0400 |
commit | f66a17444e4a83e548985784956f321e9e1e1ab2 (patch) | |
tree | 95b715780456ee6252c61650e78691b4c7cfd684 /src/lib/log | |
parent | b6813845cf3140475f72f1f52638fa04b44c3a1b (diff) | |
download | tor-f66a17444e4a83e548985784956f321e9e1e1ab2.tar.gz tor-f66a17444e4a83e548985784956f321e9e1e1ab2.zip |
Silence compiler warnings
Diffstat (limited to 'src/lib/log')
-rw-r--r-- | src/lib/log/util_bug.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib/log/util_bug.c b/src/lib/log/util_bug.c index bbc744f0cc..1ce48c0ebb 100644 --- a/src/lib/log/util_bug.c +++ b/src/lib/log/util_bug.c @@ -69,6 +69,7 @@ tor_set_failed_assertion_callback(void (*fn)(void)) /** Helper for tor_assert: report the assertion failure. */ void +CHECK_PRINTF(5, 6) tor_assertion_failed_(const char *fname, unsigned int line, const char *func, const char *expr, const char *fmt, ...) @@ -77,11 +78,18 @@ tor_assertion_failed_(const char *fname, unsigned int line, char *extra = NULL; va_list ap; +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wformat-nonliteral" +#endif if (fmt) { va_start(ap,fmt); tor_vasprintf(&extra, fmt, ap); va_end(ap); } +#ifdef __clang__ +#pragma clang diagnostic pop +#endif log_err(LD_BUG, "%s:%u: %s: Assertion %s failed; aborting.", fname, line, func, expr); @@ -94,6 +102,7 @@ tor_assertion_failed_(const char *fname, unsigned int line, /** Helper for tor_assert_nonfatal: report the assertion failure. */ void +CHECK_PRINTF(6, 7) tor_bug_occurred_(const char *fname, unsigned int line, const char *func, const char *expr, int once, const char *fmt, ...) @@ -120,11 +129,18 @@ tor_bug_occurred_(const char *fname, unsigned int line, va_list ap; char *extra = NULL; +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wformat-nonliteral" +#endif if (fmt) { va_start(ap,fmt); tor_vasprintf(&extra, fmt, ap); va_end(ap); } +#ifdef __clang__ +#pragma clang diagnostic pop +#endif log_warn(LD_BUG, "%s:%u: %s: Non-fatal assertion %s failed.%s", fname, line, func, expr, once_str); |