rkdeveloptool
rkdeveloptool copied to clipboard
Build failure: Comparison of char index with -1 in main.cpp:upgrade_loader()
On several non-x86 architectures (ARM, PowerPC, S/390) I am getting build failures with GCC 6.3.1:
[ 31s] main.cpp: In function 'bool upgrade_loader(STRUCT_RKDEVICE_DESC&, char*)':
[ 31s] main.cpp:1550:13: error: comparison is always false due to limited range of data type [-Werror=type-limits]
[ 31s] if (index == -1) {
[ 31s] ~~~~~~^~~~~
[ 31s] main.cpp:1574:13: error: comparison is always false due to limited range of data type [-Werror=type-limits]
[ 31s] if (index == -1) {
[ 31s] ~~~~~~^~~~~
[ 33s] cc1plus: all warnings being treated as errors
[ 33s] make[1]: *** [Makefile:454: main.o] Error 1
[ 33s] make[1]: Leaving directory '/home/abuild/rpmbuild/BUILD/rkdeveloptool-0~git.20170425.e5ee8cc'
[ 33s] make: *** [Makefile:470: all-recursive] Error 1
That suggests the type of index, char, is unsigned on those platforms, and that the variable type of index should be changed - either to signed char or maybe to int.
Seeing the same problem. Unable to build natively on Rock64
workaround remove: -Wextra and -Wno-type-limits in makefile.am
Will try that, thanks.