00001 //----------------------------------------------------------------------------------- 00002 // 00003 // Pro-Vocation Light Engine (PVLE) 00004 // Copyright (C) 2007-2009 Sukender, KinoX & Buzib 00005 // For more information, contact us : sukender@free.fr 00006 // 00007 // This program is free software; you can redistribute it and/or modify 00008 // it under the terms of the GNU General Public License as published by 00009 // the Free Software Foundation; either version 3 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // For any use that is not compatible with the terms of the GNU 00013 // General Public License, please contact the authors for alternative 00014 // licensing options. 00015 // 00016 // This program is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 // GNU General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU General Public License along 00022 // with this program; if not, write to the Free Software Foundation, Inc., 00023 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00024 // 00025 //----------------------------------------------------------------------------------- 00026 00027 #include <PVLE/Util/Assert.h> 00028 00029 #ifdef _DEBUG 00030 00031 //#include <PVLE/Util/TracedException.h> 00032 #include <stdlib.h> // for exit()/abort() 00033 00034 void __PVLEAssert(const char * a, const char * f, unsigned l, const char * m) { 00035 LOG_FATAL << std::endl; 00036 LOG_FATAL << "Assertion failed in " << f << ", line " << l << " (" << m << ") :" << std::endl; 00037 LOG_FATAL << " " << a << std::endl; 00038 00039 // Dev note: a breakpoint on the following line can be useful :) 00040 // Dev note 2: exit()/abort() instruction could be replaced by a THROW_TRACED_EXCEPTION() but the risk is that someone intercept that exception... 00041 //exit(-1); // This causes the app to close without any warning. 00042 abort(); // This can cause problems with debugger's stack trace. 00043 } 00044 00045 #endif // _DEBUG 00046 00047 00048 #if defined(BOOST_ENABLE_ASSERT_HANDLER) 00049 // Replace boost's assert with PVLE's one. 00050 namespace boost 00051 { 00052 void assertion_failed(char const * expr, char const * function, char const * file, long line) { 00053 #ifdef _DEBUG 00054 __PVLEAssert(expr, file, static_cast<unsigned>(line), function); 00055 #endif 00056 } 00057 } // namespace boost 00058 #endif