[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: autoscan: Advising that AC_FUNC_REALLOC is not The Right Thing (TM)

From: Eric Blake
Subject: Re: autoscan: Advising that AC_FUNC_REALLOC is not The Right Thing (TM)
Date: Mon, 20 Feb 2012 11:25:08 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120209 Thunderbird/10.0.1

On 02/09/2012 03:10 PM, Tim Landscheidt wrote:
> Hi,
> for background, I'm looking at tackling a bug
> (<URI:>)
> with flex's build system that seems to stem from the use of
> AC_FUNC_REALLOC in without including gnulib's
> (or another) implementation.  I believe this can be fixed by
> simply omitting AC_FUNC_REALLOC (on the premise that
> realloc(p, 0) is never used).
>   The macro was originally added to on the sug-
> gestion of autoscan which basically means that in a few
> years some well-meaning developer will probably re-run auto-
> scan, re-add the macro and the bug will re-appear.

Autoscan is primarily designed as a once-only program, only done when
first converting to autotools, and not something you repeatedly run (and
it shows, due to the lack of attention given to autoscan - these days,
the ratio of projects converting to autoconf for the first time compared
to the projects already using autoconf is dropping, compared to when
autoscan was first implemented).  I personally haven't used autoscan.

>   So is there a way to advise autoscan that it shouldn't
> suggest AC_FUNC_REALLOC?  Another (human) solution would of
> course be to add appropriate comments to and
> hope that they will be read, but I'd prefer something more
> robust.

Very hackish (and untested by me), but you could try to do this in your (or in an included .m4 file):

# This package promises to never use realloc(n, 0), so we don't
# want autoscan to suggest AC_FUNC_REALLOC, by redefining the
# problem
m4_define([AN_FUNCTION], [m4_if([$1], [realloc], [],
  [AN_OUTPUT([function], $@)])])

The idea here is that you redefine AN_FUNCTION (which is the magic that
makes autoscan actually suggest AC_FUNC_REALLOC in the first place, when
encountering an instance of 'realloc' in the scanned source code) to
something that is innocuous for 'realloc' while still being effective
for other suggested fixes.

Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]