00001 /** @file 00002 00003 A brief file description 00004 00005 @section license License 00006 00007 Licensed to the Apache Software Foundation (ASF) under one 00008 or more contributor license agreements. See the NOTICE file 00009 distributed with this work for additional information 00010 regarding copyright ownership. The ASF licenses this file 00011 to you under the Apache License, Version 2.0 (the 00012 "License"); you may not use this file except in compliance 00013 with the License. You may obtain a copy of the License at 00014 00015 http://www.apache.org/licenses/LICENSE-2.0 00016 00017 Unless required by applicable law or agreed to in writing, software 00018 distributed under the License is distributed on an "AS IS" BASIS, 00019 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00020 See the License for the specific language governing permissions and 00021 limitations under the License. 00022 */ 00023 00024 /*************************************************************************** 00025 Assertions 00026 00027 ***************************************************************************/ 00028 #ifndef _INK_ASSERT_H 00029 #define _INK_ASSERT_H 00030 00031 #include "ink_apidefs.h" 00032 #include "ink_error.h" 00033 00034 #ifdef __cplusplus 00035 extern "C" 00036 { 00037 #endif /* __cplusplus */ 00038 00039 /* don't use assert, no really DON'T use assert */ 00040 #undef assert 00041 #define assert __DONT_USE_BARE_assert_USE_ink_assert__ 00042 #undef _ASSERT_H 00043 #define _ASSERT_H 00044 #undef __ASSERT_H__ 00045 #define __ASSERT_H__ 00046 00047 inkcoreapi void _ink_assert(const char *a, const char *f, int l) TS_NORETURN; 00048 00049 #if defined(DEBUG) || defined(__clang_analyzer__) 00050 #define ink_assert(EX) ( \ 00051 (void)(likely(EX) ? (void)0 : _ink_assert(#EX, __FILE__, __LINE__))\ 00052 ) 00053 #else 00054 #define ink_assert(EX) (void)(EX) 00055 #endif 00056 00057 #define ink_release_assert(EX) ( \ 00058 (void)(likely(EX) ? (void)0 : _ink_assert(#EX, __FILE__, __LINE__)) \ 00059 ) 00060 00061 #ifdef __cplusplus 00062 } 00063 #endif /* __cplusplus */ 00064 00065 #endif /*_INK_ASSERT_H*/ 00066 00067 /* workaround a bug in the stupid Sun preprocessor 00068 00069 #undef assert 00070 #define assert __DONT_USE_BARE_assert_USE_ink_assert__ 00071 #define _ASSERT_H 00072 #undef __ASSERT_H__ 00073 #define __ASSERT_H__ 00074 */