xref: /netbsd-src/external/gpl3/gdb/dist/gdbsupport/cleanups.h (revision 5ba1f45f2a09259cc846f20c7c5501604d633c90)
18dffb485Schristos /* Cleanups.
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_CLEANUPS_H
208dffb485Schristos #define COMMON_CLEANUPS_H
218dffb485Schristos 
22*5ba1f45fSchristos #include <functional>
238dffb485Schristos 
24*5ba1f45fSchristos /* Register a function that will be called on exit.  */
25*5ba1f45fSchristos extern void add_final_cleanup (std::function<void ()> &&func);
268dffb485Schristos 
27*5ba1f45fSchristos /* Run all the registered functions.  */
288dffb485Schristos extern void do_final_cleanups ();
298dffb485Schristos 
308dffb485Schristos #endif /* COMMON_CLEANUPS_H */
31