2 * check for the correct signness of a char constant
3 * (signed versus unsigned)
4 * (indirect via integer promotion)
6 * Note, the check for the --funsigned-char must be invoked by hand
7 * see the following emacs sexp
8 * (compile "SDCCFLAGS=--funsigned-char make -C .. ALL_TESTS='./tests/funsigned-char.c'")
9 * (compile "make -C .. ALL_TESTS='./tests/funsigned-char.c'")
17 int glb_schar_to_int
= ~ (signed char) '\200';
18 int glb_uchar_to_int
= ~ (unsigned char) '\200';
19 int glb_char_to_int
= ~ '\200';
21 int tst_schar_to_int() { return ~ (signed char) '\200'; }
22 int tst_uchar_to_int() { return ~ (unsigned char) '\200'; }
23 int tst_char_to_int() { return ~ '\200'; }
30 ASSERT(CHAR_MAX
== 255);
31 ASSERT(CHAR_MIN
== 0);
33 ASSERT(CHAR_MAX
== 127);
34 ASSERT(CHAR_MIN
== -128);
37 ASSERT(tst_uchar_to_int() == -129);
38 ASSERT(glb_uchar_to_int
== -129);
40 ASSERT(tst_schar_to_int() == 127);
41 ASSERT(glb_schar_to_int
== 127);
44 ASSERT(tst_char_to_int() == -129);
45 ASSERT(glb_char_to_int
== -129);
47 ASSERT(tst_char_to_int() == 127);
48 ASSERT(glb_char_to_int
== 127);