aboutsummaryrefslogtreecommitdiff
path: root/diag-control.h
diff options
context:
space:
mode:
authorDenis Ovsienko <denis@ovsienko.info>2021-08-06 23:37:23 +0100
committerDenis Ovsienko <denis@ovsienko.info>2021-08-06 23:37:23 +0100
commit2da4f30307287acca1ae7af969f883a12d423bea (patch)
tree09217575d5043920be06eaa0bb967a9cf8d3abf1 /diag-control.h
parentbc2cd46de5140ac70ba679173d682896913d6644 (diff)
Use __builtin_unreachable(). [skip ci]
Refine the changes made in commit 3f35396 and use a macro with comments.
Diffstat (limited to 'diag-control.h')
-rw-r--r--diag-control.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/diag-control.h b/diag-control.h
index c1ec5acd..d1622aa6 100644
--- a/diag-control.h
+++ b/diag-control.h
@@ -316,4 +316,20 @@
#endif
#endif
+/*
+ * GCC needs this on AIX for longjmp().
+ */
+#if PCAP_IS_AT_LEAST_GNUC_VERSION(5,1)
+ /*
+ * Beware that the effect of this builtin is more than just squelching the
+ * warning! GCC trusts it enough for the process to segfault if the control
+ * flow reaches the builtin (an infinite empty loop in the same context would
+ * squelch the warning and ruin the process too, albeit in a different way).
+ * So please remember to use this very carefully.
+ */
+ #define PCAP_UNREACHABLE __builtin_unreachable();
+#else
+ #define PCAP_UNREACHABLE
+#endif
+
#endif /* _diag_control_h */