[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] fix build failure with getline.c
From: |
Eric Blake |
Subject: |
Re: [PATCH] fix build failure with getline.c |
Date: |
Fri, 01 Jan 2010 16:09:57 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Simon Josefsson on 1/1/2010 3:43 PM:
>> with an older glibc that didn't yet expose everything required by POSIX 2008?
>
> Is there really a requirement for stdio.h to define ssize_t? Glibc's
> stdio.h doesn't define ssize_t:
Yes, POSIX (but not C99) requires <stdio.h> to define ssize_t:
http://www.opengroup.org/onlinepubs/9699919799/basedefs/stdio.h.html#tag_13_49
Since it is listed with CX shading on that page, you must use either
define _GNU_SOURCE (to anything) or _POSIX_C_SOURCE (to 200809L) prior to
including <stdio.h> to see ssize_t. And if glibc doesn't expose the type
even in those conditions, then that is a bug that gnulib needs to work around.
> It is possible to declare functions with ssize_t-parameters without
> using ssize_t directly, which is what glibc is doing.
Indeed, I see this with headers from glibc 2.7:
$ echo '#include <stdio.h>' | gcc -E - | grep ssize_t
typedef long int __ssize_t;
typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t);
$ echo '#include <stdio.h>' | gcc -D_GNU_SOURCE -E - | grep ssize_t
typedef long int __ssize_t;
typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t);
extern __ssize_t __getdelim (char **__restrict __lineptr,
extern __ssize_t getdelim (char **__restrict __lineptr,
extern __ssize_t getline (char **__restrict __lineptr,
I also checked the latest glibc.git, and couldn't see ssize_t or va_list
exposed, so I filed this bug report:
http://sources.redhat.com/bugzilla/show_bug.cgi?id=11125
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAks+gMUACgkQ84KuGfSFAYCgPACfWr43K9CFQc7C3KUYRNUZ3/c8
qzYAn3tGEl3xWE9H03UYE+v4VF6GNNFJ
=Q66h
-----END PGP SIGNATURE-----