Add missing return statements which fix crashes in release mode.

Add flag to compiler so that it generates an error when a returning function does not return something...
This commit is contained in:
JF 2019-12-06 20:46:21 +01:00
parent 5225706cc8
commit 0db16bd827
5 changed files with 8 additions and 8 deletions

View File

@ -88,7 +88,7 @@ macro(nRF5x_setup)
set(SOFTDEVICE_PATH "${NRF5_SDK_PATH}/components/softdevice/s132/hex/s132_nrf52_6.1.1_softdevice.hex")
endif ()
set(COMMON_FLAGS "-MP -MD -mthumb -mabi=aapcs -Wall -g3 -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin --short-enums ${CPU_FLAGS}")
set(COMMON_FLAGS "-MP -MD -mthumb -mabi=aapcs -Wall -g3 -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin --short-enums ${CPU_FLAGS} -Wreturn-type -Werror=return-type")
# compiler/assambler/linker flags
set(CMAKE_C_FLAGS "${COMMON_FLAGS}")

View File

@ -9,7 +9,7 @@ using namespace Pinetime::Applications;
Pinetime::Drivers::st7789 lcd;
ret_code_t lcd_init() {
lcd.Init();
return lcd.Init();
}
void lcd_dummy() {
@ -38,7 +38,7 @@ static lcd_cb_t st7789_cb = {
.width = 240
};
const nrf_lcd_t nrf_lcd_st7789 = {
static const nrf_lcd_t nrf_lcd_st7789 = {
.lcd_init = lcd_init,
.lcd_uninit = lcd_dummy,
.lcd_pixel_draw = lcd_pixel_draw,
@ -64,7 +64,7 @@ void DisplayApp::Process(void *instance) {
auto* app = static_cast<DisplayApp*>(instance);
NRF_LOG_INFO("DisplayApp task started!");
gfx_initialization();
app->gfx_initialization();
uint8_t hour = 0;
uint8_t minute = 1;
while (1) {

View File

@ -11,7 +11,7 @@ namespace Pinetime {
private:
TaskHandle_t taskHandle;
static void Process(void* instance);
static void gfx_initialization();
void gfx_initialization();
};
}

View File

@ -8,7 +8,7 @@ using namespace Pinetime::Drivers;
ret_code_t st7789::Init() {
InitHw();
InitCommands();
return 0;
}
ret_code_t st7789::InitHw() const {