DexterInd / GoPiGo3

The GoPiGo3 is a Raspberry Pi Robot!
https://gopigo.io
Other
98 stars 85 forks source link

GoPiGo3.cpp generates compile warnings #322

Closed slowrunner closed 1 year ago

slowrunner commented 1 year ago

GoPiGo3/Software/C/GoPiGo3.cpp generates compile warnings:

 make
[ 10%] Building CXX object CMakeFiles/gopigo3.dir/GoPiGo3.cpp.o
/home/ubuntu/systests/cpp/GoPiGo3.cpp: In member function ‘int GoPiGo3::detect(bool)’:
/home/ubuntu/systests/cpp/GoPiGo3.cpp:143:106: warning: ‘%s’ directive writing up to 20 bytes into a region of size 18 [-Wformat-overflow=]
  143 |       sprintf(ErrorStr, "detect error: GoPiGo3 firmware needs to be version %sx but is currently version %s", FIRMWARE_VERSION_REQUIRED, str);
      |                                                                                                          ^~                              ~~~
/home/ubuntu/systests/cpp/GoPiGo3.cpp:143:14: note: ‘sprintf’ output between 83 and 103 bytes into a destination of size 100
  143 |       sprintf(ErrorStr, "detect error: GoPiGo3 firmware needs to be version %sx but is currently version %s", FIRMWARE_VERSION_REQUIRED, str);
      |       ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ubuntu/systests/cpp/GoPiGo3.cpp: In member function ‘int GoPiGo3::get_version_hardware(char*)’:
/home/ubuntu/systests/cpp/GoPiGo3.cpp:167:1: warning: control reaches end of non-void function [-Wreturn-type]
  167 | }
      | ^

using GoPiGo3/Software/C/CMakeList.txt to build Examples