aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2017-06-02 14:13:08 -0700
committerAndrew Chow <achow101-github@achow101.com>2017-06-07 14:19:01 -0700
commitc8914b9dbbf6106dac3c62769f7ce3bacd8fbf9b (patch)
tree1d15ff6d2d3a98b41b5266cb68f1f7f1c02aa35c /src/util.h
parent46311e792f4e4a53b7dc418215b03d890d0594d5 (diff)
downloadbitcoin-c8914b9dbbf6106dac3c62769f7ce3bacd8fbf9b.tar.xz
Have `make cov` optionally include branch coverage statistics
Added an option to configure to allow for branch coverage statistics gathering. Disabled logprint macro when coverage testing is on so that unnecessary branches are not analyzed.
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
index 4386ddd550..a1c59bbd10 100644
--- a/src/util.h
+++ b/src/util.h
@@ -123,6 +123,17 @@ int LogPrintStr(const std::string &str);
/** Get format string from VA_ARGS for error reporting */
template<typename... Args> std::string FormatStringFromLogArgs(const char *fmt, const Args&... args) { return fmt; }
+static inline void MarkUsed() {}
+template<typename T, typename... Args> static inline void MarkUsed(const T& t, const Args&... args)
+{
+ (void)t;
+ MarkUsed(args...);
+}
+
+#ifdef USE_COVERAGE
+#define LogPrintf(...) do { MarkUsed(__VA_ARGS__); } while(0)
+#define LogPrint(category, ...) do { MarkUsed(__VA_ARGS__); } while(0)
+#else
#define LogPrintf(...) do { \
std::string _log_msg_; /* Unlikely name to avoid shadowing variables */ \
try { \
@@ -139,6 +150,7 @@ template<typename... Args> std::string FormatStringFromLogArgs(const char *fmt,
LogPrintf(__VA_ARGS__); \
} \
} while(0)
+#endif
template<typename... Args>
bool error(const char* fmt, const Args&... args)