From: David Gow Date: Thu, 13 May 2021 19:31:55 +0000 (-0700) Subject: kunit: Do not typecheck binary assertions X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=6e62dfa6d14f8fd2b07ad30b8a1c597d40d36ac1;p=linux.git kunit: Do not typecheck binary assertions The use of typecheck() in KUNIT_EXPECT_EQ() and friends is causing more problems than I think it's worth. Things like enums need to have their values explicitly cast, and literals all need to be very precisely typed, else a large warning will be printed. While typechecking does have its uses, the additional overhead of having lots of needless casts -- combined with the awkward error messages which don't mention which types are involved -- makes tests less readable and more difficult to write. By removing the typecheck() call, the two arguments still need to be of compatible types, but don't need to be of exactly the same time, which seems a less confusing and more useful compromise. Signed-off-by: David Gow Reviewed-by: Daniel Latypov Reviewed-by: Brendan Higgins Signed-off-by: Shuah Khan --- diff --git a/include/kunit/test.h b/include/kunit/test.h index 49601c4b98b85..4c56ffcb7403e 100644 --- a/include/kunit/test.h +++ b/include/kunit/test.h @@ -775,7 +775,6 @@ void kunit_do_assertion(struct kunit *test, do { \ typeof(left) __left = (left); \ typeof(right) __right = (right); \ - ((void)__typecheck(__left, __right)); \ \ KUNIT_ASSERTION(test, \ __left op __right, \