AP_GPS: suppress string truncation warnings

This commit is contained in:
Andrew Tridgell 2022-12-13 07:37:59 +11:00
parent 898187950e
commit b0c006deca
1 changed files with 5 additions and 0 deletions

View File

@ -727,6 +727,10 @@ void AP_GPS_NMEA::parse_versiona_field(uint16_t term_number, const char *term)
// printf useful for debugging
// ::printf("VERSIONA[%u]='%s'\n", term_number, term);
auto &v = _versiona;
#pragma GCC diagnostic push
#if defined(__GNUC__) && __GNUC__ >= 10
#pragma GCC diagnostic ignored "-Wstringop-truncation"
#endif
switch (term_number) {
case 10:
strncpy(v.type, _term, sizeof(v.type)-1);
@ -738,6 +742,7 @@ void AP_GPS_NMEA::parse_versiona_field(uint16_t term_number, const char *term)
strncpy(v.build_date, _term, sizeof(v.build_date)-1);
break;
}
#pragma GCC diagnostic pop
}
#endif // AP_GPS_NMEA_UNICORE_ENABLED