From 3f52d75cf76b515166e266d0705c5532110efdf2 Mon Sep 17 00:00:00 2001 From: Nico Tonnhofer Date: Fri, 8 Dec 2017 18:36:59 +0100 Subject: [PATCH] GCC <= 4 need a builtin function for constant sqrt expressions --- config_wrapper.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/config_wrapper.h b/config_wrapper.h index ecd34ad..c9ec569 100644 --- a/config_wrapper.h +++ b/config_wrapper.h @@ -125,3 +125,16 @@ #define TEMP_EWMA 1000 #warning TEMP_EWMA scaling changed! Take a look in your printer.xxx.h. #endif + +/** + * With GCC major >= 5 we can calculate constant sqrt expressions + * lower versions, e.g. in the Arduino IDE, need for this a + * __builtin_ function. + * + * "warning: initializer element is not a constant expression" + * + * Someone may extend this later also for sin/cos. +*/ +#if (__GNUC__ <= 4) +#define sqrt __builtin_sqrt +#endif