This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [newlib] print formats for FAST and LEAST types


On Jul 14 12:17, Andre Vieira wrote:
> Hello,
> 
> Kevin Bracey commented on Launchpad that he was having issues with a
> mismatch between <inttypes.h> and <stdint.h> when printing an int_fast32_t.
> See https://answers.launchpad.net/gcc-arm-embedded/+question/269083
> 
> This is due to the fact that on targets where the size of âintâ and âlongâ
> are equal and 32 bits, the current header files will configure the type of
> int_fast32_t to be âintâ and PRIdFAST32 to be âldâ and make printf thus
> expect a âlongâ. The macroâs used in <stdint.h> come from
> âgcc/config/newlib-stdint.hâ.

Are you looking into an older version of newlib by any chance?  We
added code to newlib's headers to check explicitely at runtime whether
__INT32_TYPE__ is int or long, and set the PRIxxx32 macros accordingly.

See https://sourceware.org/git/?p=newlib-cygwin.git;h=496380c

I just checked this on 32 bit Cygwin:

  $ gcc -E - <<EOF
  #include <inttypes.h>
  #include <stdint.h>
  __INT_FAST32_TYPE__
  PRIdFAST32
  EOF
  [...]
  int
  "d"
  
If there's still anything wrong with that, feel free to send patches.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: pgpZUsvpDHPIW.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]