From: Bart Van Assche <bvanassche@acm.org>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Kees Cook <keescook@chromium.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] testing/selftests: Add tests for the is_signed_type() macro
Date: Tue, 6 Sep 2022 15:42:39 -0700 [thread overview]
Message-ID: <481c1c85-3af8-da6f-b532-598a004b102d@acm.org> (raw)
In-Reply-To: <d2399574-ec64-7765-b6ef-1e792a7e0d5c@rasmusvillemoes.dk>
On 8/30/22 02:41, Rasmus Villemoes wrote:
> On 26/08/2022 18.21, Bart Van Assche wrote:
>> Although not documented, is_signed_type() must support the 'bool' and
>> pointer types next to scalar and enumeration types. Add a selftest that
>> verifies that this macro handles all supported types correctly.
>>
>
>> +static void is_signed_type_test(struct kunit *test)
>> +{
>> + KUNIT_EXPECT_EQ(test, is_signed_type(bool), false);
>> + KUNIT_EXPECT_EQ(test, is_signed_type(signed char), true);
>> + KUNIT_EXPECT_EQ(test, is_signed_type(unsigned char), false);
>
> Nice. You could consider adding
>
> #ifdef __UNSIGNED_CHAR__
> KUNIT_EXPECT_EQ(test, is_signed_type(char), false);
> #else
> KUNIT_EXPECT_EQ(test, is_signed_type(char), true);
> #endif
>
> The kernel depends on the compiler providing __UNSIGNED_CHAR__ in two
> places (one in ext4, one in printf test suite).
(reduced Cc-list)
Hi Rasmus,
Since I would like to implement the above suggestion I tried to look up
other uses of the __UNSIGNED_CHAR__ macro. However, I couldn't find any.
Did I perhaps do something wrong?
$ git grep -w __UNSIGNED_CHAR__ origin/master | wc
0 0 0
Thanks,
Bart.
next prev parent reply other threads:[~2022-09-06 22:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-26 16:21 [PATCH 0/2] Define is_signed_type() once Bart Van Assche
2022-08-26 16:21 ` [PATCH 1/2] testing/selftests: Add tests for the is_signed_type() macro Bart Van Assche
2022-08-29 19:30 ` Kees Cook
2022-08-30 2:33 ` Isabella Basso
2022-08-30 3:30 ` Bart Van Assche
2022-08-31 17:53 ` Kees Cook
2022-08-30 9:41 ` Rasmus Villemoes
2022-09-06 22:42 ` Bart Van Assche [this message]
2022-09-06 22:48 ` Rasmus Villemoes
2022-08-26 16:21 ` [PATCH 2/2] overflow, tracing: Define the is_signed_type() macro once Bart Van Assche
2022-08-29 19:30 ` Kees Cook
2022-08-29 19:36 ` [PATCH 0/2] Define is_signed_type() once Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=481c1c85-3af8-da6f-b532-598a004b102d@acm.org \
--to=bvanassche@acm.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®