public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* Issue: #include <stdio.h> shall not cause intmax_t to be defined
@ 2022-04-26 21:41 Pavel M
  2022-05-03 17:00 ` Corinna Vinschen
  0 siblings, 1 reply; 10+ messages in thread
From: Pavel M @ 2022-04-26 21:41 UTC (permalink / raw)
  To: newlib

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.

--
Pavel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Issue: #include <stdio.h> shall not cause intmax_t to be defined
  2022-04-26 21:41 Issue: #include <stdio.h> shall not cause intmax_t to be defined Pavel M
@ 2022-05-03 17:00 ` Corinna Vinschen
  2022-05-04  7:59   ` Sebastian Huber
  0 siblings, 1 reply; 10+ messages in thread
From: Corinna Vinschen @ 2022-05-03 17:00 UTC (permalink / raw)
  To: Pavel M; +Cc: newlib

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.


Thanks,
Corinna


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Issue: #include <stdio.h> shall not cause intmax_t to be defined
  2022-05-03 17:00 ` Corinna Vinschen
@ 2022-05-04  7:59   ` Sebastian Huber
  2022-05-04  8:37     ` Corinna Vinschen
  0 siblings, 1 reply; 10+ messages in thread
From: Sebastian Huber @ 2022-05-04  7:59 UTC (permalink / raw)
  To: newlib

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

#if __BSD_VISIBLE
#include <machine/endian.h>
#include <sys/select.h>
#include <sys/_stdint.h>
#  define	physadr		physadr_t
#  define	quad		quad_t

?

In addition, the C11 header files should not include <sys/types.h>.

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Issue: #include <stdio.h> shall not cause intmax_t to be defined
  2022-05-04  7:59   ` Sebastian Huber
@ 2022-05-04  8:37     ` Corinna Vinschen
  2022-05-04  8:41       ` Sebastian Huber
  0 siblings, 1 reply; 10+ messages in thread
From: Corinna Vinschen @ 2022-05-04  8:37 UTC (permalink / raw)
  To: newlib

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?

> #if __BSD_VISIBLE
> #include <machine/endian.h>
> #include <sys/select.h>
> #include <sys/_stdint.h>
> #  define	physadr		physadr_t
> #  define	quad		quad_t
> 
> ?
> 
> In addition, the C11 header files should not include <sys/types.h>.

Which files are these exactly?  Feel free to submit patches.


Corinna


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Issue: #include <stdio.h> shall not cause intmax_t to be defined
  2022-05-04  8:37     ` Corinna Vinschen
@ 2022-05-04  8:41       ` Sebastian Huber
  2022-05-04  8:54         ` Corinna Vinschen
  0 siblings, 1 reply; 10+ messages in thread
From: Sebastian Huber @ 2022-05-04  8:41 UTC (permalink / raw)
  To: newlib

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

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Issue: #include <stdio.h> shall not cause intmax_t to be defined
  2022-05-04  8:41       ` Sebastian Huber
@ 2022-05-04  8:54         ` Corinna Vinschen
  2022-05-04  9:02           ` Sebastian Huber
  0 siblings, 1 reply; 10+ messages in thread
From: Corinna Vinschen @ 2022-05-04  8:54 UTC (permalink / raw)
  To: newlib

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?


Corinna


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Issue: #include <stdio.h> shall not cause intmax_t to be defined
  2022-05-04  8:54         ` Corinna Vinschen
@ 2022-05-04  9:02           ` Sebastian Huber
  2022-05-04 13:12             ` Corinna Vinschen
  0 siblings, 1 reply; 10+ messages in thread
From: Sebastian Huber @ 2022-05-04  9:02 UTC (permalink / raw)
  To: newlib

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

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Issue: #include <stdio.h> shall not cause intmax_t to be defined
  2022-05-04  9:02           ` Sebastian Huber
@ 2022-05-04 13:12             ` Corinna Vinschen
  2022-05-05 16:15               ` Pavel M
  0 siblings, 1 reply; 10+ messages in thread
From: Corinna Vinschen @ 2022-05-04 13:12 UTC (permalink / raw)
  To: newlib

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Issue: #include <stdio.h> shall not cause intmax_t to be defined
  2022-05-04 13:12             ` Corinna Vinschen
@ 2022-05-05 16:15               ` Pavel M
  2022-05-06  9:14                 ` Corinna Vinschen
  0 siblings, 1 reply; 10+ messages in thread
From: Pavel M @ 2022-05-05 16:15 UTC (permalink / raw)
  To: newlib

> Is there actually a "MUST NOT" defined anywhere in the standards or was
this change unnecessary?
C11 specifies when header X includes header Y.
Examples:
7.25 Type-generic math <tgmath.h>:
> The header <tgmath.h> includes the headers <math.h> and <complex.h>
7.26 Threads <threads.h>:
> The header <threads.h> includes the header <time.h>
7.8 Format conversion of integer types <inttypes.h>:
> The header <inttypes.h> includes the header <stdint.h>
There are no more occurrences of "includes the header".
--
Pavel

On Wed, 4 May 2022 at 16:13, Corinna Vinschen <vinschen@redhat.com> wrote:

> 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
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Issue: #include <stdio.h> shall not cause intmax_t to be defined
  2022-05-05 16:15               ` Pavel M
@ 2022-05-06  9:14                 ` Corinna Vinschen
  0 siblings, 0 replies; 10+ messages in thread
From: Corinna Vinschen @ 2022-05-06  9:14 UTC (permalink / raw)
  To: newlib

On May  5 19:15, Pavel M wrote:
> > Is there actually a "MUST NOT" defined anywhere in the standards or was
> this change unnecessary?
> C11 specifies when header X includes header Y.
> Examples:
> 7.25 Type-generic math <tgmath.h>:
> > The header <tgmath.h> includes the headers <math.h> and <complex.h>
> 7.26 Threads <threads.h>:
> > The header <threads.h> includes the header <time.h>
> 7.8 Format conversion of integer types <inttypes.h>:
> > The header <inttypes.h> includes the header <stdint.h>
> There are no more occurrences of "includes the header".

These examples define a MUST, where exposure of certain other header
file definitions are expected by including a single other header.
None of them defines a MUST NOT, which means that certain types
are not to be exposed when including a certain other header.

But, either way, the situation should be cleared by Sebastians patch.


Corinna


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-05-06  9:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26 21:41 Issue: #include <stdio.h> shall not cause intmax_t to be defined Pavel M
2022-05-03 17:00 ` Corinna Vinschen
2022-05-04  7:59   ` Sebastian Huber
2022-05-04  8:37     ` Corinna Vinschen
2022-05-04  8:41       ` Sebastian Huber
2022-05-04  8:54         ` Corinna Vinschen
2022-05-04  9:02           ` Sebastian Huber
2022-05-04 13:12             ` Corinna Vinschen
2022-05-05 16:15               ` Pavel M
2022-05-06  9:14                 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).