Thanks Ian.

Following the link provided by you, I have learned how stddef.h
changed to adapt the <sys/_types.h> which first came at
FreeBSD 5.

The main change that affects <stddef.h> from <machine/ansi.h> to
<sys/_types.h> was explained at

http://gcc.gnu.org/ml/gcc/2002-09/msg00560.html

What still confuse me is that <stddef.h> doesn't define foo_t by using
__foo_t which is defined in either <sys/_types.h> or
<machine/_types.h> (mentioned at the link above), the following two
links is the corresponding file:

http://svnweb.freebsd.org/base/release/5.5.0/sys/sys/_types.h?view=co

http://svnweb.freebsd.org/base/release/5.5.0/sys/i386/include/_types.h?view=co

Instead, the <stddef.h> uses __FOO_TYPE__ macro to define foo_t, so
what makes it necessary to let <stddef.h> include <sys/_types.h> in
FreeBSD >= 5 ?

I know <stddef.h> will check and define _FOO_T_DECLARED macro which is
required by FreeBSD >= 5 in order to claim that foo_t has been
declared, but this is not necessarily need to include <sys/_types.h>,
right?

--
Zachary

2013/5/3 Ian Lance Taylor <i...@google.com>:
> On Thu, May 2, 2013 at 3:32 AM, Zachary Jude <zacharyj...@gmail.com> wrote:
>>
>> I'm figuring out the code in
>>
>> /usr/lib/gcc/x86_64-redhat-linux/4.1.1/include/stddef.h,
>>
>> and I saw the macro switch below:
>>
>> #if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
>> #include <sys/_types.h>
>> #endif
>>
>> I have gone through all the <sys/_types>、<sys/cdefs.h> and
>> <i386/include/_types.h> source files for the whole 5.X.X version of
>> FreeBSD, and still can't find anything may affect the behavior of code
>> below that macro switch in <stddef.h>.
>>
>> Can someone please help in figuring out this ?
>
> I'm sure you are aware that 4.1.1 is quite old at this point.
>
> That code was added by this patch:
> http://gcc.gnu.org/ml/gcc-patches/2002-10/msg00003.html .  Perhaps
> that will help explain what is going on here.
>
> Ian

Reply via email to