If you put:
#define DO_NOTHING(s) (s)
DO_NOTHING(R"xyz(Hello
World)xyz")
you can see g++ choke on preprocessing the raw string literal in the macro invocation with the latest esp8266 board package as of writing (version 2.7.4). This comes with g++ 4.8.2 for xtensa.
~/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/xtensa-lx106-elf-g++ -E donothing.h
You may need to adjust the command-line for your system. donothing.h is just the macro and invocation described above.
Result:
# 1 "donothing.h"
# 1 "<command-line>"
# 1 "donothing.h"
donothing.h:3:13: warning: missing terminating " character [enabled by default]
DO_NOTHING(R"xyz(Hello
^
(R"xyz(Hello World)
donothing.h:4:10: warning: missing terminating " character [enabled by default]
World)xyz")
^
xyz")
This does not happen with g++ 9.3.0 on an amd64 Linux target.
As a workaround you can reconstruct (more or less) what the F() macro does with the following:
void setup() {
Serial.begin(9600);
}
void loop() {
static const char pgm_str[] PROGMEM = (R"xyz(Hello
World)xyz");
Serial.println(FPSTR(pgm_str));
delay(4000);
}
\0
to the end? Maybe that helps, as the error message complains about the string not being terminatedR
, how should\0
be evaluated as string termination?