GNU libmicrohttpd
1.0.0
Loading...
Searching...
No Matches
mhd_panic.h
Go to the documentation of this file.
1
/*
2
This file is part of libmicrohttpd
3
Copyright (C) 2007-2018 Daniel Pittman and Christian Grothoff
4
Copyright (C) 2014-2022 Evgeny Grin (Karlson2k)
5
6
This library is free software; you can redistribute it and/or
7
modify it under the terms of the GNU Lesser General Public
8
License as published by the Free Software Foundation; either
9
version 2.1 of the License, or (at your option) any later version.
10
11
This library is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
Lesser General Public License for more details.
15
16
You should have received a copy of the GNU Lesser General Public
17
License along with this library; if not, write to the Free Software
18
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
*/
20
29
#ifndef MHD_PANIC_H
30
#define MHD_PANIC_H 1
31
32
#include "
mhd_options.h
"
33
34
#ifdef MHD_PANIC
35
/* Override any possible defined MHD_PANIC macro with proper one */
36
#undef MHD_PANIC
37
#endif
/* MHD_PANIC */
38
39
/* If we have Clang or gcc >= 4.5, use __builtin_unreachable() */
40
#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ > 4) || \
41
(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ >= 5)
42
#define BUILTIN_NOT_REACHED __builtin_unreachable ()
43
#elif defined(_MSC_FULL_VER)
44
#define BUILTIN_NOT_REACHED __assume (0)
45
#else
46
#define BUILTIN_NOT_REACHED
47
#endif
48
49
/* The MHD_PanicCallback type, but without main header. */
53
extern
void
54
(*
mhd_panic
) (
void
*cls,
55
const
char
*file,
56
unsigned
int
line,
57
const
char
*reason);
58
62
extern
void
*
mhd_panic_cls
;
63
64
#ifdef HAVE_MESSAGES
70
#define MHD_PANIC(msg) do { mhd_panic (mhd_panic_cls, __FILE__, __LINE__, msg); \
71
BUILTIN_NOT_REACHED; } while (0)
72
#else
78
#define MHD_PANIC(msg) do { mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL); \
79
BUILTIN_NOT_REACHED; } while (0)
80
#endif
81
82
#endif
/* MHD_PANIC_H */
mhd_options.h
additional automatic macros for MHD_config.h
mhd_panic
void(* mhd_panic)(void *cls, const char *file, unsigned int line, const char *reason)
mhd_panic_cls
void * mhd_panic_cls
Definition
panic.c:36
src
microhttpd
mhd_panic.h
Generated by
1.12.0