diff options
Diffstat (limited to 'SrcShared/EmAssert.h')
-rw-r--r-- | SrcShared/EmAssert.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/SrcShared/EmAssert.h b/SrcShared/EmAssert.h new file mode 100644 index 0000000..7e62b8d --- /dev/null +++ b/SrcShared/EmAssert.h @@ -0,0 +1,45 @@ +/* -*- mode: C++; tab-width: 4 -*- */ +/* ===================================================================== *\ + Copyright (c) 2001 Palm, Inc. or its subsidiaries. + All rights reserved. + + This file is part of the Palm OS Emulator. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. +\* ===================================================================== */ + +#ifndef EmAssert_h +#define EmAssert_h + +#ifdef __cplusplus +extern "C" +#endif +void MyAssertFailed ( + const char* assertion, + const char* file, + unsigned int line); + +// Use EmAssert to assert only in debug mode. +// Use EmASSERT to assert even in release mode. +// The latter should be used only temporarily to +// find bugs that occur only in release mode. + +#define EmASSERT(expr) \ + ((void) ((expr) ? 0 : \ + (MyAssertFailed (#expr, \ + __FILE__, __LINE__), 0))) + +#ifdef NDEBUG + + #define EmAssert(expr) ((void) 0) + +#else + + #define EmAssert(expr) EmASSERT (expr) + +#endif + +#endif // EmAssert.h |