# # # patch "sanity.cc" # from [f3a45e23411c78323154066a9d0deaa398d14e45] # to [b1af0d0fe1c4aa81666e23b0e6e9427c22165143] # # patch "sanity.hh" # from [f96bc471c778d8cba8e62f71eb15c92b92791b51] # to [400b88cfe22b73c5fecdf10fef41a7fe26c5b69c] # ============================================================ --- sanity.cc f3a45e23411c78323154066a9d0deaa398d14e45 +++ sanity.cc b1af0d0fe1c4aa81666e23b0e6e9427c22165143 @@ -295,53 +295,8 @@ sanity::warning(i18n_format const & i18n inform_warning(str); } -/* -void -sanity::naughty_failure(char const * expr, i18n_format const & explain, - char const * file, int line) -{ - string message; - if (!imp) - throw std::logic_error("sanity::naughty_failure occured " - "before sanity::initialize"); - if (imp->debug) - log(FL("%s:%d: usage constraint '%s' violated") % file % line % expr, - file, line); - prefix_lines_with(_("misuse: "), do_format(explain, file, line), message); - gasp(); - throw informative_failure(message); -} void -sanity::error_failure(char const * expr, i18n_format const & explain, - char const * file, int line) -{ - string message; - if (!imp) - throw std::logic_error("sanity::error_failure occured " - "before sanity::initialize"); - if (imp->debug) - log(FL("%s:%d: detected error '%s' violated") % file % line % expr, - file, line); - gasp(); - prefix_lines_with(_("error: "), do_format(explain, file, line), message); - throw informative_failure(message); -} - -void -sanity::invariant_failure(char const * expr, char const * file, int line) -{ - char const * pattern = N_("%s:%d: invariant '%s' violated"); - if (!imp) - throw std::logic_error("sanity::invariant_failure occured " - "before sanity::initialize"); - if (imp->debug) - log(FL(pattern) % file % line % expr, file, line); - gasp(); - throw logic_error((F(pattern) % file % line % expr).str()); -} -*/ -void sanity::generic_failure(char const * expr, origin::type caused_by, i18n_format const & explain, ============================================================ --- sanity.hh f96bc471c778d8cba8e62f71eb15c92b92791b51 +++ sanity.hh 400b88cfe22b73c5fecdf10fef41a7fe26c5b69c @@ -85,14 +85,6 @@ struct sanity { char const * file, int line); void warning(i18n_format const & fmt, char const * file, int line); - /* - NORETURN(void naughty_failure(char const * expr, i18n_format const & explain, - char const * file, int line)); - NORETURN(void error_failure(char const * expr, i18n_format const & explain, - char const * file, int line)); - NORETURN(void invariant_failure(char const * expr, - char const * file, int line)); - */ NORETURN(void generic_failure(char const * expr, origin::type caused_by, i18n_format const & explain, @@ -361,23 +353,7 @@ struct bad_decode { __FILE__, __LINE__); \ } \ } while (0) -/* -// N is for naughtyness on behalf of the user -// (if they are wrong, the user just did something wrong) -#define N(e, explain) \ - do { \ - if (UNLIKELY(!(e))) \ - { \ - if (made_from == made_from_network) \ - throw bad_decode(F("%s:%s : %s") \ - % __FILE__ % __LINE__ % (explain)); \ - else \ - global_sanity.naughty_failure("N("#e")", \ - (explain), \ - __FILE__, __LINE__); \ - } \ - } while (0) -*/ + // E is for errors; they are normal (i.e., not a bug), but not necessarily // attributable to user naughtiness #define E(e, whence, explain) \