marlin
"Macro expansion fails when PID_DEBUG enabled
SERIAL_ECHO_START macro is defined by default in Marlin.h and it takes no arguments.
Bug fixed by commit 8c4377dd635
| Type | WrongFunArgNum |
| Config | "PIDTEMP && PID_DEBUG" (2nd degree) |
| Fix-in | code |
| Location | temperature/ |
#ifndef MARLIN_H
const char echomagic[] ="echo:";
#define SERIAL_ECHO_START (serialprint(echomagic))
void serialprint(const char *str){
printf("%s\n", str);
}
#endif
void manage_heater(){
float pid_output = 1;
int e = 0;
#ifdef PIDTEMP
#ifdef PID_DEBUG
SERIAL_ECHO_START(" PIDDEBUG "); // ERROR
#endif
#else
pid_output = 0;
#endif
}
int main(int argc, char** argv)
{
manage_heater();
return 0;
}
diff --git a/simple/8c4377d.c b/simple/8c4377d.c
index 32b9cb3..d426094 100644
--- a/simple/8c4377d.c
+++ b/simple/8c4377d.c
@@ -13,7 +13,7 @@ int e = 0;
#ifdef PIDTEMP
#ifdef PID_DEBUG
- SERIAL_ECHO_START(" PIDDEBUG "); // ERROR
+ SERIAL_ECHO_START;
#endif
#else
pid_output = 0;
#ifndef MARLIN_H
const char echomagic[] ="echo:";
#endif
int main(int argc, char** argv)
{
#ifndef MARLIN_H
#define SERIAL_ECHO_START (printf("%s\n", echomagic));
#endif
float pid_output = 1;
int e = 0;
#ifdef PIDTEMP
#ifdef PID_DEBUG
SERIAL_ECHO_START(" PIDDEBUG "); // ERROR
#endif
#else
pid_output = 0;
#endif
return 0;
}
. call Marlin/temperature.cpp:406: void manage_heater()
. 452: #define SERIAL_ECHO_START(" PIDDEBUG ")
// SERIAL_ECHO_START does not take any parameters
. ERROR Marlin.h:77: error: void value not ignored as it ought to be
// #define SERIAL_ECHO_START (serialprintPGM(echomagic))
// temperature.cpp:452:5: note: in expansion of macro 'SERIAL_ECHO_START'