[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] fix build failure with getline.c

From: Simon Josefsson
Subject: Re: [PATCH] fix build failure with getline.c
Date: Fri, 01 Jan 2010 23:43:05 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux)

Eric Blake <address@hidden> writes:

> According to Robert Millan on 1/1/2010 5:56 AM:
>> When importing getline.c into GNU GRUB, it failed to build due to undefined
>> ssize_t.  Here's a fix (I believe including <sys/types.h> is portable enough,
>> please let me know if I'm wrong).
> Hmm.  The prototype for getline lives in <stdio.h>, so the real bug is
> that our replacement <stdio.h> is not guaranteeing that ssize_t is
> defined.  Which platform was this failure on?  Perhaps it resulted from
> Bruno's attempts to reduce namespace pollution on glibc machines, coupled
> 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:

address@hidden:~$ cat>foo.c
#include <stdio.h>
int main (void) { ssize_t foo = 42; }
address@hidden:~$ gcc -o foo foo.c
foo.c: In function ‘main’:
foo.c:2: error: ‘ssize_t’ undeclared (first use in this function)
foo.c:2: error: (Each undeclared identifier is reported only once
foo.c:2: error: for each function it appears in.)
foo.c:2: error: expected ‘;’ before ‘foo’

It is possible to declare functions with ssize_t-parameters without
using ssize_t directly, which is what glibc is doing.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]