* [PATCH] kselftest/kselftest_harness.h: do not redefine ARRAY_SIZE
@ 2021-06-25 22:49 Peter Oskolkov
2021-06-30 22:38 ` Shuah Khan
0 siblings, 1 reply; 2+ messages in thread
From: Peter Oskolkov @ 2021-06-25 22:49 UTC (permalink / raw)
To: Peter Oskolkov, Peter Oskolkov, linux-kselftest, Shuah Khan, Shuah Khan
Macro ARRAY_SIZE is defined in tools/include/linux/kernel.h, so
if both headers are included there is a warning.
Signed-off-by: Peter Oskolkov <posk@google.com>
---
tools/testing/selftests/kselftest_harness.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
index ae0f0f33b2a6..75164e23f036 100644
--- a/tools/testing/selftests/kselftest_harness.h
+++ b/tools/testing/selftests/kselftest_harness.h
@@ -671,7 +671,9 @@
#define EXPECT_STRNE(expected, seen) \
__EXPECT_STR(expected, seen, !=, 0)
+#ifndef ARRAY_SIZE
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+#endif
/* Support an optional handler after and ASSERT_* or EXPECT_*. The approach is
* not thread-safe, but it should be fine in most sane test scenarios.
--
2.32.0.93.g670b81a890-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] kselftest/kselftest_harness.h: do not redefine ARRAY_SIZE
2021-06-25 22:49 [PATCH] kselftest/kselftest_harness.h: do not redefine ARRAY_SIZE Peter Oskolkov
@ 2021-06-30 22:38 ` Shuah Khan
0 siblings, 0 replies; 2+ messages in thread
From: Shuah Khan @ 2021-06-30 22:38 UTC (permalink / raw)
To: Peter Oskolkov, Peter Oskolkov, linux-kselftest, Shuah Khan; +Cc: Shuah Khan
On 6/25/21 4:49 PM, Peter Oskolkov wrote:
> Macro ARRAY_SIZE is defined in tools/include/linux/kernel.h, so
> if both headers are included there is a warning.
>
> Signed-off-by: Peter Oskolkov <posk@google.com>
> ---
> tools/testing/selftests/kselftest_harness.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
> index ae0f0f33b2a6..75164e23f036 100644
> --- a/tools/testing/selftests/kselftest_harness.h
> +++ b/tools/testing/selftests/kselftest_harness.h
> @@ -671,7 +671,9 @@
> #define EXPECT_STRNE(expected, seen) \
> __EXPECT_STR(expected, seen, !=, 0)
>
> +#ifndef ARRAY_SIZE
> #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
> +#endif
>
> /* Support an optional handler after and ASSERT_* or EXPECT_*. The approach is
> * not thread-safe, but it should be fine in most sane test scenarios.
>
Thank you for the patch. This will be queued for rc2 after the merge
window closes.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-30 22:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-25 22:49 [PATCH] kselftest/kselftest_harness.h: do not redefine ARRAY_SIZE Peter Oskolkov
2021-06-30 22:38 ` Shuah Khan
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 NNTP newsgroup(s).