]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
In coverage builds, avoid basic-block complexity in log_debug
authorNick Mathewson <nickm@torproject.org>
Wed, 15 May 2019 12:27:02 +0000 (08:27 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 23 May 2019 16:48:51 +0000 (12:48 -0400)
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.

src/lib/log/log.h

index a381220af06f2db48ef5ff36000c51b73223da84..4a3ea0ad550f43eb7d01d299f3287f7cc9a7b27b 100644 (file)
@@ -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, ...)