ports/devel/libevent/files/patch-gcc7
Jan Beich a9425224f1 devel/libevent2: drop historical suffix after r362796
PR:		216777
Approved by:	mm (maintainer)
2017-02-20 02:57:04 +00:00

83 lines
2.5 KiB
Text

Fix -Werror=implicit-fallthrough (fixes gcc-7)
https://github.com/libevent/libevent/commit/94e7dcebc320
https://github.com/libevent/libevent/commit/ffbce578c40a
--- bufferevent_filter.c.orig 2017-01-25 23:37:15 UTC
+++ bufferevent_filter.c
@@ -612,9 +612,12 @@ be_filter_ctrl(struct bufferevent *bev,
bevf->underlying->be_ops->ctrl) {
return (bevf->underlying->be_ops->ctrl)(bevf->underlying, op, data);
}
+ EVUTIL_FALLTHROUGH;
case BEV_CTRL_GET_FD:
+ EVUTIL_FALLTHROUGH;
case BEV_CTRL_CANCEL_ALL:
+ EVUTIL_FALLTHROUGH;
default:
return -1;
}
--- evdns.c.orig 2017-01-25 23:37:15 UTC
+++ evdns.c
@@ -2265,10 +2265,11 @@ evdns_request_transmit(struct request *r
nameserver_write_waiting(req->ns, 1);
return 1;
case 2:
- /* failed to transmit the request entirely. */
+ /* failed to transmit the request entirely. we can fallthrough since
+ * we'll set a timeout, which will time out, and make us retransmit the
+ * request anyway. */
retcode = 1;
- /* fall through: we'll set a timeout, which will time out,
- * and make us retransmit the request anyway. */
+ EVUTIL_FALLTHROUGH;
default:
/* all ok */
log(EVDNS_LOG_DEBUG,
--- event.c.orig 2017-01-25 23:37:15 UTC
+++ event.c
@@ -2960,6 +2960,7 @@ event_callback_activate_nolock_(struct e
switch (evcb->evcb_flags & (EVLIST_ACTIVE|EVLIST_ACTIVE_LATER)) {
default:
EVUTIL_ASSERT(0);
+ EVUTIL_FALLTHROUGH;
case EVLIST_ACTIVE_LATER:
event_queue_remove_active_later(base, evcb);
r = 0;
--- util-internal.h.orig 2017-01-25 23:37:15 UTC
+++ util-internal.h
@@ -50,6 +50,20 @@
extern "C" {
#endif
+/* __has_attribute() wrapper */
+#ifdef __has_attribute
+#define EVUTIL_HAS_ATTRIBUTE __has_attribute
+#endif
+/** clang 3 __has_attribute misbehaves in some versions */
+#if defined(__clang__) && \
+ __clang__ == 1 && __clang_major__ == 3 && \
+ (__clang_minor__ >= 2 && __clang_minor__ <= 5)
+#undef EVUTIL_HAS_ATTRIBUTE
+#endif
+#ifndef EVUTIL_HAS_ATTRIBUTE
+#define EVUTIL_HAS_ATTRIBUTE(x) 0
+#endif
+
/* If we need magic to say "inline", get it for free internally. */
#ifdef EVENT__inline
#define inline EVENT__inline
@@ -308,6 +322,12 @@ ev_int32_t evutil_weakrand_range_(struct
#define EVUTIL_UNLIKELY(p) (p)
#endif
+#if EVUTIL_HAS_ATTRIBUTE(fallthrough)
+#define EVUTIL_FALLTHROUGH __attribute__((fallthrough))
+#else
+#define EVUTIL_FALLTHROUGH /* fallthrough */
+#endif
+
/* Replacement for assert() that calls event_errx on failure. */
#ifdef NDEBUG
#define EVUTIL_ASSERT(cond) EVUTIL_NIL_CONDITION_(cond)