Mercurial > octave
diff libinterp/corefcn/error.h @ 33243:d9ed1a322311
move global panic functions and macros to separate panic.h and panic.cc files
* panic.h, panic.cc: New files. Move declaration of global panic
functions and macros here from error.h and error.cc.
* libinterp/corefcn/module.mk: Update.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 23 Mar 2024 13:17:02 -0400 |
parents | 5f6d699e88db |
children | 93b856b2d87e |
line wrap: on
line diff
--- a/libinterp/corefcn/error.h Sat Mar 23 13:02:24 2024 -0400 +++ b/libinterp/corefcn/error.h Sat Mar 23 13:17:02 2024 -0400 @@ -35,6 +35,10 @@ #include "unwind-prot.h" #include "oct-map.h" +// Include panic.h here for backward compatibility with previous +// versions of Octave that declared the global panic functions and +// macros here. +#include "panic.h" class octave_value_list; @@ -489,32 +493,6 @@ extern OCTINTERP_API void parse_error_with_id (const char *id, const char *fmt, ...); -OCTAVE_NORETURN -extern OCTINTERP_API void vpanic (const char *fmt, va_list args); - -OCTAVE_FORMAT_PRINTF (1, 2) -OCTAVE_NORETURN -extern OCTINTERP_API void panic (const char *fmt, ...); - -// To allow the __FILE__ and __LINE__ macros to work as expected, the -// panic_impossible, panic_if, panic_unless, error_impossible, error_if, -// and error_unless symbols must be defined as macros. - -#define panic_impossible() \ - ::panic ("impossible state reached in file '%s' at line %d", __FILE__, __LINE__) - -#if defined (NDEBUG) -# define panic_if(cond) -#else -# define panic_if(cond) do { if (cond) panic_impossible (); } while (0) -#endif - -#if defined (NDEBUG) -# define panic_unless(cond) -#else -# define panic_unless(cond) panic_if (! (cond)) -#endif - #define error_impossible() \ ::error ("impossible state reached in file '%s' at line %d", __FILE__, __LINE__)