aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/internal.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-12-20 00:18:06 +0000
committerChristian Grothoff <christian@grothoff.org>2014-12-20 00:18:06 +0000
commitb457435a8845782708575236f2a7e67537330e6f (patch)
tree3d5cc637bbb76c0e632309a1f29bbb315901c1b2 /src/microhttpd/internal.h
parent18b1972b408b9620e497307d7ce33e86bfbb605e (diff)
downloadlibmicrohttpd-b457435a8845782708575236f2a7e67537330e6f.tar.gz
libmicrohttpd-b457435a8845782708575236f2a7e67537330e6f.zip
use __buildin_unreachable() after MHD_PANIC() -- if supported by gcc
Diffstat (limited to 'src/microhttpd/internal.h')
-rw-r--r--src/microhttpd/internal.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 4d80d556..4a729dce 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -75,20 +75,28 @@ extern MHD_PanicCallback mhd_panic;
75 */ 75 */
76extern void *mhd_panic_cls; 76extern void *mhd_panic_cls;
77 77
78/* If we have Clang or gcc >= 4.5, use __buildin_unreachable() */
79#if defined(__clang__) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
80#define BUILTIN_NOT_REACHED __builtin_unreachable()
81#else
82#define BUILTIN_NOT_REACHED
83#endif
84
85
78#if HAVE_MESSAGES 86#if HAVE_MESSAGES
79/** 87/**
80 * Trigger 'panic' action based on fatal errors. 88 * Trigger 'panic' action based on fatal errors.
81 * 89 *
82 * @param msg error message (const char *) 90 * @param msg error message (const char *)
83 */ 91 */
84#define MHD_PANIC(msg) mhd_panic (mhd_panic_cls, __FILE__, __LINE__, msg) 92#define MHD_PANIC(msg) do { mhd_panic (mhd_panic_cls, __FILE__, __LINE__, msg); BUILTIN_NOT_REACHED; } while (0)
85#else 93#else
86/** 94/**
87 * Trigger 'panic' action based on fatal errors. 95 * Trigger 'panic' action based on fatal errors.
88 * 96 *
89 * @param msg error message (const char *) 97 * @param msg error message (const char *)
90 */ 98 */
91#define MHD_PANIC(msg) mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL) 99#define MHD_PANIC(msg) do { mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL); BUILTIN_NOT_REACHED; } while (0)
92#endif 100#endif
93 101
94 102