diff mbox series

[4/4] kunit: declare kunit_assert structs as const

Message ID 20221001002638.2881842-5-dlatypov@google.com (mailing list archive)
State Accepted
Commit c1144e01063e67f807517a393b91fae054929dc8
Delegated to: Brendan Higgins
Headers show
Series kunit: more assertion reworking | expand

Commit Message

Daniel Latypov Oct. 1, 2022, 12:26 a.m. UTC
Everywhere we use the assert structs now takes them via const*, as of
commit 7466886b400b ("kunit: take `kunit_assert` as `const`").

So now let's properly declare the structs as const as well.

Signed-off-by: Daniel Latypov <dlatypov@google.com>
---
 include/kunit/test.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Gow Oct. 1, 2022, 3:26 a.m. UTC | #1
On Sat, Oct 1, 2022 at 8:26 AM 'Daniel Latypov' via KUnit Development
<kunit-dev@googlegroups.com> wrote:
>
> Everywhere we use the assert structs now takes them via const*, as of
> commit 7466886b400b ("kunit: take `kunit_assert` as `const`").
>
> So now let's properly declare the structs as const as well.
>
> Signed-off-by: Daniel Latypov <dlatypov@google.com>
> ---

Thanks!

Reviewed-by: David Gow <davidgow@google.com>

Cheers,
-- David


>  include/kunit/test.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/kunit/test.h b/include/kunit/test.h
> index e49348bbc6ee..d574c871dd9f 100644
> --- a/include/kunit/test.h
> +++ b/include/kunit/test.h
> @@ -477,7 +477,7 @@ void kunit_do_failed_assertion(struct kunit *test,
>
>  #define _KUNIT_FAILED(test, assert_type, assert_class, assert_format, INITIALIZER, fmt, ...) do { \
>         static const struct kunit_loc __loc = KUNIT_CURRENT_LOC;               \
> -       struct assert_class __assertion = INITIALIZER;                         \
> +       const struct assert_class __assertion = INITIALIZER;                   \
>         kunit_do_failed_assertion(test,                                        \
>                                   &__loc,                                      \
>                                   assert_type,                                 \
> --
> 2.38.0.rc1.362.ged0d419d3c-goog
>
> --
> You received this message because you are subscribed to the Google Groups "KUnit Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kunit-dev+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/kunit-dev/20221001002638.2881842-5-dlatypov%40google.com.
Miguel Ojeda Oct. 1, 2022, 10:06 a.m. UTC | #2
On Sat, Oct 1, 2022 at 2:26 AM Daniel Latypov <dlatypov@google.com> wrote:
>
> Everywhere we use the assert structs now takes them via const*, as of
> commit 7466886b400b ("kunit: take `kunit_assert` as `const`").
>
> So now let's properly declare the structs as const as well.

Always good to be `const`-correct :)

Reviewed-by: Miguel Ojeda <ojeda@kernel.org>

Cheers,
Miguel
diff mbox series

Patch

diff --git a/include/kunit/test.h b/include/kunit/test.h
index e49348bbc6ee..d574c871dd9f 100644
--- a/include/kunit/test.h
+++ b/include/kunit/test.h
@@ -477,7 +477,7 @@  void kunit_do_failed_assertion(struct kunit *test,
 
 #define _KUNIT_FAILED(test, assert_type, assert_class, assert_format, INITIALIZER, fmt, ...) do { \
 	static const struct kunit_loc __loc = KUNIT_CURRENT_LOC;	       \
-	struct assert_class __assertion = INITIALIZER;			       \
+	const struct assert_class __assertion = INITIALIZER;		       \
 	kunit_do_failed_assertion(test,					       \
 				  &__loc,				       \
 				  assert_type,				       \