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 compilation errors on Linux #2383

Merged
merged 8 commits into from
Dec 14, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@
[submodule "third_party/catch2/catch2"]
path = third_party/catch2/catch2
url = https://github.com/particle-iot/Catch2.git
branch = particle
[submodule "third_party/fakeit/fakeit"]
path = third_party/fakeit/fakeit
url = https://github.com/particle-iot/Fakeit.git
branch = particle

2 changes: 1 addition & 1 deletion build/gcc-tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ endif

# C compiler flags
CFLAGS += -g3 -m64 -O$(GCC_OPTIMIZE) -gdwarf-2
CFLAGS += -Wno-unused-local-typedefs
CFLAGS += -Wno-unused-local-typedefs -Wno-pragmas
ASFLAGS += -g3


Expand Down
4 changes: 2 additions & 2 deletions ci/install_boost.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
BOOST_VERSION=1_72_0
BOOST_VERSION=1_78_0

export BOOST_ROOT=$HOME/.ci/boost/boost_$BOOST_VERSION
export BOOST_LIBRARYDIR=$BOOST_ROOT/stage/lib
mkdir -p $BOOST_ROOT
test -d $BOOST_ROOT || ( echo "boost root $BOOST_ROOT not created." && exit 1)
test -f $BOOST_ROOT/INSTALL || wget --quiet https://s3.amazonaws.com/spark-assets/boost_${BOOST_VERSION}.tar.gz -O - | tar -xz -C $BOOST_ROOT --strip-components 1
test -f $BOOST_ROOT/INSTALL || wget --quiet https://spark-assets.s3.amazonaws.com/boost_${BOOST_VERSION}.tar.gz -O - | tar -xz -C $BOOST_ROOT --strip-components 1

if [[ $OSTYPE == darwin* ]]; then
export DYLD_LIBRARY_PATH="${BOOST_LIBRARYDIR}:$DYLD_LIBRARY_PATH"
Expand Down
3 changes: 3 additions & 0 deletions communication/src/subscriptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,11 @@ class Subscriptions
{
if (event_handlers[i].handler_data)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
EventHandlerWithData handler =
(EventHandlerWithData) event_handlers[i].handler;
#pragma GCC diagnostic pop
handler(event_handlers[i].handler_data,
(char *) event_name, (char *) data);
}
Expand Down
2 changes: 1 addition & 1 deletion hal/src/gcc/ota_flash_hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void parseServerAddressData(ServerAddress* server_addr, uint8_t* buf)
*p = 0;
break;
}
// else fall through to default
// else fall through

default:
server_addr->addr_type = INVALID_INTERNET_ADDRESS;
Expand Down
5 changes: 5 additions & 0 deletions services/src/rgbled.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#include "rgbled_hal.h"
#include "module_info.h"

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"

LedCallbacks LED_Callbacks = {
.version = 0x0000,
.Led_Rgb_Set_Values = (void(*)(uint16_t r, uint16_t g, uint16_t b, void*))Set_RGB_LED_Values,
Expand All @@ -22,6 +25,8 @@ LedCallbacks LED_Callbacks = {
#endif // MODULE_FUNCTION != MOD_FUNC_BOOTLOADER
};

#pragma GCC diagnostic pop

volatile uint8_t led_rgb_brightness = DEFAULT_LED_RGB_BRIGHTNESS;

volatile uint8_t LED_RGB_OVERRIDE = 0;
Expand Down
3 changes: 3 additions & 0 deletions system/src/system_cloud_internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,10 @@ void invokeEventHandlerInternal(uint16_t handlerInfoSize, FilteringEventHandler*
{
if(handlerInfo->handler_data)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
EventHandlerWithData handler = (EventHandlerWithData) handlerInfo->handler;
#pragma GCC diagnostic pop
handler(handlerInfo->handler_data, event_name, data);
}
else
Expand Down
2 changes: 1 addition & 1 deletion test/unit_tests/communication/util/coap_message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ unsigned CoapMessageOption::decodeUInt(const std::string& data) {
std::string CoapMessage::encode() const {
std::string buf;
for (;;) {
CoapMessageEncoder e(&buf.front(), buf.size());
CoapMessageEncoder e(buf.empty() ? nullptr : &buf.front(), buf.size());
e.type(type());
e.code(code());
e.id(id());
Expand Down
2 changes: 1 addition & 1 deletion third_party/catch2/catch2
Submodule catch2 updated 230 files
2 changes: 2 additions & 0 deletions third_party/mbedtls/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ TARGET_MBEDTLS_SRC_PATH = $(MBEDTLS_MODULE_PATH)/mbedtls/library

# C source files included in this build.
CSRC += $(call target_files,$(TARGET_MBEDTLS_SRC_PATH)/,*.c)

CFLAGS += -Wno-array-parameter
3 changes: 3 additions & 0 deletions wiring/inc/spark_wiring_cloud.h
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,10 @@ class CloudClass {
{
auto wrapper = new wiring_event_handler_t(handler);
if (wrapper) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
success = spark_subscribe(eventName, (EventHandler)call_wiring_event_handler, wrapper, scope, deviceID, NULL);
#pragma GCC diagnostic pop
}
}
return success;
Expand Down
6 changes: 6 additions & 0 deletions wiring/inc/spark_wiring_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -528,11 +528,17 @@ class SystemClass {

// TODO: system_unsubscribe_event() isn't implemented yet.
static void off(void(*handler)(system_event_t, int, void*)) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
system_unsubscribe_event(all_events, reinterpret_cast<system_event_handler_t*>(handler), nullptr);
#pragma GCC diagnostic pop
}

static void off(system_event_t events, void(*handler)(system_event_t, int, void*)) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
system_unsubscribe_event(events, reinterpret_cast<system_event_handler_t*>(handler), nullptr);
#pragma GCC diagnostic pop
}


Expand Down