Skip to content

fix warnings on char signedness mismatches

On NetBSD gives lots of warnings like this:

In file included from /usr/include/ctype.h:100,
                 from ../hw/xfree86/common/xf86Bus.c:36:
../hw/xfree86/common/xf86Bus.c: In function ‘StringToBusType’:
../hw/xfree86/common/xf86Bus.c:270:22: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  270 |     if (isdigit(busID[0])) {
      |                      ^

The warning is quite a bit misleading - the actual problem is that conversion from 'char' to 'int' might produce sign errors, depending on whether 'char' is signed or not. On NetBSD, those functions are implemented as real functions (not macros like on other platforms), so the compiler can't tell whether the conversion might cause an error (eg. going out of bounds of a lookup table), so it's warning us.

Edited by Alan Coopersmith

Merge request reports