diff options
author | Maíra Canal <mairacanal@riseup.net> | 2022-07-20 20:57:19 +0200 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2022-07-28 21:06:35 +0200 |
commit | 4c392516accfe51a1aaf80ed163517646f8f0476 (patch) | |
tree | 9b8133ea221055a7aae558e790ae6b0818ffcaed /Documentation/dev-tools | |
parent | Documentation: kunit: Add CLI args for kunit_tool (diff) | |
download | linux-4c392516accfe51a1aaf80ed163517646f8f0476.tar.xz linux-4c392516accfe51a1aaf80ed163517646f8f0476.zip |
Documentation: KUnit: Fix example with compilation error
The Parameterized Testing example contains a compilation error, as the
signature for the description helper function is void(*)(const struct
sha1_test_case *, char *), and the struct is non-const. This is
warned by Clang:
error: initialization of ‘void (*)(struct sha1_test_case *, char *)’
from incompatible pointer type ‘void (*)(const struct sha1_test_case *,
char *)’ [-Werror=incompatible-pointer-types]
33 | KUNIT_ARRAY_PARAM(sha1, cases, case_to_desc);
| ^~~~~~~~~~~~
../include/kunit/test.h:1339:70: note: in definition of macro
‘KUNIT_ARRAY_PARAM’
1339 | void
(*__get_desc)(typeof(__next), char *) = get_desc; \
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Reviewed-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'Documentation/dev-tools')
-rw-r--r-- | Documentation/dev-tools/kunit/usage.rst | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Documentation/dev-tools/kunit/usage.rst b/Documentation/dev-tools/kunit/usage.rst index d62a04255c2e..44158eecb51e 100644 --- a/Documentation/dev-tools/kunit/usage.rst +++ b/Documentation/dev-tools/kunit/usage.rst @@ -505,7 +505,7 @@ By reusing the same ``cases`` array from above, we can write the test as a const char *str; const char *sha1; }; - struct sha1_test_case cases[] = { + const struct sha1_test_case cases[] = { { .str = "hello world", .sha1 = "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed", |