gcc 12 complains:
[34/46] Building C object CMakeFiles/event_static.dir/event.c.o
/src/le/libevent/event.c: In function ‘event_signal_closure’:
/src/le/libevent/event.c:1384:32: warning: storing the address of local variable ‘ncalls’ in ‘*ev.ev_.ev_signal.ev_pncalls’ [-Wdangling-pointer=]
1384 | ev->ev_pncalls = &ncalls;
| ~~~~~~~~~~~~~~~^~~~~~~~~
/src/le/libevent/event.c:1378:15: note: ‘ncalls’ declared here
1378 | short ncalls;
| ^~~~~~
/src/le/libevent/event.c:1378:15: note: ‘ev’ declared here
static inline void
event_signal_closure(struct event_base *base, struct event *ev)
{
+#if defined(__clang__)
+#elif defined(__GNUC__)
+#pragma GCC diagnostic push
+/* NOTE: it is better to avoid such code all together, by using separate
+ * variable to break the loop in the event structure, but now this code is safe
+ * */
+#pragma GCC diagnostic ignored "-Wdangling-pointer"
+#endif
+
short ncalls;
int should_break;
return;
}
}
+
+#if defined(__clang__)
+#elif defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
}
/* Common timeouts are special timeouts that are handled as queues rather than