[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <481c1c85-3af8-da6f-b532-598a004b102d@acm.org>
Date: Tue, 6 Sep 2022 15:42:39 -0700
From: Bart Van Assche <bvanassche@....org>
To: Rasmus Villemoes <linux@...musvillemoes.dk>,
Kees Cook <keescook@...omium.org>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] testing/selftests: Add tests for the is_signed_type()
macro
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.
Powered by blists - more mailing lists