1 /** @file
2 
3   A brief file description
4 
5   @section license License
6 
7   Licensed to the Apache Software Foundation (ASF) under one
8   or more contributor license agreements.  See the NOTICE file
9   distributed with this work for additional information
10   regarding copyright ownership.  The ASF licenses this file
11   to you under the Apache License, Version 2.0 (the
12   "License"); you may not use this file except in compliance
13   with the License.  You may obtain a copy of the License at
14 
15       http://www.apache.org/licenses/LICENSE-2.0
16 
17   Unless required by applicable law or agreed to in writing, software
18   distributed under the License is distributed on an "AS IS" BASIS,
19   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20   See the License for the specific language governing permissions and
21   limitations under the License.
22  */
23 
24 /***************************************************************************
25 Assertions
26 
27 ***************************************************************************/
28 #pragma once
29 
30 #include "tscore/ink_apidefs.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif /* __cplusplus */
35 
36 /* don't use assert, no really DON'T use assert */
37 #undef assert
38 #define assert __DONT_USE_BARE_assert_USE_ink_assert__
39 #undef _ASSERT_H
40 #define _ASSERT_H
41 #undef __ASSERT_H__
42 #define __ASSERT_H__
43 
44 inkcoreapi void _ink_assert(const char *a, const char *f, int l) TS_NORETURN;
45 
46 #if defined(DEBUG) || defined(ENABLE_ALL_ASSERTS) || defined(__clang_analyzer__) || defined(__COVERITY__)
47 #define ink_assert(EX) ((void)(__builtin_expect(!!(EX), 1) ? (void)0 : _ink_assert(#EX, __FILE__, __LINE__)))
48 #else
49 #define ink_assert(EX) (void)(EX)
50 #endif
51 
52 #define ink_release_assert(EX) ((void)(__builtin_expect(!!(EX), 0) ? (void)0 : _ink_assert(#EX, __FILE__, __LINE__)))
53 
54 #ifdef __cplusplus
55 }
56 #endif /* __cplusplus */
57 
58 /* workaround a bug in the  stupid Sun preprocessor
59 
60 #undef assert
61 #define assert __DONT_USE_BARE_assert_USE_ink_assert__
62 #define _ASSERT_H
63 #undef __ASSERT_H__
64 #define __ASSERT_H__
65 */
66