Closed
Description
This core contains a few very generic defines in utils.h:
Arduino_Core_STM32/cores/arduino/utils.h
Lines 6 to 13 in fa0dcc8
Especially the str
and xstr
defines are problematic, since you might be using those as function or method names, which triggers the preprocessor. I ran into this issue when using the boost library, which has a str
method somewhere, but this can be easily reproduced with this sketch:
void str() { }
void setup() { }
void loop() { }
Which gives:
In file included from /home/matthijs/.arduino15/packages/STM32/hardware/stm32/1.4.0/cores/arduino/wiring.h:31:0,
from /home/matthijs/.arduino15/packages/STM32/hardware/stm32/1.4.0/cores/arduino/Arduino.h:32,
from /tmp/arduino_build_gdfirmware/sketch/sketch_dec13a.ino.cpp:1:
sketch_dec13a:1:10: error: expected unqualified-id before string constant
void str() { }
^
/home/matthijs/.arduino15/packages/STM32/hardware/stm32/1.4.0/cores/arduino/utils.h:13:17: note: in definition of macro 'str'
#define str(s) #s
Here, it points to the problematic macro, but in my original problem case the second message was not present, making this particularly tricky to diagnose.
As for resolving this:
- A grep suggests that the
str()
andxstr()
macros are not actually used in the entire core, so I suggest removing them. - The
CONCAT
andCONCATS
macros could perhaps be rename as well, but better would be to not expose them from header files. grep shows that these macros are only used in .c files, so simply includingutils.h
from those .c files, and dropping the include fromwiring.h
sounds like the best approach to me.