This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: warnings in collate.c


The problem with reallocf() is that there is not a prototype for it
that I found.  What's the appropriate header for a prototype for
reallocf()?  (It would seem to be stdlib.h, but it would need some
kind of ifdef to only have it when posix (et.al.) was in use.  Jeff:
do you know how to conditionally include it appropriately?)
 
As for the second problem ("free(s);" to "free((void *)s);"), gcc 3.4.4
says
collate.c:183: warning: passing arg 1 of `free' discards qualifiers from
pointer target type
If it weren't for the very odd way that the beginning of the function
is coded that allows the problem to be avoided, this would be best
addressed with the cast to eliminate the warning.  But given that
the strdup() and free() are completely unnecessary, I have attached a
different patch that removes the problem.
 
I left out the cast for reallocf() since it should be fixed with a
prototype.  (There are two other files that also refer to reallocf().)
A different approach would be to always include reallocf(), instead of
only having it under posix and sys/linux, as then the condition on the
prototype would not be needed.
 
Craig

-----Original Message-----
From: newlib-owner@sourceware.org [mailto:newlib-owner@sourceware.org]
On Behalf Of Ralf Corsepius
Sent: Tuesday, November 18, 2008 11:43 PM
To: Joel Sherrill
Cc: newlib@sources.redhat.com
Subject: Re: warnings in collate.c

On Tue, 2008-11-18 at 17:11 -0600, Joel Sherrill wrote:
> Hi,
> 
> Attached is a patch which removes warnings in
> collate.c.  This just silences the warnings.

I am opposed to this patch. 

Better live with warnings until they can be properly fixed and do not
try to play things down by hiding them away.

Ralf



Attachment: collate.patch
Description: collate.patch


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]