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

Compile error when using fixed size integer macros from inttypes.h #8220

Closed
6 tasks done
ardui-no opened this issue Jul 16, 2021 · 2 comments · Fixed by #8222
Closed
6 tasks done

Compile error when using fixed size integer macros from inttypes.h #8220

ardui-no opened this issue Jul 16, 2021 · 2 comments · Fixed by #8222
Assignees
Milestone

Comments

@ardui-no
Copy link

ardui-no commented Jul 16, 2021

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: [other]
  • Core Version: [2021-07-16]
  • Development Env: [Arduino IDE]
  • Operating System: [Ubuntu]

Settings in IDE

  • Module: [Generic ESP8266 Module]
  • Flash Mode: [dout]
  • Flash Size: [1MB]
  • lwip Variant: [v2 Lower Memory]
  • Reset Method: [nodemcu]
  • Flash Frequency: [40Mhz]
  • CPU Frequency: [80Mhz]
  • Upload Using: [SERIAL]
  • Upload Speed: [115200] (serial upload only)

Problem Description

Compile error when using the fixed size integer macros from inttypes.h with library versions 3.0.0+ but was OK in previous versions (e.g. v2.7.4). The code example also compiles OK on GNU GCC v7.1.1

MCVE Sketch

#include <Arduino.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdio.h>

void setup() {
  char buffer[100] = {0};
  uint32_t v = 12345;
  
  sprintf(buffer,"%" PRIu32, v);
}

void loop() {
}

Debug Messages

Error message is:

MCVE.ino: In function 'void setup()':
MCVE:10:21: error: expected ')' before '__INT32'
   10 |   sprintf(buffer,"%" PRIu32, v);
      |          ~          ^
      |                     )
exit status 1
expected ')' before '__INT32'
@earlephilhower earlephilhower self-assigned this Jul 17, 2021
@earlephilhower earlephilhower added this to the 3.0.2 milestone Jul 17, 2021
@earlephilhower
Copy link
Collaborator

Repro'd. The newlib needs an update to remove the stale xtensa-specific _intsup.h and use the standard one. So a new toolchain build is required.

@earlephilhower
Copy link
Collaborator

Reopening until I actually get a build running with the newly compiled toolchain!

earlephilhower added a commit to earlephilhower/Arduino that referenced this issue Jul 17, 2021
Update toolchain (newlib) to supply proper definitions for PRxxx macros.
Fixes esp8266#8220

Added a PRxxx macro to an example to ensure CI will catch any problem like
this in the future.
d-a-v pushed a commit that referenced this issue Jul 26, 2021
* Fix PRxxx printf format macros

Update toolchain (newlib) to supply proper definitions for PRxxx macros.
Fixes #8220

Added a PRxxx macro to an example to ensure CI will catch any problem like
this in the future.
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

Successfully merging a pull request may close this issue.

2 participants