From fb579212eae34c0bc300662e60b5612fd939762b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 6 Aug 2019 04:46:30 -0500 Subject: [PATCH] Reduce unused function warnings --- Marlin/src/HAL/HAL_AVR/HAL.h | 3 +++ Marlin/src/HAL/HAL_DUE/HAL.h | 6 +++++- Marlin/src/HAL/HAL_ESP32/HAL.h | 3 +++ Marlin/src/HAL/HAL_LINUX/HAL.h | 3 +++ Marlin/src/HAL/HAL_LPC1768/HAL.h | 3 +++ Marlin/src/HAL/HAL_SAMD51/HAL.h | 10 ++++++++-- Marlin/src/HAL/HAL_STM32/HAL.h | 21 +++++++++++++-------- Marlin/src/HAL/HAL_STM32F1/HAL.h | 19 ++++++++++--------- Marlin/src/HAL/HAL_STM32_F4_F7/HAL.h | 21 ++++++++++++--------- Marlin/src/HAL/HAL_TEENSY31_32/HAL.h | 3 +++ Marlin/src/HAL/HAL_TEENSY35_36/HAL.h | 13 ++++++++----- 11 files changed, 71 insertions(+), 34 deletions(-) diff --git a/Marlin/src/HAL/HAL_AVR/HAL.h b/Marlin/src/HAL/HAL_AVR/HAL.h index 8912b24eb4..807f21bb6b 100644 --- a/Marlin/src/HAL/HAL_AVR/HAL.h +++ b/Marlin/src/HAL/HAL_AVR/HAL.h @@ -114,9 +114,12 @@ void HAL_init(void); inline void HAL_clear_reset_source(void) { MCUSR = 0; } inline uint8_t HAL_get_reset_source(void) { return MCUSR; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" extern "C" { int freeMemory(void); } +#pragma GCC diagnostic pop // timers #define HAL_TIMER_RATE ((F_CPU) / 8) // i.e., 2MHz or 2.5MHz diff --git a/Marlin/src/HAL/HAL_DUE/HAL.h b/Marlin/src/HAL/HAL_DUE/HAL.h index 40a0241905..7f45a964b6 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL.h +++ b/Marlin/src/HAL/HAL_DUE/HAL.h @@ -156,12 +156,16 @@ void HAL_init(void); // Utility functions // void _delay_ms(const int delay); + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" int freeMemory(void); +#pragma GCC diagnostic pop #ifdef __cplusplus extern "C" { #endif -char *dtostrf (double __val, signed char __width, unsigned char __prec, char *__s); +char *dtostrf(double __val, signed char __width, unsigned char __prec, char *__s); #ifdef __cplusplus } #endif diff --git a/Marlin/src/HAL/HAL_ESP32/HAL.h b/Marlin/src/HAL/HAL_ESP32/HAL.h index 5327a8789e..467e5e0de5 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL.h +++ b/Marlin/src/HAL/HAL_ESP32/HAL.h @@ -92,7 +92,10 @@ uint8_t HAL_get_reset_source(void); void _delay_ms(int delay); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" int freeMemory(void); +#pragma GCC diagnostic pop void analogWrite(pin_t pin, int value); diff --git a/Marlin/src/HAL/HAL_LINUX/HAL.h b/Marlin/src/HAL/HAL_LINUX/HAL.h index fbbce96dbd..db771f06c0 100644 --- a/Marlin/src/HAL/HAL_LINUX/HAL.h +++ b/Marlin/src/HAL/HAL_LINUX/HAL.h @@ -81,7 +81,10 @@ extern HalSerial usb_serial; inline void HAL_init(void) { } // Utility functions +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" int freeMemory(void); +#pragma GCC diagnostic pop // SPI: Extended functions which take a channel number (hardware SPI only) /** Write single byte to specified SPI channel */ diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL.h b/Marlin/src/HAL/HAL_LPC1768/HAL.h index 26e273e919..45be77f41c 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL.h +++ b/Marlin/src/HAL/HAL_LPC1768/HAL.h @@ -111,7 +111,10 @@ extern "C" volatile uint32_t _millis; // // Utility functions // +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" int freeMemory(void); +#pragma GCC diagnostic pop // // SPI: Extended functions taking a channel number (Hardware SPI only) diff --git a/Marlin/src/HAL/HAL_SAMD51/HAL.h b/Marlin/src/HAL/HAL_SAMD51/HAL.h index ca51e40d8f..81095f8a15 100644 --- a/Marlin/src/HAL/HAL_SAMD51/HAL.h +++ b/Marlin/src/HAL/HAL_SAMD51/HAL.h @@ -132,11 +132,17 @@ void noTone(const pin_t _pin); // Enable hooks into idle and setup for HAL void HAL_init(void); -/*#define HAL_IDLETASK 1 -void HAL_idletask(void);*/ +/* +#define HAL_IDLETASK 1 +void HAL_idletask(void); +*/ // // Utility functions // FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); } + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" int freeMemory(void); +#pragma GCC diagnostic pop diff --git a/Marlin/src/HAL/HAL_STM32/HAL.h b/Marlin/src/HAL/HAL_STM32/HAL.h index 051cab46d9..ccbe8a7c5d 100644 --- a/Marlin/src/HAL/HAL_STM32/HAL.h +++ b/Marlin/src/HAL/HAL_STM32/HAL.h @@ -136,7 +136,7 @@ typedef int16_t pin_t; // Public Variables // ------------------------ -/** result of last ADC conversion */ +// result of last ADC conversion extern uint16_t HAL_adc_result; // ------------------------ @@ -149,30 +149,35 @@ extern uint16_t HAL_adc_result; // Enable hooks into setup for HAL void HAL_init(void); -/** clear reset reason */ +// Clear reset reason void HAL_clear_reset_source (void); -/** reset reason */ +// Reset reason uint8_t HAL_get_reset_source(void); void _delay_ms(const int delay); extern "C" char* _sbrk(int incr); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" + static inline 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) // -/** Write single byte to specified SPI channel */ +// Write single byte to specified SPI channel void spiSend(uint32_t chan, byte b); -/** Write buffer to specified SPI channel */ +// Write buffer to specified SPI channel void spiSend(uint32_t chan, const uint8_t* buf, size_t n); -/** Read single byte from specified SPI channel */ +// Read single byte from specified SPI channel uint8_t spiRec(uint32_t chan); // @@ -182,8 +187,8 @@ uint8_t spiRec(uint32_t chan); // Wire library should work for i2c EEPROMs 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/HAL.h b/Marlin/src/HAL/HAL_STM32F1/HAL.h index f0a4883504..227b495ed8 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL.h @@ -158,7 +158,7 @@ typedef int8_t pin_t; // Public Variables // ------------------------ -/** result of last ADC conversion */ +// Result of last ADC conversion extern uint16_t HAL_adc_result; // ------------------------ @@ -174,14 +174,17 @@ extern uint16_t HAL_adc_result; // Memory related #define __bss_end __bss_end__ -/** clear reset reason */ +// Clear reset reason void HAL_clear_reset_source(void); -/** reset reason */ +// Reset reason uint8_t HAL_get_reset_source(void); void _delay_ms(const int delay); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" + /* extern "C" { int freeMemory(void); @@ -189,6 +192,7 @@ extern "C" { */ extern "C" char* _sbrk(int incr); + /* static int freeMemory() { volatile int top; @@ -197,9 +201,6 @@ static int freeMemory() { } */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-function" - static int freeMemory() { volatile char top; return &top - reinterpret_cast(_sbrk(0)); @@ -211,11 +212,11 @@ static int freeMemory() { // SPI: Extended functions which take a channel number (hardware SPI only) // -/** Write single byte to specified SPI channel */ +// Write single byte to specified SPI channel void spiSend(uint32_t chan, byte b); -/** Write buffer to specified SPI channel */ +// Write buffer to specified SPI channel void spiSend(uint32_t chan, const uint8_t* buf, size_t n); -/** Read single byte from specified SPI channel */ +// Read single byte from specified SPI channel uint8_t spiRec(uint32_t chan); // diff --git a/Marlin/src/HAL/HAL_STM32_F4_F7/HAL.h b/Marlin/src/HAL/HAL_STM32_F4_F7/HAL.h index 59623ae706..61807f026d 100644 --- a/Marlin/src/HAL/HAL_STM32_F4_F7/HAL.h +++ b/Marlin/src/HAL/HAL_STM32_F4_F7/HAL.h @@ -37,7 +37,7 @@ #include -#ifdef defined(STM32F4) && USBCON +#if defined(STM32F4) && USBCON #include #endif @@ -100,8 +100,6 @@ #define NUM_SERIAL 1 #endif -#define _BV(b) (1 << (b)) - /** * TODO: review this to return 1 for pins that are not analog input */ @@ -142,7 +140,7 @@ typedef int8_t pin_t; // Public Variables // ------------------------ -/** result of last ADC conversion */ +// Result of last ADC conversion extern uint16_t HAL_adc_result; // ------------------------ @@ -154,14 +152,17 @@ extern uint16_t HAL_adc_result; inline void HAL_init(void) { } -/** clear reset reason */ +// Clear reset reason void HAL_clear_reset_source (void); -/** reset reason */ +// Reset reason uint8_t HAL_get_reset_source(void); void _delay_ms(const int delay); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" + /* extern "C" { int freeMemory(void); @@ -183,15 +184,17 @@ static int freeMemory() { return &top - reinterpret_cast(_sbrk(0)); } +#pragma GCC diagnostic pop + // // SPI: Extended functions which take a channel number (hardware SPI only) // -/** Write single byte to specified SPI channel */ +// Write single byte to specified SPI channel void spiSend(uint32_t chan, byte b); -/** Write buffer to specified SPI channel */ +// Write buffer to specified SPI channel void spiSend(uint32_t chan, const uint8_t* buf, size_t n); -/** Read single byte from specified SPI channel */ +// Read single byte from specified SPI channel uint8_t spiRec(uint32_t chan); // diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/HAL.h b/Marlin/src/HAL/HAL_TEENSY31_32/HAL.h index 18e53a33e3..8911f9cf3b 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/HAL.h +++ b/Marlin/src/HAL/HAL_TEENSY31_32/HAL.h @@ -97,9 +97,12 @@ uint8_t HAL_get_reset_source(void); FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" extern "C" { int freeMemory(void); } +#pragma GCC diagnostic pop // SPI: Extended functions which take a channel number (hardware SPI only) diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h index 4a8de159b0..fb152ee30a 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h @@ -95,24 +95,27 @@ typedef int8_t pin_t; inline void HAL_init(void) { } -/** clear reset reason */ +// Clear reset reason void HAL_clear_reset_source(void); -/** reset reason */ +// Reset reason uint8_t HAL_get_reset_source(void); FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" extern "C" { int freeMemory(void); } +#pragma GCC diagnostic pop // SPI: Extended functions which take a channel number (hardware SPI only) -/** Write single byte to specified SPI channel */ +// Write single byte to specified SPI channel void spiSend(uint32_t chan, byte b); -/** Write buffer to specified SPI channel */ +// Write buffer to specified SPI channel void spiSend(uint32_t chan, const uint8_t* buf, size_t n); -/** Read single byte from specified SPI channel */ +// Read single byte from specified SPI channel uint8_t spiRec(uint32_t chan); // ADC