From 39fae9e3a3f1e627058c594d4d1efd5e6262bb32 Mon Sep 17 00:00:00 2001
From: odewdney <oliver.dewdney@lbi.com>
Date: Sat, 3 Jan 2015 21:30:16 +0000
Subject: [PATCH] Fix progmem warning

Borrow code from https://github.com/arduino/Arduino/issues/1793
---
 Marlin/Marlin.h | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h
index d8012976c4..e0915ad64e 100644
--- a/Marlin/Marlin.h
+++ b/Marlin/Marlin.h
@@ -38,6 +38,23 @@
 #include "HardwareSerial.h"
 #endif
 
+
+#ifdef __GNUC__
+#ifndef GCC_VERSION
+#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+#endif
+#if GCC_VERSION < 40602 // Test for GCC < 4.6.2
+#ifdef PROGMEM
+#undef PROGMEM
+#define PROGMEM __attribute__((section(".progmem.data"))) // Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734#c4
+#ifdef PSTR
+#undef PSTR
+#define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];})) // Copied from pgmspace.h in avr-libc source
+#endif
+#endif
+#endif
+#endif
+
 #include "MarlinSerial.h"
 
 #ifndef cbi
@@ -269,4 +286,4 @@ extern void digipot_i2c_init();
 
 #endif
 
-extern void calculate_volumetric_multipliers();
\ No newline at end of file
+extern void calculate_volumetric_multipliers();
-- 
GitLab