warnings in collate.c

Howland Craig D (Craig) howland@LGSInnovations.com
Wed Nov 19 18:08:00 GMT 2008

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
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.

-----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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: collate.patch
Type: application/octet-stream
Size: 1470 bytes
Desc: collate.patch
URL: <http://sourceware.org/pipermail/newlib/attachments/20081119/8bb0afe1/attachment.obj>

More information about the Newlib mailing list