xref: /netbsd-src/external/gpl3/gdb/dist/gdbsupport/gdb_setjmp.h (revision 5ba1f45f2a09259cc846f20c7c5501604d633c90)
18dffb485Schristos /* Portability wrappers for setjmp and longjmp.
2*5ba1f45fSchristos    Copyright (C) 1986-2024 Free Software Foundation, Inc.
38dffb485Schristos 
48dffb485Schristos    This file is part of GDB.
58dffb485Schristos 
68dffb485Schristos    This program is free software; you can redistribute it and/or modify
78dffb485Schristos    it under the terms of the GNU General Public License as published by
88dffb485Schristos    the Free Software Foundation; either version 3 of the License, or
98dffb485Schristos    (at your option) any later version.
108dffb485Schristos 
118dffb485Schristos    This program is distributed in the hope that it will be useful,
128dffb485Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
138dffb485Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
148dffb485Schristos    GNU General Public License for more details.
158dffb485Schristos 
168dffb485Schristos    You should have received a copy of the GNU General Public License
178dffb485Schristos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
188dffb485Schristos 
198dffb485Schristos #ifndef COMMON_GDB_SETJMP_H
208dffb485Schristos #define COMMON_GDB_SETJMP_H
218dffb485Schristos 
228dffb485Schristos #include <setjmp.h>
238dffb485Schristos 
248dffb485Schristos #ifdef HAVE_SIGSETJMP
258dffb485Schristos #define SIGJMP_BUF		sigjmp_buf
268dffb485Schristos #define SIGSETJMP(buf,val)	sigsetjmp((buf), val)
278dffb485Schristos #define SIGLONGJMP(buf,val)	siglongjmp((buf), (val))
288dffb485Schristos #else
298dffb485Schristos #define SIGJMP_BUF		jmp_buf
308dffb485Schristos /* We ignore val here because that's safer and avoids having to check
318dffb485Schristos    whether _setjmp exists.  */
328dffb485Schristos #define SIGSETJMP(buf,val)	setjmp(buf)
338dffb485Schristos #define SIGLONGJMP(buf,val)	longjmp((buf), (val))
348dffb485Schristos #endif
358dffb485Schristos 
368dffb485Schristos #endif /* COMMON_GDB_SETJMP_H */
37