xref: /freebsd/contrib/sendmail/include/sm/xtrap.h (revision f7c32ed617858bcd22f8d1b03199099d50125721)
1 /*
2  * Copyright (c) 2000-2001 Proofpoint, Inc. and its suppliers.
3  *	All rights reserved.
4  *
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.
8  *
9  *	$Id: xtrap.h,v 1.8 2013-11-22 20:51:32 ca Exp $
10  */
11 
12 /*
13 **  scaffolding for testing exception handler code
14 */
15 
16 #ifndef SM_XTRAP_H
17 # define SM_XTRAP_H
18 
19 # include <sm/debug.h>
20 # include <sm/exc.h>
21 
22 extern SM_ATOMIC_UINT_T SmXtrapCount;
23 extern SM_DEBUG_T SmXtrapDebug;
24 extern SM_DEBUG_T SmXtrapReport;
25 
26 # if SM_DEBUG_CHECK
27 #  define sm_xtrap_check() (++SmXtrapCount == sm_debug_level(&SmXtrapDebug))
28 # else
29 #  define sm_xtrap_check() (0)
30 # endif
31 
32 # define sm_xtrap_raise_x(exc) \
33 		if (sm_xtrap_check()) \
34 		{ \
35 			sm_exc_raise_x(exc); \
36 		} else
37 
38 #endif /* ! SM_XTRAP_H */
39