LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests: filesystems: add missing stddef header
@ 2024-04-17 16:16 Amer Al Shanawany
  2024-04-19 16:45 ` Muhammad Usama Anjum
  0 siblings, 1 reply; 7+ messages in thread
From: Amer Al Shanawany @ 2024-04-17 16:16 UTC (permalink / raw
  To: Shuah Khan, Christian Brauner, Amer Al Shanawany, Miklos Szeredi,
	linux-kselftest, linux-kernel
  Cc: Javier Carrasco

fix compiler warning and errors when compiling statmount test.

Signed-off-by: Amer Al Shanawany <amer.shanawany@gmail.com>
---
 tools/testing/selftests/filesystems/statmount/statmount_test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/filesystems/statmount/statmount_test.c b/tools/testing/selftests/filesystems/statmount/statmount_test.c
index 3eafd7da58e2..e6d7c4f1c85b 100644
--- a/tools/testing/selftests/filesystems/statmount/statmount_test.c
+++ b/tools/testing/selftests/filesystems/statmount/statmount_test.c
@@ -3,6 +3,7 @@
 #define _GNU_SOURCE
 
 #include <assert.h>
+#include <stddef.h>
 #include <stdint.h>
 #include <sched.h>
 #include <fcntl.h>
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] selftests: filesystems: add missing stddef header
  2024-04-17 16:16 [PATCH] selftests: filesystems: add missing stddef header Amer Al Shanawany
@ 2024-04-19 16:45 ` Muhammad Usama Anjum
  2024-04-20 15:56   ` Amer Al Shanawany
  0 siblings, 1 reply; 7+ messages in thread
From: Muhammad Usama Anjum @ 2024-04-19 16:45 UTC (permalink / raw
  To: Amer Al Shanawany, Shuah Khan, Christian Brauner, Miklos Szeredi,
	linux-kselftest, linux-kernel
  Cc: Muhammad Usama Anjum, Javier Carrasco

On 4/17/24 9:16 PM, Amer Al Shanawany wrote:
> fix compiler warning and errors when compiling statmount test.
The error description or the compiler with version is required to reproduce
the error easily. I'm unable to reproduce the error by gcc 12 and clang 17.

> 
> Signed-off-by: Amer Al Shanawany <amer.shanawany@gmail.com>
> ---
>  tools/testing/selftests/filesystems/statmount/statmount_test.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/filesystems/statmount/statmount_test.c b/tools/testing/selftests/filesystems/statmount/statmount_test.c
> index 3eafd7da58e2..e6d7c4f1c85b 100644
> --- a/tools/testing/selftests/filesystems/statmount/statmount_test.c
> +++ b/tools/testing/selftests/filesystems/statmount/statmount_test.c
> @@ -3,6 +3,7 @@
>  #define _GNU_SOURCE
>  
>  #include <assert.h>
> +#include <stddef.h>
>  #include <stdint.h>
>  #include <sched.h>
>  #include <fcntl.h>

-- 
BR,
Muhammad Usama Anjum

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] selftests: filesystems: add missing stddef header
  2024-04-19 16:45 ` Muhammad Usama Anjum
@ 2024-04-20 15:56   ` Amer Al Shanawany
  2024-04-22  5:17     ` Muhammad Usama Anjum
  0 siblings, 1 reply; 7+ messages in thread
From: Amer Al Shanawany @ 2024-04-20 15:56 UTC (permalink / raw
  To: Muhammad Usama Anjum, Shuah Khan, Christian Brauner,
	Miklos Szeredi, linux-kselftest, linux-kernel
  Cc: Javier Carrasco

[-- Attachment #1: Type: text/plain, Size: 1191 bytes --]

On 4/19/24 18:45, Muhammad Usama Anjum wrote:
> On 4/17/24 9:16 PM, Amer Al Shanawany wrote:
>> fix compiler warning and errors when compiling statmount test.
> The error description or the compiler with version is required to reproduce
> the error easily. I'm unable to reproduce the error by gcc 12 and clang 17.
I'm using gcc 12.3 (Ubuntu 12.3.0-1ubuntu1~22.04), for the error please see the attached log file (statmount.txt)
I was wondering if it's worth adding this include to kselftest.h
>>
>> Signed-off-by: Amer Al Shanawany <amer.shanawany@gmail.com>
>> ---
>>  tools/testing/selftests/filesystems/statmount/statmount_test.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/tools/testing/selftests/filesystems/statmount/statmount_test.c b/tools/testing/selftests/filesystems/statmount/statmount_test.c
>> index 3eafd7da58e2..e6d7c4f1c85b 100644
>> --- a/tools/testing/selftests/filesystems/statmount/statmount_test.c
>> +++ b/tools/testing/selftests/filesystems/statmount/statmount_test.c
>> @@ -3,6 +3,7 @@
>>  #define _GNU_SOURCE
>>  
>>  #include <assert.h>
>> +#include <stddef.h>
>>  #include <stdint.h>
>>  #include <sched.h>
>>  #include <fcntl.h>
> 

Thanks

Amer

[-- Attachment #2: statmount.txt --]
[-- Type: text/plain, Size: 6037 bytes --]

gcc (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

make --no-print-directory -C /home/amer/Desktop/linux-next \
-f /home/amer/Desktop/linux-next/Makefile kselftest
set -e; mkdir -p include/generated/uapi/linux/; trap "rm -f include/generated/uapi/linux/.tmp_version.h" EXIT; { 	if [ 0 -gt 255 ]; then echo \#define LINUX_VERSION_CODE 395775; else echo \#define LINUX_VERSION_CODE 395520; fi; echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))'; echo \#define LINUX_VERSION_MAJOR 6; echo \#define LINUX_VERSION_PATCHLEVEL 9; echo \#define LINUX_VERSION_SUBLEVEL 0; } > include/generated/uapi/linux/.tmp_version.h; if [ ! -r include/generated/uapi/linux/version.h ] || ! cmp -s include/generated/uapi/linux/version.h include/generated/uapi/linux/.tmp_version.h; then : '  UPD     include/generated/uapi/linux/version.h'; mv -f include/generated/uapi/linux/.tmp_version.h include/generated/uapi/linux/version.h; fi
make -f ./scripts/Makefile.build obj=scripts/basic
make -f ./scripts/Makefile.build obj=scripts scripts/unifdef
make -f ./scripts/Makefile.asm-generic obj=arch/x86/include/generated/uapi/asm \
generic=include/uapi/asm-generic
make -f ./scripts/Makefile.build obj=arch/x86/entry/syscalls all
make -f ./scripts/Makefile.build obj=arch/x86/tools relocs
make -f ./scripts/Makefile.headersinst obj=include/uapi
make -f ./scripts/Makefile.headersinst obj=arch/x86/include/uapi
make -C ./tools/testing/selftests run_tests
make[3]: Entering directory '/home/amer/Desktop/linux-next/tools/testing/selftests/filesystems/statmount'
gcc -Wall -O2 -g -isystem /home/amer/Desktop/linux-next/usr/include     statmount_test.c  -o /home/amer/Desktop/linux-next/tools/testing/selftests/filesystems/statmount/statmount_test
statmount_test.c: In function ‘main’:
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>
   18 | 
statmount_test.c:572:33: error: expected expression before ‘struct’
  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:572:33: error: expected expression before ‘struct’
  572 | #define str_off(memb) (offsetof(struct statmount, memb) / sizeof(uint32_t))
      |                                 ^~~~~~
statmount_test.c:599:52: note: in expansion of macro ‘str_off’
  599 |         test_statmount_string(STATMOUNT_MNT_POINT, str_off(mnt_point), "mount point");
      |                                                    ^~~~~~~
statmount_test.c:572:33: error: expected expression before ‘struct’
  572 | #define str_off(memb) (offsetof(struct statmount, memb) / sizeof(uint32_t))
      |                                 ^~~~~~
statmount_test.c:600:50: note: in expansion of macro ‘str_off’
  600 |         test_statmount_string(STATMOUNT_FS_TYPE, str_off(fs_type), "fs type");
      |                                                  ^~~~~~~
statmount_test.c:572:33: error: expected expression before ‘struct’
  572 | #define str_off(memb) (offsetof(struct statmount, memb) / sizeof(uint32_t))
      |                                 ^~~~~~
statmount_test.c:601:41: note: in expansion of macro ‘str_off’
  601 |         test_statmount_string(all_mask, str_off(mnt_root), "mount root & all");
      |                                         ^~~~~~~
statmount_test.c:572:33: error: expected expression before ‘struct’
  572 | #define str_off(memb) (offsetof(struct statmount, memb) / sizeof(uint32_t))
      |                                 ^~~~~~
statmount_test.c:602:41: note: in expansion of macro ‘str_off’
  602 |         test_statmount_string(all_mask, str_off(mnt_point), "mount point & all");
      |                                         ^~~~~~~
statmount_test.c:572:33: error: expected expression before ‘struct’
  572 | #define str_off(memb) (offsetof(struct statmount, memb) / sizeof(uint32_t))
      |                                 ^~~~~~
statmount_test.c:603:41: note: in expansion of macro ‘str_off’
  603 |         test_statmount_string(all_mask, str_off(fs_type), "fs type & all");
      |                                         ^~~~~~~
statmount_test.c: In function ‘cleanup_namespace’:
statmount_test.c:127:9: warning: ignoring return value of ‘fchdir’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  127 |         fchdir(orig_root);
      |         ^~~~~~~~~~~~~~~~~
statmount_test.c:128:9: warning: ignoring return value of ‘chroot’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  128 |         chroot(".");
      |         ^~~~~~~~~~~
make[3]: *** [../../lib.mk:203: /home/amer/Desktop/linux-next/tools/testing/selftests/filesystems/statmount/statmount_test] Error 1
make[3]: Leaving directory '/home/amer/Desktop/linux-next/tools/testing/selftests/filesystems/statmount'
make[2]: *** [Makefile:191: all] Error 2
make[1]: *** [/home/amer/Desktop/linux-next/Makefile:1370: kselftest] Error 2
make: *** [Makefile:240: __sub-make] Error 2

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] selftests: filesystems: add missing stddef header
  2024-04-20 15:56   ` Amer Al Shanawany
@ 2024-04-22  5:17     ` Muhammad Usama Anjum
  2024-04-22 13:16       ` [PATCH v2] " Amer Al Shanawany
  0 siblings, 1 reply; 7+ messages in thread
From: Muhammad Usama Anjum @ 2024-04-22  5:17 UTC (permalink / raw
  To: Amer Al Shanawany, Shuah Khan, Christian Brauner, Miklos Szeredi,
	linux-kselftest, linux-kernel
  Cc: Muhammad Usama Anjum, Javier Carrasco

On 4/20/24 8:56 PM, Amer Al Shanawany wrote:
> On 4/19/24 18:45, Muhammad Usama Anjum wrote:
>> On 4/17/24 9:16 PM, Amer Al Shanawany wrote:
>>> fix compiler warning and errors when compiling statmount test.
Following can be added to the description:

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>
   18 |

>> The error description or the compiler with version is required to reproduce
>> the error easily. I'm unable to reproduce the error by gcc 12 and clang 17.
> I'm using gcc 12.3 (Ubuntu 12.3.0-1ubuntu1~22.04), for the error please see the attached log file (statmount.txt)
> I was wondering if it's worth adding this include to kselftest.h
>>>
>>> Signed-off-by: Amer Al Shanawany <amer.shanawany@gmail.com>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>

>>> ---
>>>  tools/testing/selftests/filesystems/statmount/statmount_test.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/tools/testing/selftests/filesystems/statmount/statmount_test.c b/tools/testing/selftests/filesystems/statmount/statmount_test.c
>>> index 3eafd7da58e2..e6d7c4f1c85b 100644
>>> --- a/tools/testing/selftests/filesystems/statmount/statmount_test.c
>>> +++ b/tools/testing/selftests/filesystems/statmount/statmount_test.c
>>> @@ -3,6 +3,7 @@
>>>  #define _GNU_SOURCE
>>>  
>>>  #include <assert.h>
>>> +#include <stddef.h>
>>>  #include <stdint.h>
>>>  #include <sched.h>
>>>  #include <fcntl.h>
>>
> 
> Thanks
> 
> Amer

-- 
BR,
Muhammad Usama Anjum

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] selftests: filesystems: add missing stddef header
  2024-04-22  5:17     ` Muhammad Usama Anjum
@ 2024-04-22 13:16       ` Amer Al Shanawany
  2024-04-22 13:49         ` Muhammad Usama Anjum
  0 siblings, 1 reply; 7+ messages in thread
From: Amer Al Shanawany @ 2024-04-22 13:16 UTC (permalink / raw
  To: Muhammad Usama Anjum, Shuah Khan, Christian Brauner,
	Miklos Szeredi, linux-kselftest, linux-kernel
  Cc: Javier Carrasco

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>
---
V1 -> V2 added compiler warning in the patch message

 tools/testing/selftests/filesystems/statmount/statmount_test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/filesystems/statmount/statmount_test.c b/tools/testing/selftests/filesystems/statmount/statmount_test.c
index 3eafd7da58e2..e6d7c4f1c85b 100644
--- a/tools/testing/selftests/filesystems/statmount/statmount_test.c
+++ b/tools/testing/selftests/filesystems/statmount/statmount_test.c
@@ -3,6 +3,7 @@
 #define _GNU_SOURCE
 
 #include <assert.h>
+#include <stddef.h>
 #include <stdint.h>
 #include <sched.h>
 #include <fcntl.h>
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] selftests: filesystems: add missing stddef header
  2024-04-22 13:16       ` [PATCH v2] " Amer Al Shanawany
@ 2024-04-22 13:49         ` Muhammad Usama Anjum
  2024-05-04 17:20           ` Amer Al Shanawany
  0 siblings, 1 reply; 7+ messages in thread
From: Muhammad Usama Anjum @ 2024-04-22 13:49 UTC (permalink / raw
  To: Amer Al Shanawany, Shuah Khan, Christian Brauner, Miklos Szeredi,
	linux-kselftest, linux-kernel
  Cc: Muhammad Usama Anjum, Javier Carrasco

On 4/22/24 6:16 PM, Amer Al Shanawany wrote:
> 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>
You missed the reviewed-by tag from previous iteration. Putting it here again:

Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>

> ---
> V1 -> V2 added compiler warning in the patch message
> 
>  tools/testing/selftests/filesystems/statmount/statmount_test.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/filesystems/statmount/statmount_test.c b/tools/testing/selftests/filesystems/statmount/statmount_test.c
> index 3eafd7da58e2..e6d7c4f1c85b 100644
> --- a/tools/testing/selftests/filesystems/statmount/statmount_test.c
> +++ b/tools/testing/selftests/filesystems/statmount/statmount_test.c
> @@ -3,6 +3,7 @@
>  #define _GNU_SOURCE
>  
>  #include <assert.h>
> +#include <stddef.h>
>  #include <stdint.h>
>  #include <sched.h>
>  #include <fcntl.h>

-- 
BR,
Muhammad Usama Anjum

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] selftests: filesystems: add missing stddef header
  2024-04-22 13:49         ` Muhammad Usama Anjum
@ 2024-05-04 17:20           ` Amer Al Shanawany
  0 siblings, 0 replies; 7+ messages in thread
From: Amer Al Shanawany @ 2024-05-04 17:20 UTC (permalink / raw
  To: Muhammad Usama Anjum, Shuah Khan, Christian Brauner,
	Miklos Szeredi, linux-kselftest, linux-kernel
  Cc: Javier Carrasco

On 4/22/24 15:49, Muhammad Usama Anjum wrote:
> On 4/22/24 6:16 PM, Amer Al Shanawany wrote:
>> 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>
> You missed the reviewed-by tag from previous iteration. Putting it here again:
>
> Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>
>> ---
>> V1 -> V2 added compiler warning in the patch message
>>
>>  tools/testing/selftests/filesystems/statmount/statmount_test.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/tools/testing/selftests/filesystems/statmount/statmount_test.c b/tools/testing/selftests/filesystems/statmount/statmount_test.c
>> index 3eafd7da58e2..e6d7c4f1c85b 100644
>> --- a/tools/testing/selftests/filesystems/statmount/statmount_test.c
>> +++ b/tools/testing/selftests/filesystems/statmount/statmount_test.c
>> @@ -3,6 +3,7 @@
>>  #define _GNU_SOURCE
>>  
>>  #include <assert.h>
>> +#include <stddef.h>
>>  #include <stdint.h>
>>  #include <sched.h>
>>  #include <fcntl.h>
Hi,

Could you please consider this patch?

Thank you

Amer

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-05-04 17:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-17 16:16 [PATCH] selftests: filesystems: add missing stddef header Amer Al Shanawany
2024-04-19 16:45 ` Muhammad Usama Anjum
2024-04-20 15:56   ` Amer Al Shanawany
2024-04-22  5:17     ` Muhammad Usama Anjum
2024-04-22 13:16       ` [PATCH v2] " Amer Al Shanawany
2024-04-22 13:49         ` Muhammad Usama Anjum
2024-05-04 17:20           ` Amer Al Shanawany

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).