From 9328fae9534746c08e635856b41984d55a14d7fe Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 28 Jul 2021 10:32:53 +1000 Subject: [PATCH] AP_Scripting: avoid a error in lua with gcc 10.2 on STM32 with -Werror --- libraries/AP_Scripting/lua/src/lstring.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/AP_Scripting/lua/src/lstring.c b/libraries/AP_Scripting/lua/src/lstring.c index 6257f211d9..457a219b6f 100644 --- a/libraries/AP_Scripting/lua/src/lstring.c +++ b/libraries/AP_Scripting/lua/src/lstring.c @@ -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; }