From 421b9ef54a6525729e709d655dea8c63a8a3a199 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Mon, 16 May 2016 13:46:33 -0300 Subject: [PATCH] AP_Mount do not use flexible array in union We actually don't want a flexible array in this union, but rather a way to access it byte by byte. This fixes the build for gcc >= 6 In file included from ../../libraries/AP_GPS/AP_GPS_UBLOX.cpp:23:0: ../../libraries/AP_GPS/AP_GPS_UBLOX.h:387:23: error: flexible array member in union uint8_t bytes[]; ^ compilation terminated due to -Wfatal-errors. In file included from ../../libraries/AP_Mount/AP_Mount.cpp:9:0: ../../libraries/AP_Mount/AP_Mount_Alexmos.h:291:23: error: flexible array member in union uint8_t bytes[]; ^ compilation terminated due to -Wfatal-errors. --- libraries/AP_Mount/AP_Mount_Alexmos.h | 2 +- libraries/AP_Mount/AP_Mount_SToRM32_serial.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/AP_Mount/AP_Mount_Alexmos.h b/libraries/AP_Mount/AP_Mount_Alexmos.h index a746e19459..88c19fb317 100644 --- a/libraries/AP_Mount/AP_Mount_Alexmos.h +++ b/libraries/AP_Mount/AP_Mount_Alexmos.h @@ -288,7 +288,7 @@ private: alexmos_angles angles; alexmos_params params; alexmos_angles_speed angle_speed; - uint8_t bytes[]; + uint8_t bytes[1]; } _buffer,_current_parameters; AP_HAL::UARTDriver *_port; diff --git a/libraries/AP_Mount/AP_Mount_SToRM32_serial.h b/libraries/AP_Mount/AP_Mount_SToRM32_serial.h index 1da8e49197..1bb9ede2ea 100644 --- a/libraries/AP_Mount/AP_Mount_SToRM32_serial.h +++ b/libraries/AP_Mount/AP_Mount_SToRM32_serial.h @@ -145,7 +145,7 @@ private: union PACKED SToRM32_reply { SToRM32_reply_data_struct data; SToRM32_reply_ack_struct ack; - uint8_t bytes[]; + uint8_t bytes[1]; } _buffer; // keep the last _current_angle values