lib: assume char is unsigned
authorJason A. Donenfeld <Jason@zx2c4.com>
Thu, 3 Nov 2022 00:50:05 +0000 (01:50 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 18 Nov 2022 23:56:15 +0000 (00:56 +0100)
Now that we use -funsigned-char, there's no need for this kind of ifdef.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
lib/is_signed_type_kunit.c
lib/test_printf.c

index 207207522925e4a034126e91ae2595ba41c620c4..0a7f6ae62839cbbbd8c0b3ec898be5443b953750 100644 (file)
@@ -21,11 +21,7 @@ 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);
-#ifdef __CHAR_UNSIGNED__
        KUNIT_EXPECT_EQ(test, is_signed_type(char), false);
-#else
-       KUNIT_EXPECT_EQ(test, is_signed_type(char), true);
-#endif
        KUNIT_EXPECT_EQ(test, is_signed_type(int), true);
        KUNIT_EXPECT_EQ(test, is_signed_type(unsigned int), false);
        KUNIT_EXPECT_EQ(test, is_signed_type(long), true);
index 4bd15a593fbd938c142f6ef9cac80a5f4c3033e0..5eb889679e4faf1e3e477fa59a3805b3e710a368 100644 (file)
@@ -179,18 +179,6 @@ test_number(void)
         * behaviour.
         */
        test("00|0|0|0|0", "%.2d|%.1d|%.0d|%.*d|%1.0d", 0, 0, 0, 0, 0, 0);
-#ifndef __CHAR_UNSIGNED__
-       {
-               /*
-                * Passing a 'char' to a %02x specifier doesn't do
-                * what was presumably the intention when char is
-                * signed and the value is negative. One must either &
-                * with 0xff or cast to u8.
-                */
-               char val = -16;
-               test("0xfffffff0|0xf0|0xf0", "%#02x|%#02x|%#02x", val, val & 0xff, (u8)val);
-       }
-#endif
 }
 
 static void __init