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 afe5027 commit 45dc079
Show file tree
Hide file tree
Showing 14 changed files with 117 additions and 51 deletions.
16 changes: 10 additions & 6 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"
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
Expand Down
12 changes: 9 additions & 3 deletions Marlin/src/HAL/DUE/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
12 changes: 9 additions & 3 deletions Marlin/src/HAL/ESP32/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

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

#include HAL_PATH(.,HAL.h)

#ifdef SERIAL_PORT_2
Expand Down
12 changes: 9 additions & 3 deletions Marlin/src/HAL/LINUX/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 9 additions & 3 deletions Marlin/src/HAL/LPC1768/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 9 additions & 3 deletions Marlin/src/HAL/SAMD51/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
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);

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<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

/*
extern "C" {
Expand All @@ -213,7 +215,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 @@ -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<char*>(_sbrk(0));
}

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

//
// ADC
Expand Down
16 changes: 10 additions & 6 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"
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

Expand Down
16 changes: 10 additions & 6 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"
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

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

Expand Down
10 changes: 7 additions & 3 deletions Marlin/src/libs/duration_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -167,5 +169,7 @@ struct duration_t {
}
}

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

0 comments on commit 45dc079

Please sign in to comment.