xtrap.h revision 303975
1279377Simp/* 2279377Simp * Copyright (c) 2000-2001 Proofpoint, Inc. and its suppliers. 3279377Simp * All rights reserved. 4279377Simp * 5279377Simp * By using this file, you agree to the terms and conditions set 6279377Simp * forth in the LICENSE file which can be found at the top level of 7279377Simp * the sendmail distribution. 8279377Simp * 9279377Simp * $Id: xtrap.h,v 1.8 2013-11-22 20:51:32 ca Exp $ 10279377Simp */ 11279377Simp 12279377Simp/* 13279377Simp** scaffolding for testing exception handler code 14279377Simp*/ 15279377Simp 16279377Simp#ifndef SM_XTRAP_H 17279377Simp# define SM_XTRAP_H 18279377Simp 19279377Simp# include <sm/debug.h> 20279377Simp# include <sm/exc.h> 21279377Simp 22279377Simpextern SM_ATOMIC_UINT_T SmXtrapCount; 23279377Simpextern SM_DEBUG_T SmXtrapDebug; 24279377Simpextern SM_DEBUG_T SmXtrapReport; 25279377Simp 26279377Simp# if SM_DEBUG_CHECK 27279377Simp# define sm_xtrap_check() (++SmXtrapCount == sm_debug_level(&SmXtrapDebug)) 28279377Simp# else /* SM_DEBUG_CHECK */ 29279377Simp# define sm_xtrap_check() (0) 30279377Simp# endif /* SM_DEBUG_CHECK */ 31279377Simp 32279377Simp# define sm_xtrap_raise_x(exc) \ 33279377Simp if (sm_xtrap_check()) \ 34279377Simp { \ 35279377Simp sm_exc_raise_x(exc); \ 36279377Simp } else 37279377Simp 38279377Simp#endif /* ! SM_XTRAP_H */ 39279377Simp