Skip to content

Commit 0445d1b

Browse files
committed
lib: assume char is unsigned
Now that we use -funsigned-char, there's no need for this kind of ifdef. Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent 3bc753c commit 0445d1b

File tree

2 files changed

+0
-16
lines changed

2 files changed

+0
-16
lines changed

lib/is_signed_type_kunit.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ static void is_signed_type_test(struct kunit *test)
2121
KUNIT_EXPECT_EQ(test, is_signed_type(bool), false);
2222
KUNIT_EXPECT_EQ(test, is_signed_type(signed char), true);
2323
KUNIT_EXPECT_EQ(test, is_signed_type(unsigned char), false);
24-
#ifdef __CHAR_UNSIGNED__
2524
KUNIT_EXPECT_EQ(test, is_signed_type(char), false);
26-
#else
27-
KUNIT_EXPECT_EQ(test, is_signed_type(char), true);
28-
#endif
2925
KUNIT_EXPECT_EQ(test, is_signed_type(int), true);
3026
KUNIT_EXPECT_EQ(test, is_signed_type(unsigned int), false);
3127
KUNIT_EXPECT_EQ(test, is_signed_type(long), true);

lib/test_printf.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,6 @@ test_number(void)
179179
* behaviour.
180180
*/
181181
test("00|0|0|0|0", "%.2d|%.1d|%.0d|%.*d|%1.0d", 0, 0, 0, 0, 0, 0);
182-
#ifndef __CHAR_UNSIGNED__
183-
{
184-
/*
185-
* Passing a 'char' to a %02x specifier doesn't do
186-
* what was presumably the intention when char is
187-
* signed and the value is negative. One must either &
188-
* with 0xff or cast to u8.
189-
*/
190-
char val = -16;
191-
test("0xfffffff0|0xf0|0xf0", "%#02x|%#02x|%#02x", val, val & 0xff, (u8)val);
192-
}
193-
#endif
194182
}
195183

196184
static void __init

0 commit comments

Comments
 (0)