Update zoneinfo database.
[dragonfly/netmp.git] / contrib / sendmail / include / sm / assert.h
blob6b8653620c685c4c91967bb20c826368468d00d5
1 /*
2 * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
9 * $Id: assert.h,v 1.10 2001/06/07 20:04:53 ca Exp $
13 ** libsm abnormal program termination and assertion checking
14 ** See libsm/assert.html for documentation.
17 #ifndef SM_ASSERT_H
18 # define SM_ASSERT_H
20 # include <sm/gen.h>
21 # include <sm/debug.h>
24 ** abnormal program termination
27 typedef void (*SM_ABORT_HANDLER_T) __P((const char *, int, const char *));
29 extern SM_DEAD(void
30 sm_abort_at __P((
31 const char *,
32 int,
33 const char *)));
35 extern void
36 sm_abort_sethandler __P((
37 SM_ABORT_HANDLER_T));
39 extern SM_DEAD(void PRINTFLIKE(1, 2)
40 sm_abort __P((
41 char *,
42 ...)));
45 ** assertion checking
48 # ifndef SM_CHECK_ALL
49 # define SM_CHECK_ALL 1
50 # endif /* ! SM_CHECK_ALL */
52 # ifndef SM_CHECK_REQUIRE
53 # define SM_CHECK_REQUIRE SM_CHECK_ALL
54 # endif /* ! SM_CHECK_REQUIRE */
56 # ifndef SM_CHECK_ENSURE
57 # define SM_CHECK_ENSURE SM_CHECK_ALL
58 # endif /* ! SM_CHECK_ENSURE */
60 # ifndef SM_CHECK_ASSERT
61 # define SM_CHECK_ASSERT SM_CHECK_ALL
62 # endif /* ! SM_CHECK_ASSERT */
64 # if SM_CHECK_REQUIRE
65 # if defined(__STDC__) || defined(__cplusplus)
66 # define SM_REQUIRE(cond) \
67 ((void) ((cond) || (sm_abort_at(__FILE__, __LINE__, \
68 "SM_REQUIRE(" #cond ") failed"), 0)))
69 # else /* defined(__STDC__) || defined(__cplusplus) */
70 # define SM_REQUIRE(cond) \
71 ((void) ((cond) || (sm_abort_at(__FILE__, __LINE__, \
72 "SM_REQUIRE(cond) failed"), 0)))
73 # endif /* defined(__STDC__) || defined(__cplusplus) */
74 # else /* SM_CHECK_REQUIRE */
75 # define SM_REQUIRE(cond) ((void) 0)
76 # endif /* SM_CHECK_REQUIRE */
78 # define SM_REQUIRE_ISA(obj, magic) \
79 SM_REQUIRE((obj) != NULL && (obj)->sm_magic == (magic))
81 # if SM_CHECK_ENSURE
82 # if defined(__STDC__) || defined(__cplusplus)
83 # define SM_ENSURE(cond) \
84 ((void) ((cond) || (sm_abort_at(__FILE__, __LINE__, \
85 "SM_ENSURE(" #cond ") failed"), 0)))
86 # else /* defined(__STDC__) || defined(__cplusplus) */
87 # define SM_ENSURE(cond) \
88 ((void) ((cond) || (sm_abort_at(__FILE__, __LINE__, \
89 "SM_ENSURE(cond) failed"), 0)))
90 # endif /* defined(__STDC__) || defined(__cplusplus) */
91 # else /* SM_CHECK_ENSURE */
92 # define SM_ENSURE(cond) ((void) 0)
93 # endif /* SM_CHECK_ENSURE */
95 # if SM_CHECK_ASSERT
96 # if defined(__STDC__) || defined(__cplusplus)
97 # define SM_ASSERT(cond) \
98 ((void) ((cond) || (sm_abort_at(__FILE__, __LINE__, \
99 "SM_ASSERT(" #cond ") failed"), 0)))
100 # else /* defined(__STDC__) || defined(__cplusplus) */
101 # define SM_ASSERT(cond) \
102 ((void) ((cond) || (sm_abort_at(__FILE__, __LINE__, \
103 "SM_ASSERT(cond) failed"), 0)))
104 # endif /* defined(__STDC__) || defined(__cplusplus) */
105 # else /* SM_CHECK_ASSERT */
106 # define SM_ASSERT(cond) ((void) 0)
107 # endif /* SM_CHECK_ASSERT */
109 extern SM_DEBUG_T SmExpensiveRequire;
110 extern SM_DEBUG_T SmExpensiveEnsure;
111 extern SM_DEBUG_T SmExpensiveAssert;
113 #endif /* ! SM_ASSERT_H */