Re: Issue: #include <stdio.h> shall not cause intmax_t to be defined

Corinna Vinschen <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On May  4 11:02, Sebastian Huber wrote:
> On 04/05/2022 10:54, Corinna Vinschen wrote:
> > On May  4 10:41, Sebastian Huber wrote:
> > > On 04/05/2022 10:37, Corinna Vinschen wrote:
> > > > On May  4 09:59, Sebastian Huber wrote:
> > > > > On 03/05/2022 19:00, Corinna Vinschen wrote:
> > > > > > On Apr 27 00:41, Pavel M wrote:
> > > > > > > Hi all,
> > > > > > > 
> > > > > > > Issue: #include <stdio.h> shall not cause intmax_t to be defined. However,
> > > > > > > now it causes. This is because now <stdio.h> includes <sys/types.h>, which
> > > > > > > includes <sys/_stdint.h>.
> > > > > > > Note: per C11 the types intmax_t and uintmax_t defined in the header
> > > > > > > <stdint.h>, and <stdint.h> is not included in <stdio.h>.
> > > > > > > Consider fixing.
> > > > > > I pushed a patch to fix this.
> > > > > In FreeBSD, <sys/types.h> provides the stdint.h types. Could we bring back
> > > > > this with
> > > > Is that with FreeeBSD only, or is that with BSDs in general?
> > > It seems to be a general BSD feature:
> > > 
> > > https://github.com/openbsd/src/blob/master/sys/sys/types.h#L75
> > > 
> > > http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/sys/types.h?rev=1.105&content-type=text/x-cvsweb-markup
> > If the BSDs expose stdint.h types via stdio.h anyway, what's the sense
> > of not exposing it in the non-_BSD_VISIBLE scenario?  _BSD_VISIBLE is
> > default anyway, so the non-exposure of the stdint types is restricted to
> > files which define _XOPEN_SOURCE or some such.
> > 
> > Is there actually a "MUST NOT" defined anywhere in the standards or
> > was this change unnecessary?
> 
> I think the reported problem with stdio.h is because the Newlib stdio.h
> includes <sys/types.h>. In FreeBSD for example, <sys/_types.h> is included
> with local type definitions, see:
> 
> https://sourceware.org/pipermail/newlib/2022/019592.html

I guess I'm an idiot.  I just dropped my patch and applied yours
instead. It fixes *all* the problems requiring more patches to other
files I saw while building with my change to sys/types.h.

So, I think what I'll do is revert my patch and apply yours instead.

The other patch of your patch series is obseleted by this.


Thanks a lot!


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.