Issues with stdio.h

Eric Blake eblake@redhat.com
Mon Feb 20 22:10:00 GMT 2012


On 02/20/2012 02:39 PM, Thomas Wolff wrote:
> Am 20.02.2012 01:25, schrieb Christopher Faylor:
>> On Sun, Feb 19, 2012 at 07:07:04PM -0500, Chris Sutcliffe wrote:
>>> ...
>>> /usr/include/stdio.h:34:20: fatal error: stddef.h: No such file or
>>> directory
>> stddef.h comes from the gcc4-core package.  It's located in:
>>
>> usr/lib/gcc/i686-pc-cygwin/4.5.3/include/stddef.h
>>
>> and should be found automatically by the compiler.
> I think it's a weird setup that an include file referred from
> /usr/include is not found in that location but well hidden in
> installation-specific directories. Not the usual setup anyway.

Wrong.  GNU/Linux does this too.  On my Fedora machine,

$ printf '#include <stddef.h>\n#include <stdio.h>\n' | gcc -E -\
   |grep '^# 1 "/'
# 1 "/usr/lib/gcc/x86_64-redhat-linux/4.6.2/include/stddef.h" 1 3 4
# 1 "/usr/include/stdio.h" 1 3 4
# 1 "/usr/include/features.h" 1 3 4
# 1 "/usr/include/sys/cdefs.h" 1 3 4
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 1 "/usr/include/gnu/stubs.h" 1 3 4
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 1 "/usr/include/gnu/stubs-64.h" 1 3 4
# 1 "/usr/lib/gcc/x86_64-redhat-linux/4.6.2/include/stddef.h" 1 3 4
# 1 "/usr/include/bits/types.h" 1 3 4
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 1 "/usr/include/bits/typesizes.h" 1 3 4
# 1 "/usr/include/libio.h" 1 3 4
# 1 "/usr/include/_G_config.h" 1 3 4
# 1 "/usr/lib/gcc/x86_64-redhat-linux/4.6.2/include/stddef.h" 1 3 4
# 1 "/usr/include/wchar.h" 1 3 4
# 1 "/usr/lib/gcc/x86_64-redhat-linux/4.6.2/include/stdarg.h" 1 3 4
# 1 "/usr/include/bits/stdio_lim.h" 1 3 4
# 1 "/usr/include/bits/sys_errlist.h" 1 3 4
	
So it is quite a common practice, and cygwin is merely copying what you
get on a GNU/Linux box.

> Also
> uncomfortable for people who want to check include files manually.

How so?  As far back as C89, and reiterated in newer documents such as
POSIX 2008, there is no guarantee that <stddef.h> is an actual file that
lives in any particular directory, only that the <> notation in the
#include directive tells the compiler to find whatever it needs to
provide that standard header.

> Please consider to change this (gcc maintainer?).

I don't see the need for any change.

-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20120220/7f433e27/attachment.sig>


More information about the Cygwin mailing list