diff -r 89de11b856ce -r f48d95330c7a src/base/misc.hh --- a/src/base/misc.hh Mon Jun 08 12:20:10 2015 +0100 +++ b/src/base/misc.hh Mon Jun 08 12:22:57 2015 +0100 @@ -219,6 +219,20 @@ cond_message_once(want_hack, std::cerr, "hack", hack_verbose, __VA_ARGS__) /** + * Conditional warning macro that checks the supplied condition and + * only prints a warning if the condition is true. Useful to replace + * if + warn. + * + * @param cond Condition that is checked; if true -> panic + * @param ... Printf-based format string with arguments, extends printout. + */ +#define warn_if(cond, ...) \ + do { \ + if ((cond)) \ + warn(__VA_ARGS__); \ + } while (0) + +/** * The chatty assert macro will function like a normal assert, but will allow the * specification of additional, helpful material to aid debugging why the * assertion actually failed. Like the normal assertion, the chatty_assert