selftests/coredump: drop unused <linux/fs.h> include
PATCH 1/2 selftests/coredump: drop unused <linux/fs.h> include
<linux/fs.h> pulls in <linux/mount.h>, which defines the MS_* flags as macros. <sys/mount.h> declares the same flags as enum constants, so having <linux/fs.h> earlier in the file makes the macros expand inside the enum declaration and the build fails:
/usr/include/x86_64-linux-gnu/sys/mount.h:35:3:
error: expected identifier before numeric constant
The include is not used by this test. Drop it.
Seen with glibc 2.35 on Ubuntu 22.04.
--- tools/testing/selftests/coredump/stackdump_test.c | 1 - 1 file changed, 1 deletion(-)
tools/testing/selftests/coredump/stackdump_test.c +0 -1
@@ -6,7 +6,6 @@#include <libgen.h> #include <limits.h> #include <linux/coredump.h> -#include <linux/fs.h> #include <linux/limits.h> #include <pthread.h> #include <string.h>
Signature · 1 line
2.34.1
PATCH 2/2 selftests/coredump: include <stddef.h> for offsetof
Both files use offsetof() without including <stddef.h>. offsetof() is a macro; without the header it is not expanded, so its first argument is parsed as a function argument and the type name fails to compile:
coredump_test_helpers.c:1309:26:
error: expected expression before struct
Include <stddef.h> in the two files that use offsetof().
--- tools/testing/selftests/coredump/coredump_socket_test.c | 1 + tools/testing/selftests/coredump/coredump_test_helpers.c | 1 + 2 files changed, 2 insertions(+)
tools/testing/selftests/coredump/coredump_socket_test.c +1 -0
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0 +#include <stddef.h> #include <sys/stat.h> #include <sys/epoll.h> #include <sys/socket.h>
tools/testing/selftests/coredump/coredump_test_helpers.c +1 -0
@@ -15,6 +15,7 @@#include <poll.h> #include <pthread.h> #include <stdbool.h> +#include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <string.h>
Signature · 1 line
2.34.1