On 11/15/2011 05:53 AM, Gary V. Vaughan wrote:
> * cfg.mk (local-checks-to-fix): Remove
> sc_cast_of_argument_to_free from list of disabled checks.
> * libltdl/config/ltmain.m4sh, libltdl/libltdl/lt__alloc.h,
> libltdl/lt__dirent.c: Casting argument to free is never
> necessary.

Not true; sometimes it is necessary to cast away const.  That is:

const char *str = malloc(n);
free(str);

will cause a noisy compile, where the cast solves things.  However, it
is arguable that anyone assigning malloc() results to a const pointer is
not following const-correctness rules in the first place.  So if things
still compile with warnings, meaning we weren't ever passing a const
pointer to free in the first place within libtool, _and_ we are sure no
one else was using our [X]FREE macros as a way to cast away the const in
their code, then I'm okay with this patch.  (The alternative is to add a
syntax-check exception in cfg.mk for the particular files where we
define the macros that cast away const).

-- 
Eric Blake   ebl...@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to