* dirent.h and __NEED_size_t
@ 2012-08-24 15:16 Daniel Cegiełka
2012-08-24 15:27 ` Daniel Cegiełka
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Cegiełka @ 2012-08-24 15:16 UTC (permalink / raw)
To: musl
[-- Attachment #1: Type: text/plain, Size: 15 bytes --]
regads,
daniel
[-- Attachment #2: dirent_h__NEED_size_t.diff --]
[-- Type: application/octet-stream, Size: 316 bytes --]
diff -urN musl.orig//include/dirent.h musl/include/dirent.h
--- musl.orig//include/dirent.h 2012-08-24 14:16:18.000000000 +0200
+++ musl/include/dirent.h 2012-08-24 17:11:03.156857822 +0200
@@ -55,6 +55,7 @@
#endif
#ifdef _BSD_SOURCE
+#define __NEED_size_t
int getdents(int, struct dirent *, size_t);
#endif
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: dirent.h and __NEED_size_t
2012-08-24 15:16 dirent.h and __NEED_size_t Daniel Cegiełka
@ 2012-08-24 15:27 ` Daniel Cegiełka
2012-08-24 15:32 ` Daniel Cegiełka
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Cegiełka @ 2012-08-24 15:27 UTC (permalink / raw)
To: musl
Sorry - this patch doesn't work properly. However, it breaks
compilation if we don't have a visible size_t...
2012/8/24 Daniel Cegiełka <daniel.cegielka@gmail.com>:
> regads,
> daniel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: dirent.h and __NEED_size_t
2012-08-24 15:27 ` Daniel Cegiełka
@ 2012-08-24 15:32 ` Daniel Cegiełka
2012-08-24 15:40 ` Gregor Richards
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Cegiełka @ 2012-08-24 15:32 UTC (permalink / raw)
To: musl
[-- Attachment #1: Type: text/plain, Size: 269 bytes --]
Ok! :)
2012/8/24 Daniel Cegiełka <daniel.cegielka@gmail.com>:
> Sorry - this patch doesn't work properly. However, it breaks
> compilation if we don't have a visible size_t...
>
>
> 2012/8/24 Daniel Cegiełka <daniel.cegielka@gmail.com>:
>> regads,
>> daniel
[-- Attachment #2: dirent_h__NEED_size_t.diff --]
[-- Type: application/octet-stream, Size: 344 bytes --]
diff -urN musl.orig//include/dirent.h musl/include/dirent.h
--- musl.orig//include/dirent.h 2012-08-24 14:16:18.000000000 +0200
+++ musl/include/dirent.h 2012-08-24 17:30:57.701972837 +0200
@@ -55,6 +55,8 @@
#endif
#ifdef _BSD_SOURCE
+#define __NEED_size_t
+#include <bits/alltypes.h>
int getdents(int, struct dirent *, size_t);
#endif
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Re: dirent.h and __NEED_size_t
2012-08-24 15:32 ` Daniel Cegiełka
@ 2012-08-24 15:40 ` Gregor Richards
2012-08-24 18:23 ` Header testing [Re: [musl] Re: dirent.h and __NEED_size_t] Rich Felker
0 siblings, 1 reply; 9+ messages in thread
From: Gregor Richards @ 2012-08-24 15:40 UTC (permalink / raw)
To: musl
[-- Attachment #1: Type: text/plain, Size: 532 bytes --]
It's probably best to avoid multiply including bits/alltypes.h within
one file (although it's not a big deal since that file will be included
dozens of times regardless).
With valediction,
- Gregor Richards
On 08/24/2012 11:32 AM, Daniel Cegiełka wrote:
> Ok! :)
>
> 2012/8/24 Daniel Cegiełka <daniel.cegielka@gmail.com>:
>> Sorry - this patch doesn't work properly. However, it breaks
>> compilation if we don't have a visible size_t...
>>
>>
>> 2012/8/24 Daniel Cegiełka <daniel.cegielka@gmail.com>:
>>> regads,
>>> daniel
[-- Attachment #2: dirent_size_t.diff --]
[-- Type: text/x-diff, Size: 310 bytes --]
diff -r fab1146cec43 include/dirent.h
--- a/include/dirent.h Thu Aug 23 14:38:34 2012 -0400
+++ b/include/dirent.h Fri Aug 24 11:39:38 2012 -0400
@@ -7,6 +7,9 @@
#define __NEED_ino_t
#define __NEED_off_t
+#ifdef _BSD_SOURCE
+#define __NEED_size_t /* for getdents */
+#endif
#include <bits/alltypes.h>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Header testing [Re: [musl] Re: dirent.h and __NEED_size_t]
2012-08-24 15:40 ` Gregor Richards
@ 2012-08-24 18:23 ` Rich Felker
2012-08-24 20:04 ` John Spencer
0 siblings, 1 reply; 9+ messages in thread
From: Rich Felker @ 2012-08-24 18:23 UTC (permalink / raw)
To: musl
On Fri, Aug 24, 2012 at 11:40:34AM -0400, Gregor Richards wrote:
> diff -r fab1146cec43 include/dirent.h
> --- a/include/dirent.h Thu Aug 23 14:38:34 2012 -0400
> +++ b/include/dirent.h Fri Aug 24 11:39:38 2012 -0400
> @@ -7,6 +7,9 @@
>
> #define __NEED_ino_t
> #define __NEED_off_t
> +#ifdef _BSD_SOURCE
> +#define __NEED_size_t /* for getdents */
> +#endif
It would be nice to have a header test suite for this kind of issue.
Basically, it would attempt compiling an otherwise-empty source file
for each system header, with each combination of feature test macros,
to check for errors in any of the cases. We could add -std=c89 to the
mix too if we want to check for c89-compatibility errors at the same
time...
Rich
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Header testing [Re: [musl] Re: dirent.h and __NEED_size_t]
2012-08-24 18:23 ` Header testing [Re: [musl] Re: dirent.h and __NEED_size_t] Rich Felker
@ 2012-08-24 20:04 ` John Spencer
2012-08-24 20:16 ` Rich Felker
0 siblings, 1 reply; 9+ messages in thread
From: John Spencer @ 2012-08-24 20:04 UTC (permalink / raw)
To: musl
On 08/24/2012 08:23 PM, Rich Felker wrote:
>
> It would be nice to have a header test suite for this kind of issue.
> Basically, it would attempt compiling an otherwise-empty source file
> for each system header, with each combination of feature test macros,
> to check for errors in any of the cases. We could add -std=c89 to the
> mix too if we want to check for c89-compatibility errors at the same
> time...
>
> Rich
>
results: http://sprunge.us/JURU
script: http://sprunge.us/HIFE
apart from "inline" there seem to be only 2 problems (at least from a
quick glance):
bits/alltypes.h:
#if defined(__NEED_struct_timespec) && !defined(__DEFINED_struct_timespec)
struct timespec { time_t tv_sec; long tv_nsec; }; // time_t can be undefined
#define __DEFINED_struct_timespec
#endif
arpa/nameser.h should include support for uint16_t
.. and: <nsz> the stdio_ext.h bug is that stdio.h is not included
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Header testing [Re: [musl] Re: dirent.h and __NEED_size_t]
2012-08-24 20:04 ` John Spencer
@ 2012-08-24 20:16 ` Rich Felker
2012-08-24 20:48 ` John Spencer
0 siblings, 1 reply; 9+ messages in thread
From: Rich Felker @ 2012-08-24 20:16 UTC (permalink / raw)
To: musl
On Fri, Aug 24, 2012 at 10:04:22PM +0200, John Spencer wrote:
> On 08/24/2012 08:23 PM, Rich Felker wrote:
> >
> >It would be nice to have a header test suite for this kind of issue.
> >Basically, it would attempt compiling an otherwise-empty source file
> >for each system header, with each combination of feature test macros,
> >to check for errors in any of the cases. We could add -std=c89 to the
> >mix too if we want to check for c89-compatibility errors at the same
> >time...
> >
> >Rich
> >
> results: http://sprunge.us/JURU
> script: http://sprunge.us/HIFE
>
> apart from "inline" there seem to be only 2 problems (at least from
> a quick glance):
> bits/alltypes.h:
>
> #if defined(__NEED_struct_timespec) && !defined(__DEFINED_struct_timespec)
> struct timespec { time_t tv_sec; long tv_nsec; }; // time_t can be undefined
> #define __DEFINED_struct_timespec
> #endif
It's up to the header requesting timespec to also request time_t. We
could avoid this by just duplicating the underlying type for time_t in
the struct definition; I'm not sure if this would be desirable, since
it might cause errors of omitting time_t from headers that need to
define it to get missed.
> arpa/nameser.h should include support for uint16_t
Fixed.
> ... and: <nsz> the stdio_ext.h bug is that stdio.h is not included
Fixed.
Rich
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Header testing [Re: [musl] Re: dirent.h and __NEED_size_t]
2012-08-24 20:16 ` Rich Felker
@ 2012-08-24 20:48 ` John Spencer
2012-08-24 21:12 ` Rich Felker
0 siblings, 1 reply; 9+ messages in thread
From: John Spencer @ 2012-08-24 20:48 UTC (permalink / raw)
To: musl
On 08/24/2012 10:16 PM, Rich Felker wrote:
> On Fri, Aug 24, 2012 at 10:04:22PM +0200, John Spencer wrote:
>>
>> bits/alltypes.h:
>>
>> #if defined(__NEED_struct_timespec)&& !defined(__DEFINED_struct_timespec)
>> struct timespec { time_t tv_sec; long tv_nsec; }; // time_t can be undefined
>> #define __DEFINED_struct_timespec
>> #endif
> It's up to the header requesting timespec to also request time_t. We
> could avoid this by just duplicating the underlying type for time_t in
> the struct definition; I'm not sure if this would be desirable, since
> it might cause errors of omitting time_t from headers that need to
> define it to get missed.
>
in that case, sys/sem.h (which caused the compilation error) needs to be
fixed to set __NEED_time_t
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Header testing [Re: [musl] Re: dirent.h and __NEED_size_t]
2012-08-24 20:48 ` John Spencer
@ 2012-08-24 21:12 ` Rich Felker
0 siblings, 0 replies; 9+ messages in thread
From: Rich Felker @ 2012-08-24 21:12 UTC (permalink / raw)
To: musl
On Fri, Aug 24, 2012 at 10:48:18PM +0200, John Spencer wrote:
> On 08/24/2012 10:16 PM, Rich Felker wrote:
> >On Fri, Aug 24, 2012 at 10:04:22PM +0200, John Spencer wrote:
> >>
> >>bits/alltypes.h:
> >>
> >>#if defined(__NEED_struct_timespec)&& !defined(__DEFINED_struct_timespec)
> >>struct timespec { time_t tv_sec; long tv_nsec; }; // time_t can be undefined
> >>#define __DEFINED_struct_timespec
> >>#endif
> >It's up to the header requesting timespec to also request time_t. We
> >could avoid this by just duplicating the underlying type for time_t in
> >the struct definition; I'm not sure if this would be desirable, since
> >it might cause errors of omitting time_t from headers that need to
> >define it to get missed.
> >
> in that case, sys/sem.h (which caused the compilation error) needs
> to be fixed to set __NEED_time_t
Fixed, along with a couple other bugs I found reading the
specification for that header..
Rich
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-08-24 21:12 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-24 15:16 dirent.h and __NEED_size_t Daniel Cegiełka
2012-08-24 15:27 ` Daniel Cegiełka
2012-08-24 15:32 ` Daniel Cegiełka
2012-08-24 15:40 ` Gregor Richards
2012-08-24 18:23 ` Header testing [Re: [musl] Re: dirent.h and __NEED_size_t] Rich Felker
2012-08-24 20:04 ` John Spencer
2012-08-24 20:16 ` Rich Felker
2012-08-24 20:48 ` John Spencer
2012-08-24 21:12 ` Rich Felker
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).