From 4c2e0a7635d555080dbd4dfd2f25df534d2c0464 Mon Sep 17 00:00:00 2001 From: Florian Fleissner Date: Thu, 21 Nov 2019 12:31:47 +0100 Subject: [PATCH] Focus serial template version of send(...) - call by value Using call by reference in FocusSerial::send(...) and FocusSerial::sendRaw(...) causes linker errors due to undefined symbols if constexpr constants are passed to the methods. This is because if a constexpr value is bound to a reference this is the same as taking the address of the value. Thus, the compiler has to generate an instance. Some constants like e.g. FocusSerial::NEWLINE do not come with an instance. This seems not to cause problems with avr-gcc up to now but generates linker errors during virtual compiles with later gcc versions (e.g. gcc 8.3.0). This change does not incur any additional overhead as all version of FocusSerial's send methods are already inlined, and the templated versions root to the non-template versions of the send methods that only accept call-by-value anyway. Signed-off-by: Florian Fleissner --- src/kaleidoscope/plugin/FocusSerial.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kaleidoscope/plugin/FocusSerial.h b/src/kaleidoscope/plugin/FocusSerial.h index 0b7051f7..5a7230c0 100644 --- a/src/kaleidoscope/plugin/FocusSerial.h +++ b/src/kaleidoscope/plugin/FocusSerial.h @@ -45,14 +45,14 @@ class FocusSerial : public kaleidoscope::Plugin { Kaleidoscope.serialPort().print(SEPARATOR); } template - void send(Var v, const Vars&... vars) { + void send(Var v, Vars... vars) { send(v); send(vars...); } void sendRaw() {} template - void sendRaw(Var v, const Vars&... vars) { + void sendRaw(Var v, Vars... vars) { Kaleidoscope.serialPort().print(v); sendRaw(vars...); }