]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Squelch a noreturn warning on AIX. [skip ci]
authorDenis Ovsienko <[email protected]>
Mon, 26 Jul 2021 11:01:00 +0000 (12:01 +0100)
committerDenis Ovsienko <[email protected]>
Mon, 26 Jul 2021 11:01:00 +0000 (12:01 +0100)
GCC 8.3.0 on AIX 7.1 produced a warning for every file that has a call
to nd_trunc_longjmp():

In file included from ./cpack.c:39:
./extract.h: In function 'nd_trunc_longjmp':
./extract.h:586:1: warning: 'noreturn' function does return

As far as longjmp(3) man page and <setjmp.h> header go, longjmp() is as
noreturn in AIX as everywhere else, but not in a way that GCC can tell.

Disabling -Wsuggest-attribute=noreturn and -Wmissing-noreturn had no
apparent effect, so instead of using diag-control.h add an infinite loop
on AIX to squelch the warning.

extract.h

index 2ea7763a6eca381758f38609b3a95fe697c11fa5..510b4a15f4ac5f9c1bca428feac464da53a1dfc4 100644 (file)
--- a/extract.h
+++ b/extract.h
@@ -579,6 +579,14 @@ static inline NORETURN void
 nd_trunc_longjmp(netdissect_options *ndo)
 {
        longjmp(ndo->ndo_early_end, ND_TRUNCATED);
+#ifdef _AIX
+       /*
+        * In AIX <setjmp.h> decorates longjmp() with "#pragma leaves", which tells
+        * XL C that the function is noreturn, but GCC remains unaware of that and
+        * yields a "'noreturn' function does return" warning.
+        */
+       while (1);
+#endif /* _AIX */
 }
 
 /* get_u_1 and get_s_1 */