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") set(SOFTDEVICE_PATH "${NRF5_SDK_PATH}/components/softdevice/s132/hex/s132_nrf52_6.1.1_softdevice.hex")
endif () 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 # compiler/assambler/linker flags
set(CMAKE_C_FLAGS "${COMMON_FLAGS}") set(CMAKE_C_FLAGS "${COMMON_FLAGS}")

View File

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

View File

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

View File

@ -78,7 +78,7 @@ typedef struct
uint8_t mode : 2; /*!< SPI master mode */ uint8_t mode : 2; /*!< SPI master mode */
uint8_t : 5; /*!< Padding */ uint8_t : 5; /*!< Padding */
}fields; }fields;
}config; }config;
uint8_t frequency; /*!< SPI master frequency */ uint8_t frequency; /*!< SPI master frequency */
uint8_t pin_SCK; /*!< SPI master SCK pin */ uint8_t pin_SCK; /*!< SPI master SCK pin */
uint8_t pin_MOSI; /*!< SPI master MOSI pin */ uint8_t pin_MOSI; /*!< SPI master MOSI pin */
@ -143,5 +143,5 @@ bool spi_master_tx(SPI_module_number_t spi_num, uint16_t transfer_size, const ui
* @retval false if transmit/reveive of transfer_size were not complete and tx_data/rx_data points to invalid data. * @retval false if transmit/reveive of transfer_size were not complete and tx_data/rx_data points to invalid data.
*/ */
bool spi_master_rx(SPI_module_number_t spi_num, uint16_t transfer_size, uint8_t *rx_data); bool spi_master_rx(SPI_module_number_t spi_num, uint16_t transfer_size, uint8_t *rx_data);
#endif #endif

View File

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