Botan
1.11.15
|
00001 /* 00002 * Runtime assertion checking 00003 * (C) 2010,2012 Jack Lloyd 00004 * 00005 * Botan is released under the Simplified BSD License (see license.txt) 00006 */ 00007 00008 #include <botan/exceptn.h> 00009 #include <sstream> 00010 00011 namespace Botan { 00012 00013 void assertion_failure(const char* expr_str, 00014 const char* assertion_made, 00015 const char* func, 00016 const char* file, 00017 int line) 00018 { 00019 std::ostringstream format; 00020 00021 format << "False assertion "; 00022 00023 if(assertion_made && assertion_made[0] != 0) 00024 format << "'" << assertion_made << "' (expression " << expr_str << ") "; 00025 else 00026 format << expr_str << " "; 00027 00028 if(func) 00029 format << "in " << func << " "; 00030 00031 format << "@" << file << ":" << line; 00032 00033 throw std::runtime_error(format.str()); 00034 } 00035 00036 }