AP_Scripting: avoid a error in lua with gcc 10.2 on STM32 with -Werror

This commit is contained in:
Andrew Tridgell 2021-07-28 10:32:53 +10:00 committed by Randy Mackay
parent 6f43ca4bf9
commit 6a4fd8a82e
1 changed files with 5 additions and 0 deletions

View File

@ -139,7 +139,12 @@ static TString *createstrobj (lua_State *L, size_t l, int tag, unsigned int h) {
ts = gco2ts(o);
ts->hash = h;
ts->extra = 0;
#pragma GCC diagnostic push
#if defined(__GNUC__) && __GNUC__ >= 10
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#endif
getstr(ts)[l] = '\0'; /* ending 0 */
#pragma GCC diagnostic pop
return ts;
}