00001 // !concept {:name => "Portable assertions"} 00002 00003 #ifndef __ASSERTIONS_H__ 00004 #define __ASSERTIONS_H__ 00005 00006 // Whether or not to compile in assertions is controlled by NDEBUG. 00007 // The kind of assertion failure reporting that is done may be 00008 // affected by the __DO_LOGGING__ flag. 00009 00010 #include "application_config.h" 00011 00012 #ifndef __EPOC32__ 00013 #include <assert.h> 00014 #endif 00015 00016 #ifdef __EPOC32__ 00017 00018 #if defined(NDEBUG) 00019 00020 #define assert(e) ((void)0) 00021 00022 #else 00023 00024 //#undef assert 00025 00026 #ifdef __cplusplus 00027 extern "C" { 00028 #endif 00029 00030 #if __DO_LOGGING__ 00031 // assertions are logged 00032 void epoc_assert(const char *func, const char *file, int line, const char *s); 00033 #define assert(e) ((e) ? (void)0 : epoc_assert(__func__, __FILE__, __LINE__, #e)) 00034 #else 00035 // assertions cause a panic 00036 void epoc_assert_panic(); 00037 #define assert(e) ((e) ? (void)0 : epoc_assert_panic()) 00038 #endif 00039 00040 #ifdef __cplusplus 00041 } /* extern "C" */ 00042 #endif 00043 00044 #endif // !defined(NDEBUG) 00045 00046 #endif // __EPOC32__ 00047 00048 #define assert_error_unset(x) assert((!(x) || !*(x)) && "error already set upon entering function") 00049 00050 //#define assert_error_set(x) assert((!(x) || *(x)) && "error not set despite error return of subroutine") 00051 00052 #define assert_error_unset_direct(x) assert(!(x) && "error not set despite error return of subroutine") 00053 00054 // Some compilers might whine about it being statically known that the GError** is non-NULL. This version deals directly with GError*, and naturally makes no such check. 00055 //#define assert_error_set_direct(x) assert((x) && "error not set despite error return of subroutine") 00056 00057 #endif // __ASSERTIONS_H__ 00058 00059 /** 00060 00061 assertions.h 00062 00063 Copyright 2009 Helsinki Institute for Information Technology (HIIT) 00064 and the authors. All rights reserved. 00065 00066 Authors: Tero Hasu <tero.hasu@hut.fi> 00067 00068 Permission is hereby granted, free of charge, to any person 00069 obtaining a copy of this software and associated documentation files 00070 (the "Software"), to deal in the Software without restriction, 00071 including without limitation the rights to use, copy, modify, merge, 00072 publish, distribute, sublicense, and/or sell copies of the Software, 00073 and to permit persons to whom the Software is furnished to do so, 00074 subject to the following conditions: 00075 00076 The above copyright notice and this permission notice shall be 00077 included in all copies or substantial portions of the Software. 00078 00079 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00080 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00081 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00082 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 00083 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 00084 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00085 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00086 SOFTWARE. 00087 00088 **/
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:51 2011 by Doxygen 1.6.1