zs6buj / AntTracker

Antenna Tracker for tracking a moving model aircraft or drone with a small high-gain UHF or SHF antenna
GNU General Public License v3.0
155 stars 42 forks source link

Warnings during compile #20

Closed countxerox closed 4 years ago

countxerox commented 4 years ago

It compiles and uploads but is it normal to have so many warnings? I'm using a blue pill "Generic STM32F103C Series" board, variant 128k flash, 72mhz cpu, programmer AVR ISP

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\AntTrack_v2.14.ino: In function 'boolean PacketGood()':

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\AntTrack_v2.14.ino:783:7: warning: statement is a reference, not call, to function 'exit' [-Waddress]

   exit;

       ^

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\AntTrack_v2.14.ino:783:7: warning: statement has no effect [-Wunused-value]

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\AntTrack_v2.14.ino:791:7: warning: statement is a reference, not call, to function 'exit' [-Waddress]

   exit; 

       ^

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\AntTrack_v2.14.ino:791:7: warning: statement has no effect [-Wunused-value]

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\AntTrack_v2.14.ino:799:7: warning: statement is a reference, not call, to function 'exit' [-Waddress]

   exit;  

       ^

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\AntTrack_v2.14.ino:799:7: warning: statement has no effect [-Wunused-value]

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\AntTrack_v2.14.ino:807:7: warning: statement is a reference, not call, to function 'exit' [-Waddress]

   exit;  

       ^

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\AntTrack_v2.14.ino:807:7: warning: statement has no effect [-Wunused-value]

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\AntTrack_v2.14.ino:815:7: warning: statement is a reference, not call, to function 'exit' [-Waddress]

   exit;  

       ^

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\AntTrack_v2.14.ino:815:7: warning: statement has no effect [-Wunused-value]

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\AntTrack_v2.14.ino:824:9: warning: statement is a reference, not call, to function 'exit' [-Waddress]

     exit;  

         ^

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\AntTrack_v2.14.ino:824:9: warning: statement has no effect [-Wunused-value]

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\AntTrack_v2.14.ino: At global scope:

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\AntTrack_v2.14.ino:845:6: warning: unused parameter 'S' [-Wunused-parameter]

 void OledPrintln(String S) {

      ^

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\AntTrack_v2.14.ino:887:6: warning: unused parameter 'S' [-Wunused-parameter]

 void OledPrint(String S) {

      ^

In file included from C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\Compass.ino:3:0:

C:\Users\robyb\Documents\Arduino\libraries\Adafruit_Sensor-master/Adafruit_Sensor.h:146:16: warning: unused parameter 'enabled' [-Wunused-parameter]

   virtual void enableAutoRange(bool enabled) {};

                ^

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\GetProtocol.ino: In function 'uint16_t DetectProtocol(uint32_t)':

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\GetProtocol.ino:107:1: warning: control reaches end of non-void function [-Wreturn-type]

 }

 ^

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\Mavlink.ino: In function 'void Mavlink_Receive()':

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\Mavlink.ino:190:59: warning: '*((void*)& msg +37)' may be used uninitialized in this function [-Wmaybe-uninitialized]

           ap_gps_status = (ap_sat_visible*10) + ap_fixtype; 

                                                           ^

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\Mavlink.ino:191:11: warning: '*((void*)& msg +36)' may be used uninitialized in this function [-Wmaybe-uninitialized]

           if(ap_fixtype > 2)  {

           ^

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\Mavlink.ino:233:65: warning: '*((void*)& msg +34)' may be used uninitialized in this function [-Wmaybe-uninitialized]

           ap_hdg = mavlink_msg_global_position_int_get_hdg(&msg);             // Vehicle heading (yaw angle) in degrees * 100, 0.0..359.99 degrees          ap_ap_amsl = mavlink_msg_attitude_get_yaw(&msg);                // Yaw angle (rad, -pi..+pi)

                                                                 ^

In file included from C:\Users\robyb\Documents\Arduino\libraries\mavlink_types/common/common.h:30:0,

                 from C:\Users\robyb\Documents\Arduino\libraries\mavlink_types/common/mavlink.h:25,

                 from C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\AntTrack_v2.14.ino:164:

C:\Users\robyb\Documents\Arduino\libraries\mavlink_types/common/../protocol.h:276:49: warning: '*((void*)& msg +32)' may be used uninitialized in this function [-Wmaybe-uninitialized]

 { return *(const TYPE *)(&_MAV_PAYLOAD(msg)[ofs]);}

                                                 ^

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\Mavlink.ino:55:21: note: '*((void*)& msg +32)' was declared here

   mavlink_message_t msg;

                     ^

In file included from C:\Users\robyb\Documents\Arduino\libraries\mavlink_types/common/common.h:30:0,

                 from C:\Users\robyb\Documents\Arduino\libraries\mavlink_types/common/mavlink.h:25,

                 from C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\AntTrack_v2.14.ino:164:

C:\Users\robyb\Documents\Arduino\libraries\mavlink_types/common/../protocol.h:276:49: warning: '*((void*)& msg +30)' may be used uninitialized in this function [-Wmaybe-uninitialized]

 { return *(const TYPE *)(&_MAV_PAYLOAD(msg)[ofs]);}

                                                 ^

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\Mavlink.ino:55:21: note: '*((void*)& msg +30)' was declared here

   mavlink_message_t msg;

                     ^

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\Mavlink.ino:230:63: warning: '*((void*)& msg +28)' may be used uninitialized in this function [-Wmaybe-uninitialized]

           ap_vx = mavlink_msg_global_position_int_get_vx(&msg);               //  Ground X Speed (Latitude, positive north), expressed as m/s * 100

                                                               ^

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\Mavlink.ino:229:77: warning: '*((void*)& msg +24)' may be used uninitialized in this function [-Wmaybe-uninitialized]

           ap_alt_ag = mavlink_msg_global_position_int_get_relative_alt(&msg); // Altitude above ground (millimeters)

                                                                             ^

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\Mavlink.ino:228:68: warning: '*((void*)& msg +20)' may be used uninitialized in this function [-Wmaybe-uninitialized]

           ap_amsl33 = mavlink_msg_global_position_int_get_alt(&msg);          // x Supposedly altitude above mean sea level (millimeters)

                                                                    ^

C:\Users\robyb\Documents\Arduino\AntTrack_v2.14\Mavlink.ino:131:7: warning: 'msg.__mavlink_message::msgid' may be used uninitialized in this function [-Wmaybe-uninitialized]

       switch(msg.msgid) {

       ^

Sketch uses 79200 bytes (60%) of program storage space. Maximum is 131072 bytes.
Global variables use 6704 bytes (32%) of dynamic memory, leaving 13776 bytes for local variables. Maximum is 20480 bytes.
zs6buj commented 4 years ago

Your compiler quite rightly identified that the exits were unnecessary. Sloppy programming on my part. I fixed them in v2.14 since there is no effect on the binary.

My Arduino IDE v1.8.10 didn't report this as a warning or error. Perhaps your compiler's permissive flag is set differently.

Thanks for the feedback Rob.