Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiline raw Strings not parsed in Macro #3352

Closed
romanseidl opened this issue Jun 13, 2017 · 4 comments · Fixed by #6294
Closed

Multiline raw Strings not parsed in Macro #3352

romanseidl opened this issue Jun 13, 2017 · 4 comments · Fixed by #6294

Comments

@romanseidl
Copy link

romanseidl commented Jun 13, 2017

Basic Infos

The esp8266 toolkit uses gcc 4.8.2 an thus it fails to parse a multiline raw String when it is passed as an argument to a macro. The same sketch as below will build without errors when using the original Arduino toolkit (when switching to AVR / Arduino Hardware in the Arduino IDE).

This was fixed in gcc 4.9 :
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57824

Sketch

#include <Arduino.h>

#define S(s) s

const char y[] = S(R"(
abc
)");

void setup() {
}

void loop() {
}

Error Message

sketch_jun13a:3: error: unterminated raw string
 const char y[] = S(R"(
                    ^
exit status 1
unterminated raw string

Resolution?

Is there a reason on why you are using the 4.8.2 version of gcc? Max Filippov seems to provide newer versions on /~https://github.com/jcmvbkbc/linux-xtensa

So would it be possible to use a newer gcc version? Or would one have to "backfix" the old gcc for some reason?

@devyte
Copy link
Collaborator

devyte commented Sep 5, 2017

The link you point to seems to be a linux port for xtensa architecture, which means running linux on xtensa. What we are using is what is called a cross-compiler: a compiler that runs on x64 architecure, but that produces a binary meant to be run on xtensa.
Is there a cross-compiler in that repo somewhere? At first glance I didn't see one (I didn't look thoroughly).

The reason we are using 4.8.2 is that the toolchain comes mostly from espressif, and that compiler version is the official one for the espressif SDK. Keep in mind that these core libs are built on top of the espressif SDK, and that SDK has elements that are distributed as precompiled binary blobs (they are proprietary code). In theory, there could be binary incompatibilities between outputs (I have already encountered this on x64 compilers).

On the other hand, I wouldn't mind moving to a new compiler. I invite you to:

  • pull the compiler out of the repo, if it is there
  • test it by temporarily replacing the current official compiler
  • load a simple test sketch compiled with it into an ESP

If you are willing to pick up the challenge, I can provide some guidance, or can look for someone else to provide it.

@devyte
Copy link
Collaborator

devyte commented Jan 8, 2018

@igrr I just found out that with gcc 5 there is a change in abi, which could impact us when we move to a newer gcc, e.g.: 5.2. I don't know details, though.

@igrr
Copy link
Member

igrr commented Jan 8, 2018

As long as you don't link pre-5 code which uses libstdc++ with new libstdc++, all should be fine.

@devyte devyte modified the milestones: 2.5.0, 3.0.0 Jan 15, 2018
@devyte
Copy link
Collaborator

devyte commented Jan 15, 2018

Changing milestone due to high impact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants