Re: Discrepancy in inttypes.h

Corinna Vinschen <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Hi Daniel,

On Sep 30 11:09, Daniel Wagenaar wrote:
> There is an apparent discrepancy in naming conventions between
> 
>     newlib/libc/include/machine/_default_types.h
> 
> and
> 
>     newlib/libc/include/inttypes.h
> 
> The first defines the macro "___int64_t_defined" (with three underscores),
> whereas the second tests for "__int64_t_defined". As a consequence, the
> macros "PRIu64" and friends never get defined. (This causes build failures
> for some of the tests included with the pico-sdk
> [https://github.com/raspberrypi/pico-sdk.git]). There is a file called
> 
>     newlib/libc/include/sys/_stdint.h
> 
> which translates from the "___" to "__" versions, but somehow that does not
> do the trick. Happy to test more if helpful.
> 
> Tested with commit 1b7c72fdcc4bde7520407d2d3364146f04fb8312 as well as
> version 4.4.0.20231231-2 (Ubuntu 24.04.1).

Works as expected for me:

  $ cat > inttypes.c <<EOF
  #include <inttypes.h>

  PRId64
  EOF
  $ gcc -E inttypes.c
  [...]
  # 2 "inttypes.c" 2

  "l"
  # 3 "inttypes.c"
  "d"

inttypes.h includes stdint.h which in turn includes sys/_stdint.h.
sys/_stdint.h includes machine/_default_types.h.

There are only two files including sys/_stdint.h, that is stdint.h and
sys/types.h.  So I tried the above simple testcase additionally with
including sys/types.h, stdint.h and inttypes.h in all six permutations
of including order.  PRId64 was always resolved.

Please try to come up with a simple testcase as the above.  We have to
see a combination of including files exhibiting the problem.


Thanks,
Corinna
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.