From pdalgd at gmail.com  Tue Aug 14 13:48:44 2012
From: pdalgd at gmail.com (peter dalgaard)
Date: Tue, 14 Aug 2012 13:48:44 +0200
Subject: [Rd] compile fails with x86_64-alpine-linux-uclibc-gcc
In-Reply-To: <20120813182240.GA30033@wall.e>
References: <20120813034532.GA17328@wall.e>
	<BE73D35E-4A05-4CCF-99DD-CB6715ECF9CF@r-project.org>
	<20120813182240.GA30033@wall.e>
Message-ID: <5B4175AF-5EFE-45DE-9727-991C45FA891A@gmail.com>


On Aug 13, 2012, at 20:22 , nobody wrote:

> On Mon, Aug 13, 2012 at 10:49:26AM -0400, Simon Urbanek wrote:
>> I suspect that your runtime/libc is defining fgetc as a macro which breaks any code that uses it as an identifier. Ideally, your runtime should be fixed to use a proper function, but you could probably work around it with something like
>> 
>> static char * fix_fgets(char *s, int n, FILE *stream) { return fgets(s, n, stream); }
>> #undef fgets
>> static char * fgets(char *s, int n, FILE *stream) { return fix_fgets(s, n, stream); }
>> 
>> Cheers,
>> Simon
> 
> like this? :http://bpaste.net/show/40047/
> if so, then i get this err msg:
> connections.c:385:15: error: static declaration of 'fgets' follows non-static declaration
> /usr/include/stdio.h:544:14: note: previous declaration of 'fgets' was here
> connections.c: In function 'Rconn_fgetc':
> connections.c:3192:11: error: expected identifier before '(' token
> connections.c:3194:15: error: expected identifier before '(' token
> 
> and here is how it's declared in stdio.h on my system:
> 
> /* Get a newline-terminated string of finite length from STREAM.
> 
>   This function is a possible cancellation point and therefore not
>   marked with __THROW.  */
> extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
>     __wur;


Perhaps I'm confused, but how did either of you expect to fix a problem with fgetc by modifying fgets???

-- 
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



[Rd] compile fails with x86_64-alpine-linux-uclibc-gcc
peter dalgaard