selftests: filesystems: add missing stddef header
authorAmer Al Shanawany <amer.shanawany@gmail.com>
Mon, 22 Apr 2024 13:16:59 +0000 (15:16 +0200)
committerShuah Khan <skhan@linuxfoundation.org>
Wed, 8 May 2024 22:48:13 +0000 (16:48 -0600)
fix compiler warning and errors when compiling statmount test.

gcc 12.3 (Ubuntu 12.3.0-1ubuntu1~22.04)

statmount_test.c:572:24: warning: implicit declaration of function
‘offsetof’ [-Wimplicit-function-declaration]
  572 | #define str_off(memb) (offsetof(struct statmount, memb) /
sizeof(uint32_t))
      |                        ^~~~~~~~
statmount_test.c:598:51: note: in expansion of macro ‘str_off’
  598 |         test_statmount_string(STATMOUNT_MNT_ROOT,
str_off(mnt_root), "mount root");
      |
^~~~~~~
statmount_test.c:18:1: note: ‘offsetof’ is defined in header
‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
   17 | #include "../../kselftest.h"
  +++ |+#include <stddef.h>

Signed-off-by: Amer Al Shanawany <amer.shanawany@gmail.com>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/filesystems/statmount/statmount_test.c

index 3eafd7da58e2896132ddca1563c7c6c0659813fa..e6d7c4f1c85b50503c90056cae2d537b80710dd0 100644 (file)
@@ -3,6 +3,7 @@
 #define _GNU_SOURCE
 
 #include <assert.h>
+#include <stddef.h>
 #include <stdint.h>
 #include <sched.h>
 #include <fcntl.h>