From 664e9d6dfe6cec01c5e125f78ecd3df7b0143fb0 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 25 Nov 2020 21:40:56 -0600 Subject: [PATCH] Reduce warnings, extern "C" cleanup (#20279) --- Marlin/src/HAL/AVR/HAL.h | 16 ++++++++++------ Marlin/src/HAL/DUE/HAL.h | 12 +++++++++--- Marlin/src/HAL/ESP32/HAL.h | 12 +++++++++--- Marlin/src/HAL/ESP32/timers.h | 8 +++++--- Marlin/src/HAL/HAL.h | 4 ++++ Marlin/src/HAL/LINUX/HAL.cpp | 17 ++++++----------- Marlin/src/HAL/LINUX/HAL.h | 12 +++++++++--- Marlin/src/HAL/LINUX/include/Arduino.h | 11 ++++++----- Marlin/src/HAL/LPC1768/HAL.cpp | 17 ++++++----------- Marlin/src/HAL/LPC1768/HAL.h | 12 +++++++++--- Marlin/src/HAL/LPC1768/MarlinSerial.cpp | 19 ++++--------------- Marlin/src/HAL/LPC1768/main.cpp | 12 ++++++------ Marlin/src/HAL/SAMD51/HAL.h | 12 +++++++++--- Marlin/src/HAL/STM32/HAL.h | 10 +++++++--- Marlin/src/HAL/STM32F1/HAL.h | 10 +++++++--- Marlin/src/HAL/STM32F1/timers.h | 6 ++++-- Marlin/src/HAL/STM32_F4_F7/HAL.h | 10 +++++++--- Marlin/src/HAL/STM32_F4_F7/STM32F4/timers.cpp | 8 +++----- Marlin/src/HAL/STM32_F4_F7/STM32F7/timers.cpp | 8 +++----- Marlin/src/HAL/TEENSY31_32/HAL.h | 16 ++++++++++------ Marlin/src/HAL/TEENSY31_32/timers.h | 4 ++-- Marlin/src/HAL/TEENSY35_36/HAL.h | 16 ++++++++++------ Marlin/src/HAL/TEENSY35_36/timers.h | 4 ++-- Marlin/src/HAL/TEENSY40_41/HAL.h | 16 ++++++++++------ Marlin/src/HAL/TEENSY40_41/timers.h | 10 ++++++---- Marlin/src/libs/duration_t.h | 10 +++++++--- 26 files changed, 170 insertions(+), 122 deletions(-) diff --git a/Marlin/src/HAL/AVR/HAL.h b/Marlin/src/HAL/AVR/HAL.h index ce15ed29fb..aa6a321320 100644 --- a/Marlin/src/HAL/AVR/HAL.h +++ b/Marlin/src/HAL/AVR/HAL.h @@ -122,12 +122,16 @@ inline uint8_t HAL_get_reset_source() { return MCUSR; } inline void HAL_reboot() {} // reboot the board or restart the bootloader -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-function" -extern "C" { - int freeMemory(); -} -#pragma GCC diagnostic pop +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-function" +#endif + +extern "C" int freeMemory(); + +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic pop +#endif // ADC #ifdef DIDR2 diff --git a/Marlin/src/HAL/DUE/HAL.h b/Marlin/src/HAL/DUE/HAL.h index 88ace59575..395ca4ccc9 100644 --- a/Marlin/src/HAL/DUE/HAL.h +++ b/Marlin/src/HAL/DUE/HAL.h @@ -153,10 +153,16 @@ void HAL_init(); // void _delay_ms(const int delay); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-function" +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-function" +#endif + int freeMemory(); -#pragma GCC diagnostic pop + +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic pop +#endif #ifdef __cplusplus extern "C" { diff --git a/Marlin/src/HAL/ESP32/HAL.h b/Marlin/src/HAL/ESP32/HAL.h index ebc16c9525..5ef13e0c21 100644 --- a/Marlin/src/HAL/ESP32/HAL.h +++ b/Marlin/src/HAL/ESP32/HAL.h @@ -100,10 +100,16 @@ inline void HAL_reboot() {} // reboot the board or restart the bootloader void _delay_ms(int delay); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-function" +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-function" +#endif + int freeMemory(); -#pragma GCC diagnostic pop + +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic pop +#endif void analogWrite(pin_t pin, int value); diff --git a/Marlin/src/HAL/ESP32/timers.h b/Marlin/src/HAL/ESP32/timers.h index 7d35186b1c..98386e3980 100644 --- a/Marlin/src/HAL/ESP32/timers.h +++ b/Marlin/src/HAL/ESP32/timers.h @@ -91,9 +91,11 @@ typedef uint64_t hal_timer_t; #define HAL_PWM_TIMER_ISR() extern "C" void pwmTC_Handler() #endif -extern "C" void tempTC_Handler(); -extern "C" void stepTC_Handler(); -extern "C" void pwmTC_Handler(); +extern "C" { + void tempTC_Handler(); + void stepTC_Handler(); + void pwmTC_Handler(); +} // ------------------------ // Types diff --git a/Marlin/src/HAL/HAL.h b/Marlin/src/HAL/HAL.h index 5eca2f7eac..9eefda8fb1 100644 --- a/Marlin/src/HAL/HAL.h +++ b/Marlin/src/HAL/HAL.h @@ -23,6 +23,10 @@ #include "platforms.h" +#ifndef GCC_VERSION + #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) +#endif + #include HAL_PATH(.,HAL.h) #ifdef SERIAL_PORT_2 diff --git a/Marlin/src/HAL/LINUX/HAL.cpp b/Marlin/src/HAL/LINUX/HAL.cpp index d7d7c2d2b4..ee9e31e140 100644 --- a/Marlin/src/HAL/LINUX/HAL.cpp +++ b/Marlin/src/HAL/LINUX/HAL.cpp @@ -27,18 +27,13 @@ HalSerial usb_serial; // U8glib required functions -extern "C" void u8g_xMicroDelay(uint16_t val) { - DELAY_US(val); -} -extern "C" void u8g_MicroDelay() { - u8g_xMicroDelay(1); -} -extern "C" void u8g_10MicroDelay() { - u8g_xMicroDelay(10); -} -extern "C" void u8g_Delay(uint16_t val) { - delay(val); +extern "C" { + void u8g_xMicroDelay(uint16_t val) { DELAY_US(val); } + void u8g_MicroDelay() { u8g_xMicroDelay(1); } + void u8g_10MicroDelay() { u8g_xMicroDelay(10); } + void u8g_Delay(uint16_t val) { delay(val); } } + //************************// // return free heap space diff --git a/Marlin/src/HAL/LINUX/HAL.h b/Marlin/src/HAL/LINUX/HAL.h index 1c8dbfd4dc..729f6c856e 100644 --- a/Marlin/src/HAL/LINUX/HAL.h +++ b/Marlin/src/HAL/LINUX/HAL.h @@ -79,10 +79,16 @@ extern HalSerial usb_serial; inline void HAL_init() {} // Utility functions -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-function" +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-function" +#endif + int freeMemory(); -#pragma GCC diagnostic pop + +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic pop +#endif // ADC #define HAL_ADC_VREF 5.0 diff --git a/Marlin/src/HAL/LINUX/include/Arduino.h b/Marlin/src/HAL/LINUX/include/Arduino.h index e28b474ede..6aeb0db583 100644 --- a/Marlin/src/HAL/LINUX/include/Arduino.h +++ b/Marlin/src/HAL/LINUX/include/Arduino.h @@ -67,8 +67,11 @@ void cli(); // Disable void sei(); // Enable void attachInterrupt(uint32_t pin, void (*callback)(), uint32_t mode); void detachInterrupt(uint32_t pin); -extern "C" void GpioEnableInt(uint32_t port, uint32_t pin, uint32_t mode); -extern "C" void GpioDisableInt(uint32_t port, uint32_t pin); + +extern "C" { + void GpioEnableInt(uint32_t port, uint32_t pin, uint32_t mode); + void GpioDisableInt(uint32_t port, uint32_t pin); +} // Program Memory #define pgm_read_ptr(addr) (*((void**)(addr))) @@ -92,9 +95,7 @@ using std::memcpy; #define strlen_P strlen // Time functions -extern "C" { - void delay(const int milis); -} +extern "C" void delay(const int milis); void _delay_ms(const int delay); void delayMicroseconds(unsigned long); uint32_t millis(); diff --git a/Marlin/src/HAL/LPC1768/HAL.cpp b/Marlin/src/HAL/LPC1768/HAL.cpp index 939f1e8a94..3614e95385 100644 --- a/Marlin/src/HAL/LPC1768/HAL.cpp +++ b/Marlin/src/HAL/LPC1768/HAL.cpp @@ -32,18 +32,13 @@ uint32_t HAL_adc_reading = 0; // U8glib required functions -extern "C" void u8g_xMicroDelay(uint16_t val) { - DELAY_US(val); -} -extern "C" void u8g_MicroDelay() { - u8g_xMicroDelay(1); -} -extern "C" void u8g_10MicroDelay() { - u8g_xMicroDelay(10); -} -extern "C" void u8g_Delay(uint16_t val) { - delay(val); +extern "C" { + void u8g_xMicroDelay(uint16_t val) { DELAY_US(val); } + void u8g_MicroDelay() { u8g_xMicroDelay(1); } + void u8g_10MicroDelay() { u8g_xMicroDelay(10); } + void u8g_Delay(uint16_t val) { delay(val); } } + //************************// // return free heap space diff --git a/Marlin/src/HAL/LPC1768/HAL.h b/Marlin/src/HAL/LPC1768/HAL.h index cb637e715d..51a13389b1 100644 --- a/Marlin/src/HAL/LPC1768/HAL.h +++ b/Marlin/src/HAL/LPC1768/HAL.h @@ -107,10 +107,16 @@ extern "C" volatile uint32_t _millis; // // Utility functions // -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-function" +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-function" +#endif + int freeMemory(); -#pragma GCC diagnostic pop + +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic pop +#endif // // ADC API diff --git a/Marlin/src/HAL/LPC1768/MarlinSerial.cpp b/Marlin/src/HAL/LPC1768/MarlinSerial.cpp index 5374e005d3..baad3f8f26 100644 --- a/Marlin/src/HAL/LPC1768/MarlinSerial.cpp +++ b/Marlin/src/HAL/LPC1768/MarlinSerial.cpp @@ -26,30 +26,19 @@ #if USING_SERIAL_0 MarlinSerial MSerial(LPC_UART0); - extern "C" void UART0_IRQHandler() { - MSerial.IRQHandler(); - } + extern "C" void UART0_IRQHandler() { MSerial.IRQHandler(); } #endif - #if USING_SERIAL_1 MarlinSerial MSerial1((LPC_UART_TypeDef *) LPC_UART1); - extern "C" void UART1_IRQHandler() { - MSerial1.IRQHandler(); - } + extern "C" void UART1_IRQHandler() { MSerial1.IRQHandler(); } #endif - #if USING_SERIAL_2 MarlinSerial MSerial2(LPC_UART2); - extern "C" void UART2_IRQHandler() { - MSerial2.IRQHandler(); - } + extern "C" void UART2_IRQHandler() { MSerial2.IRQHandler(); } #endif - #if USING_SERIAL_3 MarlinSerial MSerial3(LPC_UART3); - extern "C" void UART3_IRQHandler() { - MSerial3.IRQHandler(); - } + extern "C" void UART3_IRQHandler() { MSerial3.IRQHandler(); } #endif #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/LPC1768/main.cpp b/Marlin/src/HAL/LPC1768/main.cpp index 085b8ce04b..96faf54d7f 100644 --- a/Marlin/src/HAL/LPC1768/main.cpp +++ b/Marlin/src/HAL/LPC1768/main.cpp @@ -31,18 +31,18 @@ #include #include -extern "C" { - #include -} - #include "../../inc/MarlinConfig.h" #include "../../core/millis_t.h" #include "../../sd/cardreader.h" extern uint32_t MSC_SD_Init(uint8_t pdrv); -extern "C" int isLPC1769(); -extern "C" void disk_timerproc(); + +extern "C" { + #include + extern "C" int isLPC1769(); + extern "C" void disk_timerproc(); +} void SysTick_Callback() { disk_timerproc(); } diff --git a/Marlin/src/HAL/SAMD51/HAL.h b/Marlin/src/HAL/SAMD51/HAL.h index 7cb3635bd7..ff93101146 100644 --- a/Marlin/src/HAL/SAMD51/HAL.h +++ b/Marlin/src/HAL/SAMD51/HAL.h @@ -135,10 +135,16 @@ void HAL_idletask(); // FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); } -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-function" +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-function" +#endif + int freeMemory(); -#pragma GCC diagnostic pop + +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic pop +#endif #ifdef __cplusplus extern "C" { diff --git a/Marlin/src/HAL/STM32/HAL.h b/Marlin/src/HAL/STM32/HAL.h index c92c8890ea..16dc7a4539 100644 --- a/Marlin/src/HAL/STM32/HAL.h +++ b/Marlin/src/HAL/STM32/HAL.h @@ -140,15 +140,19 @@ void _delay_ms(const int delay); extern "C" char* _sbrk(int incr); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-function" +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-function" +#endif static inline int freeMemory() { volatile char top; return &top - reinterpret_cast(_sbrk(0)); } -#pragma GCC diagnostic pop +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic pop +#endif // // ADC diff --git a/Marlin/src/HAL/STM32F1/HAL.h b/Marlin/src/HAL/STM32F1/HAL.h index 2880865dbb..06f75662cf 100644 --- a/Marlin/src/HAL/STM32F1/HAL.h +++ b/Marlin/src/HAL/STM32F1/HAL.h @@ -189,8 +189,10 @@ inline void HAL_reboot() {} // reboot the board or restart the bootloader void _delay_ms(const int delay); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-function" +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-function" +#endif /* extern "C" { @@ -213,7 +215,9 @@ static int freeMemory() { return &top - reinterpret_cast(_sbrk(0)); } -#pragma GCC diagnostic pop +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic pop +#endif // // ADC diff --git a/Marlin/src/HAL/STM32F1/timers.h b/Marlin/src/HAL/STM32F1/timers.h index 6f360f6bfc..3e2e7775f1 100644 --- a/Marlin/src/HAL/STM32F1/timers.h +++ b/Marlin/src/HAL/STM32F1/timers.h @@ -129,8 +129,10 @@ timer_dev* get_timer_dev(int number); #define HAL_STEP_TIMER_ISR() extern "C" void stepTC_Handler() #endif -extern "C" void tempTC_Handler(); -extern "C" void stepTC_Handler(); +extern "C" { + void tempTC_Handler(); + void stepTC_Handler(); +} // ------------------------ // Public Variables diff --git a/Marlin/src/HAL/STM32_F4_F7/HAL.h b/Marlin/src/HAL/STM32_F4_F7/HAL.h index 00a65de792..85fbf098ff 100644 --- a/Marlin/src/HAL/STM32_F4_F7/HAL.h +++ b/Marlin/src/HAL/STM32_F4_F7/HAL.h @@ -162,15 +162,19 @@ int freeMemory() { } */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-function" +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-function" +#endif static inline int freeMemory() { volatile char top; return &top - reinterpret_cast(_sbrk(0)); } -#pragma GCC diagnostic pop +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic pop +#endif // // ADC diff --git a/Marlin/src/HAL/STM32_F4_F7/STM32F4/timers.cpp b/Marlin/src/HAL/STM32_F4_F7/STM32F4/timers.cpp index dc41f89131..8b753f7290 100644 --- a/Marlin/src/HAL/STM32_F4_F7/STM32F4/timers.cpp +++ b/Marlin/src/HAL/STM32_F4_F7/STM32F4/timers.cpp @@ -79,11 +79,9 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) { HAL_TIM_Base_Start_IT(&TimerHandle[timer_num].handle); } -extern "C" void TIM5_IRQHandler() { - ((void(*)())TimerHandle[0].callback)(); -} -extern "C" void TIM7_IRQHandler() { - ((void(*)())TimerHandle[1].callback)(); +extern "C" { + void TIM5_IRQHandler() { ((void(*)())TimerHandle[0].callback)(); } + void TIM7_IRQHandler() { ((void(*)())TimerHandle[1].callback)(); } } void HAL_timer_enable_interrupt(const uint8_t timer_num) { diff --git a/Marlin/src/HAL/STM32_F4_F7/STM32F7/timers.cpp b/Marlin/src/HAL/STM32_F4_F7/STM32F7/timers.cpp index f7ded7454d..bc8f76af09 100644 --- a/Marlin/src/HAL/STM32_F4_F7/STM32F7/timers.cpp +++ b/Marlin/src/HAL/STM32_F4_F7/STM32F7/timers.cpp @@ -83,11 +83,9 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) { } //forward the interrupt -extern "C" void TIM5_IRQHandler() { - ((void(*)())timerConfig[0].callback)(); -} -extern "C" void TIM7_IRQHandler() { - ((void(*)())timerConfig[1].callback)(); +extern "C" { + void TIM5_IRQHandler() { ((void(*)())timerConfig[0].callback)(); } + void TIM7_IRQHandler() { ((void(*)())timerConfig[1].callback)(); } } void HAL_timer_set_compare(const uint8_t timer_num, const uint32_t compare) { diff --git a/Marlin/src/HAL/TEENSY31_32/HAL.h b/Marlin/src/HAL/TEENSY31_32/HAL.h index 8ab358e9e1..9156aadb4d 100644 --- a/Marlin/src/HAL/TEENSY31_32/HAL.h +++ b/Marlin/src/HAL/TEENSY31_32/HAL.h @@ -97,12 +97,16 @@ inline void HAL_reboot() {} // reboot the board or restart the bootloader 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(); -} -#pragma GCC diagnostic pop +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-function" +#endif + +extern "C" int freeMemory(); + +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic pop +#endif // ADC diff --git a/Marlin/src/HAL/TEENSY31_32/timers.h b/Marlin/src/HAL/TEENSY31_32/timers.h index 135b328830..61b8673596 100644 --- a/Marlin/src/HAL/TEENSY31_32/timers.h +++ b/Marlin/src/HAL/TEENSY31_32/timers.h @@ -74,10 +74,10 @@ typedef uint32_t hal_timer_t; #define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM) #ifndef HAL_STEP_TIMER_ISR - #define HAL_STEP_TIMER_ISR() extern "C" void ftm0_isr() //void TC3_Handler() + #define HAL_STEP_TIMER_ISR() extern "C" void ftm0_isr() //void TC3_Handler() #endif #ifndef HAL_TEMP_TIMER_ISR - #define HAL_TEMP_TIMER_ISR() extern "C" void ftm1_isr() //void TC4_Handler() + #define HAL_TEMP_TIMER_ISR() extern "C" void ftm1_isr() //void TC4_Handler() #endif void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency); diff --git a/Marlin/src/HAL/TEENSY35_36/HAL.h b/Marlin/src/HAL/TEENSY35_36/HAL.h index 2b735d6224..04151e8378 100644 --- a/Marlin/src/HAL/TEENSY35_36/HAL.h +++ b/Marlin/src/HAL/TEENSY35_36/HAL.h @@ -103,12 +103,16 @@ inline void HAL_reboot() {} // reboot the board or restart the bootloader 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(); -} -#pragma GCC diagnostic pop +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-function" +#endif + +extern "C" int freeMemory(); + +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic pop +#endif // ADC diff --git a/Marlin/src/HAL/TEENSY35_36/timers.h b/Marlin/src/HAL/TEENSY35_36/timers.h index 5c623cd801..99269ac657 100644 --- a/Marlin/src/HAL/TEENSY35_36/timers.h +++ b/Marlin/src/HAL/TEENSY35_36/timers.h @@ -73,10 +73,10 @@ typedef uint32_t hal_timer_t; #define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM) #ifndef HAL_STEP_TIMER_ISR - #define HAL_STEP_TIMER_ISR() extern "C" void ftm0_isr() //void TC3_Handler() + #define HAL_STEP_TIMER_ISR() extern "C" void ftm0_isr() //void TC3_Handler() #endif #ifndef HAL_TEMP_TIMER_ISR - #define HAL_TEMP_TIMER_ISR() extern "C" void ftm1_isr() //void TC4_Handler() + #define HAL_TEMP_TIMER_ISR() extern "C" void ftm1_isr() //void TC4_Handler() #endif void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency); diff --git a/Marlin/src/HAL/TEENSY40_41/HAL.h b/Marlin/src/HAL/TEENSY40_41/HAL.h index 1e0043342d..28f511631e 100644 --- a/Marlin/src/HAL/TEENSY40_41/HAL.h +++ b/Marlin/src/HAL/TEENSY40_41/HAL.h @@ -120,12 +120,16 @@ uint8_t HAL_get_reset_source(); FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); } -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-function" -extern "C" { - uint32_t freeMemory(); -} -#pragma GCC diagnostic pop +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-function" +#endif + +extern "C" uint32_t freeMemory(); + +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic pop +#endif // ADC diff --git a/Marlin/src/HAL/TEENSY40_41/timers.h b/Marlin/src/HAL/TEENSY40_41/timers.h index 7e4cd080cb..556333d7f4 100644 --- a/Marlin/src/HAL/TEENSY40_41/timers.h +++ b/Marlin/src/HAL/TEENSY40_41/timers.h @@ -72,14 +72,16 @@ typedef uint32_t hal_timer_t; #define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM) #ifndef HAL_STEP_TIMER_ISR - #define HAL_STEP_TIMER_ISR() extern "C" void stepTC_Handler() // GPT1_Handler() + #define HAL_STEP_TIMER_ISR() extern "C" void stepTC_Handler() // GPT1_Handler() #endif #ifndef HAL_TEMP_TIMER_ISR - #define HAL_TEMP_TIMER_ISR() extern "C" void tempTC_Handler() // GPT2_Handler() + #define HAL_TEMP_TIMER_ISR() extern "C" void tempTC_Handler() // GPT2_Handler() #endif -extern "C" void stepTC_Handler(); -extern "C" void tempTC_Handler(); +extern "C" { + void stepTC_Handler(); + void tempTC_Handler(); +} void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency); diff --git a/Marlin/src/libs/duration_t.h b/Marlin/src/libs/duration_t.h index 9c1d72dfaf..bd654b7bad 100644 --- a/Marlin/src/libs/duration_t.h +++ b/Marlin/src/libs/duration_t.h @@ -106,8 +106,10 @@ struct duration_t { return this->value; } - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wformat-overflow" + #if GCC_VERSION <= 50000 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wformat-overflow" + #endif /** * @brief Formats the duration as a string @@ -167,5 +169,7 @@ struct duration_t { } } - #pragma GCC diagnostic pop + #if GCC_VERSION <= 50000 + #pragma GCC diagnostic pop + #endif };