From fc66711ad5b92067c758c807ac6210f808050767 Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Tue, 25 Jan 2022 19:25:38 +0300 Subject: Moved mhd_panic() and helpers to separate .c/.h files --- src/microhttpd/internal.h | 45 ++------------------------------------------- 1 file changed, 2 insertions(+), 43 deletions(-) (limited to 'src/microhttpd/internal.h') diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h index 3c1a889d..277510d8 100644 --- a/src/microhttpd/internal.h +++ b/src/microhttpd/internal.h @@ -53,28 +53,8 @@ #define PRIu64 "llu" #endif /* ! PRIu64 */ -#ifdef MHD_PANIC -/* Override any defined MHD_PANIC macro with proper one */ -#undef MHD_PANIC -#endif /* MHD_PANIC */ - -#ifdef HAVE_MESSAGES -/** - * Trigger 'panic' action based on fatal errors. - * - * @param msg error message (const char *) - */ -#define MHD_PANIC(msg) do { mhd_panic (mhd_panic_cls, __FILE__, __LINE__, msg); \ - BUILTIN_NOT_REACHED; } while (0) -#else -/** - * Trigger 'panic' action based on fatal errors. - * - * @param msg error message (const char *) - */ -#define MHD_PANIC(msg) do { mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL); \ - BUILTIN_NOT_REACHED; } while (0) -#endif +/* Must be included before other internal headers! */ +#include "mhd_panic.h" #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) #include "mhd_threads.h" @@ -147,27 +127,6 @@ */ #define MHD_BUF_INC_SIZE 1024 - -/** - * Handler for fatal errors. - */ -extern MHD_PanicCallback mhd_panic; - -/** - * Closure argument for "mhd_panic". - */ -extern void *mhd_panic_cls; - -/* If we have Clang or gcc >= 4.5, use __builtin_unreachable() */ -#if defined(__clang__) || (__GNUC__ > 4) || \ - (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) -#define BUILTIN_NOT_REACHED __builtin_unreachable () -#elif defined(_MSC_FULL_VER) -#define BUILTIN_NOT_REACHED __assume (0) -#else -#define BUILTIN_NOT_REACHED -#endif - #ifndef MHD_STATICSTR_LEN_ /** * Determine length of static string / macro strings at compile time. -- cgit v1.2.3