From af116d238fc99d68ac8d301d64f486a5ae93b53e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 25 May 2016 11:13:42 +1000 Subject: [PATCH] AP_GPS: use zero length flexible arrays this works with gcc-6.1 and also works with asan. Hopefully it will make coverity happy too. --- libraries/AP_GPS/AP_GPS_ERB.h | 2 +- libraries/AP_GPS/AP_GPS_MTK.h | 2 +- libraries/AP_GPS/AP_GPS_MTK19.h | 2 +- libraries/AP_GPS/AP_GPS_SIRF.h | 2 +- libraries/AP_GPS/AP_GPS_UBLOX.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/AP_GPS/AP_GPS_ERB.h b/libraries/AP_GPS/AP_GPS_ERB.h index 5c0c3fc825..c7d8868c62 100644 --- a/libraries/AP_GPS/AP_GPS_ERB.h +++ b/libraries/AP_GPS/AP_GPS_ERB.h @@ -90,7 +90,7 @@ private: erb_stat stat; erb_dops dops; erb_vel vel; - uint8_t bytes[1]; + uint8_t bytes[0]; } _buffer; enum erb_protocol_bytes { diff --git a/libraries/AP_GPS/AP_GPS_MTK.h b/libraries/AP_GPS/AP_GPS_MTK.h index fa2188f125..71cedd4303 100644 --- a/libraries/AP_GPS/AP_GPS_MTK.h +++ b/libraries/AP_GPS/AP_GPS_MTK.h @@ -72,7 +72,7 @@ private: // Receive buffer union PACKED { diyd_mtk_msg msg; - uint8_t bytes[1]; + uint8_t bytes[0]; } _buffer; // Buffer parse & GPS state update diff --git a/libraries/AP_GPS/AP_GPS_MTK19.h b/libraries/AP_GPS/AP_GPS_MTK19.h index 054a94c491..b6e5c49653 100644 --- a/libraries/AP_GPS/AP_GPS_MTK19.h +++ b/libraries/AP_GPS/AP_GPS_MTK19.h @@ -78,6 +78,6 @@ private: // Receive buffer union { diyd_mtk_msg msg; - uint8_t bytes[1]; + uint8_t bytes[0]; } _buffer; }; diff --git a/libraries/AP_GPS/AP_GPS_SIRF.h b/libraries/AP_GPS/AP_GPS_SIRF.h index 8833c9ca7f..dfb7a43537 100644 --- a/libraries/AP_GPS/AP_GPS_SIRF.h +++ b/libraries/AP_GPS/AP_GPS_SIRF.h @@ -98,7 +98,7 @@ private: // Message buffer union { sirf_geonav nav; - uint8_t bytes[1]; + uint8_t bytes[0]; } _buffer; bool _parse_gps(void); diff --git a/libraries/AP_GPS/AP_GPS_UBLOX.h b/libraries/AP_GPS/AP_GPS_UBLOX.h index c33316e9f1..5dce69d3d7 100644 --- a/libraries/AP_GPS/AP_GPS_UBLOX.h +++ b/libraries/AP_GPS/AP_GPS_UBLOX.h @@ -384,7 +384,7 @@ private: ubx_rxm_rawx rxm_rawx; #endif ubx_ack_ack ack; - uint8_t bytes[1]; + uint8_t bytes[0]; } _buffer; enum ubs_protocol_bytes {