aboutsummaryrefslogtreecommitdiff
path: root/src/lib/log/log.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-05-15 08:27:02 -0400
committerNick Mathewson <nickm@torproject.org>2019-05-23 12:48:51 -0400
commit2bb5d8148b2c15e9573a7f041ef631bdf4429b4b (patch)
treeb358c395e6ff3f2283827c71f0c4ba4d64252a27 /src/lib/log/log.h
parent29955f13e5bc8e61724759ec7245aae602672111 (diff)
downloadtor-2bb5d8148b2c15e9573a7f041ef631bdf4429b4b.tar.gz
tor-2bb5d8148b2c15e9573a7f041ef631bdf4429b4b.zip
In coverage builds, avoid basic-block complexity in log_debug
Ordinarily we skip calling log_fn(LOG_DEBUG,...) if debug logging is completely disabled. However, in coverage builds, this means that we get spurious complaints about partially covered basic blocks, in a way that makes our coverage determinism harder to check.
Diffstat (limited to 'src/lib/log/log.h')
-rw-r--r--src/lib/log/log.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/log/log.h b/src/lib/log/log.h
index a381220af0..4a3ea0ad55 100644
--- a/src/lib/log/log.h
+++ b/src/lib/log/log.h
@@ -194,6 +194,11 @@ void tor_log_get_logfile_names(struct smartlist_t *out);
extern int log_global_min_severity_;
+#ifdef TOR_COVERAGE
+/* For coverage builds, we try to avoid our log_debug optimization, since it
+ * can have weird effects on internal macro coverage. */
+#define debug_logging_enabled() (1)
+#else
static inline bool debug_logging_enabled(void);
/**
* Return true iff debug logging is enabled for at least one domain.
@@ -202,6 +207,7 @@ static inline bool debug_logging_enabled(void)
{
return PREDICT_UNLIKELY(log_global_min_severity_ == LOG_DEBUG);
}
+#endif
void log_fn_(int severity, log_domain_mask_t domain,
const char *funcname, const char *format, ...)