software/bios/readline: Fix warnings if char is signed

When building with --cpu-type=mor1kx:

    litex/soc/software/bios/readline.c: In function 'readline':
    litex/soc/software/bios/readline.c:271:3: warning: case label value exceeds maximum value for type [-Wswitch-outside-range]
      271 |   case KEY_END:
	  |   ^~~~
    litex/soc/software/bios/readline.c:297:3: warning: case label value exceeds maximum value for type [-Wswitch-outside-range]
      297 |   case KEY_DEL:
	  |   ^~~~
    litex/soc/software/bios/readline.c:281:3: warning: case label value exceeds maximum value for type [-Wswitch-outside-range]
      281 |   case DEL:
	  |   ^~~~

The C standard does not specify the signedness of "char", hence this
depends on the implementation.  On e.g. RISC-V, "char" is unsigned, but
on OpenRISC, it is signed.

Fix this by making the "ichar" variable explicitly unsigned.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
This commit is contained in:
Geert Uytterhoeven 2021-02-08 13:27:56 +01:00
parent 5430c1455e
commit 8e4202ced1
1 changed files with 1 additions and 1 deletions

View File

@ -190,7 +190,7 @@ int readline(char *buf, int len)
unsigned int eol_num = 0; unsigned int eol_num = 0;
unsigned int wlen; unsigned int wlen;
int insert = 1; int insert = 1;
char ichar; unsigned char ichar;
#ifndef TERM_NO_COMPLETE #ifndef TERM_NO_COMPLETE
char tmp; char tmp;