Skip to content

Generated function prototypes for const __FlashStringHelper are incorrect. #71

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

Closed
ffissore opened this issue Nov 23, 2015 · 1 comment
Closed
Assignees
Milestone

Comments

@ffissore
Copy link
Contributor

From @Etherfi on November 22, 2015 22:37

Example code:

#include 

void setup() {
  Serial.print(test(true));
}

void loop() {}

const __FlashStringHelper* test(bool temp) {
  if (temp)
    return F("x");
  return F("y");
}

Generated code in sketch_nov22a.ino.cpp:

#include 
#line 1
#line 1 "C:\\Users\\user\\AppData\\Local\\Temp\\arduino_4790fd94ec03044aef00d007e6734c0b\\sketch_nov22a.ino"
#include 

#line 3 "C:\\Users\\user\\AppData\\Local\\Temp\\arduino_4790fd94ec03044aef00d007e6734c0b\\sketch_nov22a.ino"
void setup();
#line 7 "C:\\Users\\user\\AppData\\Local\\Temp\\arduino_4790fd94ec03044aef00d007e6734c0b\\sketch_nov22a.ino"
void loop();
#line 9 "C:\\Users\\user\\AppData\\Local\\Temp\\arduino_4790fd94ec03044aef00d007e6734c0b\\sketch_nov22a.ino"
const__FlashStringHelper* test(bool temp);
#line 3
void setup() {
  Serial.print(test(true));
}

void loop() {}

const __FlashStringHelper* test(bool temp) {
  if (temp)
    return F("x");
  return F("y");
}

Note the function prototype "const__FlashStringHelper* test(bool temp);" is missing the space after "const".

As expected, it fails to compile:

sketch_nov22a:9: error: 'const__FlashStringHelper' does not name a type

 const __FlashStringHelper* test(bool temp) {
 ^

C:\Users\taylorc\AppData\Local\Temp\arduino_4790fd94ec03044aef00d007e6734c0b\sketch_nov22a.ino: In function 'void setup()':

sketch_nov22a:4: error: 'test' was not declared in this scope

   Serial.print(test(true));
                         ^

exit status 1
'const__FlashStringHelper' does not name a type

Copied from original issue: arduino/Arduino#4202

@ffissore
Copy link
Contributor Author

From @per1234 on November 22, 2015 22:42

Duplicate of #69

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

No branches or pull requests

1 participant