fix compiler warning and errors when compiling statmount test.
Signed-off-by: Amer Al Shanawany <[email protected]>
---
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
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 <[email protected]>
> ---
> 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
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 <[email protected]>
>> ---
>> 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
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 <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
>>> ---
>>> 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
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 <[email protected]>
---
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
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 <[email protected]>
You missed the reviewed-by tag from previous iteration. Putting it here again:
Reviewed-by: Muhammad Usama Anjum <[email protected]>
> ---
> 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
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 <[email protected]>
> You missed the reviewed-by tag from previous iteration. Putting it here again:
>
> Reviewed-by: Muhammad Usama Anjum <[email protected]>
>
>> ---
>> 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