Skip to content

Commit

Permalink
Reduce unrecognized option warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Nov 26, 2020
1 parent 45a9d00 commit 1116e8e
Show file tree
Hide file tree
Showing 14 changed files with 90 additions and 38 deletions.
10 changes: 7 additions & 3 deletions Marlin/src/HAL/AVR/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
#if GCC_VERSION <= 50000
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif

__C_LANG__ int freeMemory();

#pragma GCC diagnostic pop
#if GCC_VERSION <= 50000
#pragma GCC diagnostic pop
#endif

// ADC
#ifdef DIDR2
Expand Down
10 changes: 7 additions & 3 deletions Marlin/src/HAL/DUE/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,15 @@ 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

__C_LANG__ char *dtostrf(double __val, signed char __width, unsigned char __prec, char *__s);
10 changes: 7 additions & 3 deletions Marlin/src/HAL/ESP32/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +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);

Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/HAL/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@

#include "platforms.h"

#ifndef GCC_VERSION
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif

#ifdef __cplusplus
#define __C_LANG__ extern "C"
#define __C_START__ extern "C" {
Expand Down
10 changes: 7 additions & 3 deletions Marlin/src/HAL/LINUX/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +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
Expand Down
10 changes: 7 additions & 3 deletions Marlin/src/HAL/LPC1768/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,16 @@ __C_LANG__ 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
Expand Down
10 changes: 7 additions & 3 deletions Marlin/src/HAL/SAMD51/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,15 @@ 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

__C_LANG__ char *dtostrf(double __val, signed char __width, unsigned char __prec, char *__s);
10 changes: 7 additions & 3 deletions Marlin/src/HAL/STM32/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,19 @@ void _delay_ms(const int delay);

__C_LANG__ 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<char*>(_sbrk(0));
}

#pragma GCC diagnostic pop
#if GCC_VERSION <= 50000
#pragma GCC diagnostic pop
#endif

//
// ADC
Expand Down
10 changes: 7 additions & 3 deletions Marlin/src/HAL/STM32F1/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

__C_LANG__ char* _sbrk(int incr);

Expand All @@ -199,7 +201,9 @@ static int freeMemory() {
return &top - reinterpret_cast<char*>(_sbrk(0));
}

#pragma GCC diagnostic pop
#if GCC_VERSION <= 50000
#pragma GCC diagnostic pop
#endif

//
// ADC
Expand Down
10 changes: 7 additions & 3 deletions Marlin/src/HAL/STM32_F4_F7/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,19 @@ void _delay_ms(const int delay);

__C_LANG__ 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<char*>(_sbrk(0));
}

#pragma GCC diagnostic pop
#if GCC_VERSION <= 50000
#pragma GCC diagnostic pop
#endif

//
// ADC
Expand Down
10 changes: 7 additions & 3 deletions Marlin/src/HAL/TEENSY31_32/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
#if GCC_VERSION <= 50000
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif

__C_LANG__ int freeMemory();

#pragma GCC diagnostic pop
#if GCC_VERSION <= 50000
#pragma GCC diagnostic pop
#endif

// ADC

Expand Down
10 changes: 7 additions & 3 deletions Marlin/src/HAL/TEENSY35_36/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
#if GCC_VERSION <= 50000
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif

__C_LANG__ int freeMemory();

#pragma GCC diagnostic pop
#if GCC_VERSION <= 50000
#pragma GCC diagnostic pop
#endif

// ADC

Expand Down
10 changes: 7 additions & 3 deletions Marlin/src/HAL/TEENSY40_41/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,18 @@ 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"
#if GCC_VERSION <= 50000
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif

__C_LANG__ {
uint32_t freeMemory();
}

#pragma GCC diagnostic pop
#if GCC_VERSION <= 50000
#pragma GCC diagnostic pop
#endif

// ADC

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/libs/duration_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ struct duration_t {
return this->value;
}

#if GCC_VERSION <= 50000 // <= 5.0.0
#if GCC_VERSION <= 50000
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-overflow"
#endif
Expand Down Expand Up @@ -169,7 +169,7 @@ struct duration_t {
}
}

#if GCC_VERSION <= 50000 // <= 5.0.0
#if GCC_VERSION <= 50000
#pragma GCC diagnostic pop
#endif
};

0 comments on commit 1116e8e

Please sign in to comment.