summaryrefslogtreecommitdiffstats
path: root/Documentation/dev-tools
diff options
context:
space:
mode:
authorDaniel Latypov <dlatypov@google.com>2022-09-30 17:26:37 -0700
committerShuah Khan <skhan@linuxfoundation.org>2022-12-12 14:13:47 -0700
commit697365c086791372945037557f99bc164e2db855 (patch)
treed2eb60b5634c34fed99c391c462c55df97fac34f /Documentation/dev-tools
parent101e32a025da386ba6f6efbfe3e75b6ec5a358aa (diff)
downloadlinux-697365c086791372945037557f99bc164e2db855.tar.bz2
kunit: eliminate KUNIT_INIT_*_ASSERT_STRUCT macros
These macros exist because passing an initializer list to other macros is hard. The goal of these macros is to generate a line like struct $ASSERT_TYPE __assertion = $APPROPRIATE_INITIALIZER; e.g. struct kunit_unary_assertion __assertion = { .condition = "foo()", .expected_true = true }; But the challenge is you can't pass `{.condition=..., .expect_true=...}` as a macro argument, since the comma means you're actually passing two arguments, `{.condition=...` and `.expect_true=....}`. So we'd made custom macros for each different initializer-list shape. But we can work around this with the following generic macro #define KUNIT_INIT_ASSERT(initializers...) { initializers } Note: this has the downside that we have to rename some macros arguments to not conflict with the struct field names (e.g. `expected_true`). It's a bit gross, but probably worth reducing the # of macros. Signed-off-by: Daniel Latypov <dlatypov@google.com> Reviewed-by: David Gow <davidgow@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'Documentation/dev-tools')
0 files changed, 0 insertions, 0 deletions