ProgramOptions.hxx icon indicating copy to clipboard operation
ProgramOptions.hxx copied to clipboard

Suppress warnings in ARM environments

Open onihusube opened this issue 3 years ago • 0 comments

The following warning occurs when using this library in an ARM environment(Raspberry Pi GCC 10.2).

../subprojects/ProgramOptions.hxx/include/ProgramOptions.hxx: In function ‘bool po::case_insensitive_eq(char, char)’:
../subprojects/ProgramOptions.hxx/include/ProgramOptions.hxx:257:8: warning: comparison is always true due to limited range of data type [-Wtype-limits]
  257 |   if(x >= 0 && y >= 0)
      |      ~~^~~~
../subprojects/ProgramOptions.hxx/include/ProgramOptions.hxx:257:18: warning: comparison is always true due to limited range of data type [-Wtype-limits]
  257 |   if(x >= 0 && y >= 0)
      |                ~~^~~~

The reason for this is that char is unsigned in GCC in the ARM environment.

I checked and found that the __CHAR_UNSIGNED__ macro is provided in this case, so I used it to disable the code that checks if the char value is positive.

onihusube avatar Apr 28 '22 06:04 onihusube