This is the mail archive of the 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

Howland Craig D (Craig) wrote:
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 ( 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.
Thanks Craig. Your patch has been committed. In addition, I have moved reallocf to stdlib,
added a _reallocf_r function, put the prototypes in stdlib.h, and added documentation to malloc.c

-- Jeff J.

-----Original Message-----
From: []
On Behalf Of Ralf Corsepius
Sent: Tuesday, November 18, 2008 11:43 PM
To: Joel Sherrill
Subject: Re: warnings in collate.c

On Tue, 2008-11-18 at 17:11 -0600, Joel Sherrill wrote:

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.


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