Conversion from 'int' to 'char' for use of return value from __io_getchar()
The compiler is correctly warning about an int to char conversion for the following code from syscalls.c:
extern int __io_getchar(void) __attribute__((weak));
...
__attribute__((weak)) int _read(int file, char *ptr, int len)
{
(void)file;
int DataIdx;
for (DataIdx = 0; DataIdx < len; DataIdx++)
{
*ptr++ = __io_getchar(); // Warning here
}
return len;
}Whilst the behaviour here is as intended (assuming EOF is not expected), the warning is a pain for any projects using -Wconversion.
Could this please be fixed by adding a cast?
*ptr++ = ( char )__io_getchar();This is for an STM32G484CEUx device, if that's important.
