Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix XCode 11.7 clang errors #15349

Merged
merged 3 commits into from Sep 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion libraries/AP_HAL/utility/RingBuffer.h
Expand Up @@ -267,7 +267,7 @@ class ObjectBuffer_TS {
}

// return size of ringbuffer
uint32_t get_size(void) const {
uint32_t get_size(void) {
WITH_SEMAPHORE(sem);
return buffer->get_size() / sizeof(T);
}
Expand Down
3 changes: 3 additions & 0 deletions libraries/AP_Scripting/lua/src/lcode.c
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions libraries/AP_Scripting/lua/src/lstrlib.c
Expand Up @@ -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


Expand Down
3 changes: 3 additions & 0 deletions libraries/AP_Scripting/lua/src/ltable.c
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions libraries/AP_Scripting/lua/src/lundump.c
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libraries/AP_Scripting/lua_boxed_numerics.cpp
Expand Up @@ -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)) {
tridge marked this conversation as resolved.
Show resolved Hide resolved
return static_cast<uint32_t>(v);
}
}
Expand Down
7 changes: 4 additions & 3 deletions libraries/AP_Scripting/wscript
Expand Up @@ -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']
Expand All @@ -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',
)

Expand Down
2 changes: 1 addition & 1 deletion libraries/GCS_MAVLink/GCS_Common.cpp
Expand Up @@ -2152,7 +2152,7 @@ MAV_RESULT GCS_MAVLINK::_set_mode_common(const MAV_MODE _base_mode, const uint32
{
MAV_RESULT result = MAV_RESULT_UNSUPPORTED;
// only accept custom modes because there is no easy mapping from Mavlink flight modes to AC flight modes
if (_base_mode & MAV_MODE_FLAG_CUSTOM_MODE_ENABLED) {
if (uint32_t(_base_mode) & MAV_MODE_FLAG_CUSTOM_MODE_ENABLED) {
andyp1per marked this conversation as resolved.
Show resolved Hide resolved
if (AP::vehicle()->set_mode(_custom_mode, ModeReason::GCS_COMMAND)) {
result = MAV_RESULT_ACCEPTED;
}
Expand Down