Created attachment 161091 [details] memcheck-fix-bug472219.c-compile-failure-under-Clang.patch Compiling memcheck/tests/bug472219.c under clang (16.0.0) currently fails with: bug472219.c:14:4: error: call to undeclared function 'ppoll'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] ppoll(fds, 2, &timeout, NULL); ^ bug472219.c:14:4: note: did you mean 'poll'? /usr/include/x86_64-linux-gnu/sys/poll.h:54:12: clang -Winline -Wall -Wshadow -Wno-long-long -g -fno-stack-protector -Wno-format-extra-args -Wno-literal-range -Wno-tautological-constant-out-of-range-compare -Wno-self-assign -Wno-string-plus-int -Wno-uninitialized -Wno-unused-value -m64 -o err_disable2 err_disable2.o note: 'poll' declared here extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout) ^ 1 error generated. Adding the missing _GNU_SOURCE define (patch attached) fixes the issue.
Seeing the same warning (not an error) with gcc 13.2.1: gcc -DHAVE_CONFIG_H -I. -I../.. -I../.. -I../../include -I../../coregrind -I../../include -I../../VEX/pub -I../../VEX/pub -DVGA_amd64=1 -DVGO_linux=1 -DVGP_amd64_linux=1 -DVGPV_amd64_linux_vanilla=1 -DVGA_SEC_x86=1 -DVGP_SEC_amd64_linux=1 -Winline -Wall -Wshadow -Wno-long-long -g -fno-stack-protector -m64 -Wno-uninitialized -MT bug472219-bug472219.o -MD -MP -MF .deps/bug472219-bug472219.Tpo -c -o bug472219-bug472219.o `test -f 'bug472219.c' || echo './'`bug472219.c bug472219.c: In function ‘main’: bug472219.c:14:4: warning: implicit declaration of function ‘ppoll’; did you mean ‘poll’? [-Wimplicit-function-declaration] 14 | ppoll(fds, 2, &timeout, NULL); | ^~~~~ | poll
Bah. "It worked on my machine". STANDARDS The poll() function conforms to IEEE Std 1003.1-2001 ("POSIX.1"). The ppoll() is not specified by POSIX. The POLLRDHUP flag is not specified by POSIX, but is compatible with Linux and illumos.
I should have added that the proposed fix to #define _GNU_SOURCE before the #include <poll.h> works to get rid of the warning.
commit bdd5f0bad19eb9544511a9c40241901d34f16781 (HEAD -> master, origin/master, origin/HEAD) Author: Paul Floyd <pjfloyd@wanadoo.fr> Date: Tue Aug 22 21:35:00 2023 +0200 Bug 473604 - Fix bug472219.c compile failure with Clang 16