From 3aa17d623eb1e78f6bc1ce03636497d1f3f789e0 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/STM32/HAL.h | 10 +++++++--- Marlin/src/HAL/STM32F1/HAL.h | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Marlin/src/HAL/STM32/HAL.h b/Marlin/src/HAL/STM32/HAL.h index be0cc309626c..7e39a56e82be 100644 --- a/Marlin/src/HAL/STM32/HAL.h +++ b/Marlin/src/HAL/STM32/HAL.h @@ -150,15 +150,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 30bf60b6e8a1..aa5205c119c0 100644 --- a/Marlin/src/HAL/STM32F1/HAL.h +++ b/Marlin/src/HAL/STM32F1/HAL.h @@ -199,8 +199,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" { @@ -215,7 +217,9 @@ static inline int freeMemory() { return &top - _sbrk(0); } -#pragma GCC diagnostic pop +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic pop +#endif // // ADC