From e9a4a74e7b77a378cdce4008f61f99e95f80a6e0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 7 Jul 2020 13:15:14 +1000 Subject: [PATCH] AP_Scripting: suppress cast-align warnings in Lua interpreter this is externally maintained code that makes heavy use of casting --- libraries/AP_Scripting/lua/src/ldebug.c | 3 ++- libraries/AP_Scripting/lua/src/ldo.c | 3 ++- libraries/AP_Scripting/lua/src/llex.c | 2 ++ libraries/AP_Scripting/lua/src/lstate.c | 3 +++ libraries/AP_Scripting/lua/src/ltm.c | 2 ++ 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libraries/AP_Scripting/lua/src/ldebug.c b/libraries/AP_Scripting/lua/src/ldebug.c index e1389296e9..1de6b0df0f 100644 --- a/libraries/AP_Scripting/lua/src/ldebug.c +++ b/libraries/AP_Scripting/lua/src/ldebug.c @@ -29,7 +29,8 @@ #include "ltm.h" #include "lvm.h" - +// lua code does lots of casting, these warnings are not helpful +#pragma GCC diagnostic ignored "-Wcast-align" #define noLuaClosure(f) ((f) == NULL || (f)->c.tt == LUA_TCCL) diff --git a/libraries/AP_Scripting/lua/src/ldo.c b/libraries/AP_Scripting/lua/src/ldo.c index 316e45c8fe..951a5b5223 100644 --- a/libraries/AP_Scripting/lua/src/ldo.c +++ b/libraries/AP_Scripting/lua/src/ldo.c @@ -33,7 +33,8 @@ #include "lvm.h" #include "lzio.h" - +// lua code does lots of casting, these warnings are not helpful +#pragma GCC diagnostic ignored "-Wcast-align" #define errorstatus(s) ((s) > LUA_YIELD) diff --git a/libraries/AP_Scripting/lua/src/llex.c b/libraries/AP_Scripting/lua/src/llex.c index 66fd411ba9..afc6f41709 100644 --- a/libraries/AP_Scripting/lua/src/llex.c +++ b/libraries/AP_Scripting/lua/src/llex.c @@ -27,6 +27,8 @@ #include "ltable.h" #include "lzio.h" +// lua code does lots of casting, these warnings are not helpful +#pragma GCC diagnostic ignored "-Wcast-align" #define next(ls) (ls->current = zgetc(ls->z)) diff --git a/libraries/AP_Scripting/lua/src/lstate.c b/libraries/AP_Scripting/lua/src/lstate.c index c1a76643c3..25580bff24 100644 --- a/libraries/AP_Scripting/lua/src/lstate.c +++ b/libraries/AP_Scripting/lua/src/lstate.c @@ -27,6 +27,9 @@ #include "ltable.h" #include "ltm.h" +// lua code does lots of casting, these warnings are not helpful +#pragma GCC diagnostic ignored "-Wcast-align" + #if !defined(LUAI_GCPAUSE) #define LUAI_GCPAUSE 200 /* 200% */ diff --git a/libraries/AP_Scripting/lua/src/ltm.c b/libraries/AP_Scripting/lua/src/ltm.c index 0e7c713214..6e7a95a0b3 100644 --- a/libraries/AP_Scripting/lua/src/ltm.c +++ b/libraries/AP_Scripting/lua/src/ltm.c @@ -23,6 +23,8 @@ #include "ltm.h" #include "lvm.h" +// lua code does lots of casting, these warnings are not helpful +#pragma GCC diagnostic ignored "-Wcast-align" static const char udatatypename[] = "userdata";