]> git.baikalelectronics.ru Git - kernel.git/commit
Documentation: KUnit: Fix example with compilation error
authorMaíra Canal <mairacanal@riseup.net>
Wed, 20 Jul 2022 18:57:19 +0000 (15:57 -0300)
committerShuah Khan <skhan@linuxfoundation.org>
Thu, 28 Jul 2022 19:06:35 +0000 (13:06 -0600)
commit8a76e8abf0bbdda518d631be21fe71babdd50634
tree9b8133ea221055a7aae558e790ae6b0818ffcaed
parentf6ab5fa89c0ed7217091c0c205a2dd0ef5121c4c
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>
Documentation/dev-tools/kunit/usage.rst