From 4200f9ed62ce3ac8de14bc86d5f991d0508b885f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 25 Feb 2019 22:51:14 -0600 Subject: [PATCH] Hide freeMemory et.al. warnings --- Marlin/src/HAL/HAL_STM32F1/HAL.h | 14 ++++++++++---- .../HAL/HAL_STM32F1/persistent_store_sdcard.cpp | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL.h b/Marlin/src/HAL/HAL_STM32F1/HAL.h index 84774b5686..941f485f54 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL.h @@ -159,10 +159,10 @@ extern uint16_t HAL_adc_result; #define __bss_end __bss_end__ /** clear reset reason */ -void HAL_clear_reset_source (void); +void HAL_clear_reset_source(void); /** reset reason */ -uint8_t HAL_get_reset_source (void); +uint8_t HAL_get_reset_source(void); void _delay_ms(const int delay); @@ -180,11 +180,17 @@ static int freeMemory() { return top; } */ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" + static int freeMemory() { volatile char top; return &top - reinterpret_cast(_sbrk(0)); } +#pragma GCC diagnostic pop + // // SPI: Extended functions which take a channel number (hardware SPI only) // @@ -206,8 +212,8 @@ uint8_t spiRec(uint32_t chan); */ void eeprom_write_byte(uint8_t *pos, unsigned char value); uint8_t eeprom_read_byte(uint8_t *pos); -void eeprom_read_block (void *__dst, const void *__src, size_t __n); -void eeprom_update_block (const void *__src, void *__dst, size_t __n); +void eeprom_read_block(void *__dst, const void *__src, size_t __n); +void eeprom_update_block(const void *__src, void *__dst, size_t __n); // // ADC diff --git a/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp b/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp index 05384c3858..e7a1336edd 100644 --- a/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp @@ -62,7 +62,7 @@ bool PersistentStore::access_finish() { } bool PersistentStore::write_data(int &pos, const uint8_t *value, const size_t size, uint16_t *crc) { - for (int i = 0; i < size; i++) + for (size_t i = 0; i < size; i++) HAL_STM32F1_eeprom_content[pos + i] = value[i]; crc16(crc, value, size); pos += size; @@ -70,7 +70,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, const size_t si } bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) { - for (int i = 0; i < size; i++) { + for (size_t i = 0; i < size; i++) { uint8_t c = HAL_STM32F1_eeprom_content[pos + i]; if (writing) value[i] = c; crc16(crc, &c, 1);