AP_Scripting: remove compile errors and warnings

This commit is contained in:
Andy Piper 2020-09-18 09:09:44 +01:00 committed by Andrew Tridgell
parent 5d487be242
commit 9fef5b1e94
6 changed files with 17 additions and 4 deletions

View File

@ -9,6 +9,9 @@
#if defined(ARDUPILOT_BUILD)
#pragma GCC diagnostic ignored "-Wfloat-equal"
#if defined(__GNUC__) && __GNUC__ >= 7 || defined(__clang_major__) && __clang_major__ >= 11
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif
#endif
#include "lprefix.h"

View File

@ -26,6 +26,9 @@
#if defined(ARDUPILOT_BUILD)
#pragma GCC diagnostic ignored "-Wunused-function"
#if defined(__GNUC__) && __GNUC__ >= 7 || defined(__clang_major__) && __clang_major__ >= 11
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif
#endif

View File

@ -9,6 +9,9 @@
#if defined(ARDUPILOT_BUILD)
#pragma GCC diagnostic ignored "-Wfloat-equal"
#if defined(__GNUC__) && __GNUC__ >= 7 || defined(__clang_major__) && __clang_major__ >= 11
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif
#endif
#include "lprefix.h"

View File

@ -6,6 +6,9 @@
#if defined(ARDUPILOT_BUILD)
#pragma GCC diagnostic ignored "-Wfloat-equal"
#if defined(__GNUC__) && __GNUC__ >= 7 || defined(__clang_major__) && __clang_major__ >= 11
#pragma GCC diagnostic ignored "-Wstring-plus-int"
#endif
#endif
#define lundump_c

View File

@ -26,7 +26,7 @@ uint32_t coerce_to_uint32_t(lua_State *L, int arg) {
{ // float
int success;
const lua_Number v = lua_tonumberx(L, arg, &success);
if (success && v >= 0 && v <= UINT32_MAX) {
if (success && v >= 0 && v <= float(UINT32_MAX)) {
return static_cast<uint32_t>(v);
}
}

View File

@ -7,8 +7,9 @@ build generated bindings from bindings.desc for AP_Scripting
from waflib.TaskGen import after_method, before_method, feature
import os
CFLAGS="-std=c99 -Wno-error=missing-field-initializers -Wall -Werror -Wextra"
CC="gcc"
# these are only used for binding generation, not compilation of the library
BINDING_CFLAGS="-std=c99 -Wno-error=missing-field-initializers -Wall -Werror -Wextra"
BINDING_CC="gcc"
def configure(cfg):
cfg.env.AP_LIB_EXTRA_SOURCES['AP_Scripting'] = ['lua_generated_bindings.cpp']
@ -30,7 +31,7 @@ def build(bld):
source=main_c,
target=[gen_bindings],
# we should have configure tests for finding the native compiler
rule="%s %s -o %s %s" % (CC, CFLAGS, gen_bindings_rel, main_c_rel),
rule="%s %s -o %s %s" % (BINDING_CC, BINDING_CFLAGS, gen_bindings_rel, main_c_rel),
group='dynamic_sources',
)