Hi Bertrand,

Bertrand Garrigues wrote on Mon, Dec 10, 2018 at 12:59:24AM +0100:
> On Sun, Dec 09 2018 at 01:59:11 PM, Ingo Schwarze <schwa...@usta.de> wrote:

>> Then, the test that the gnulib hypot module is supposed to replace
>> intends to test whether the function needs to be *declared*.  In
>> the past, our build system did not provide any replacement code for
>> a missing hypot() object in the system library.  It only attempted
>> to provide a missing declaration, if needed.

> You're right.  The removal of the buggy GROFF_NEED_DECLARATION on
> hypot was suffificent to fix all the problems, it's not worth working on
> the replacement function.
 
> [...]
>> By the way, looking at configure.ac, my impression is that redundant,
>> maybe even conflicting tests are likely being done for several
>> functions, for example GROFF_NEED_DECLARATION + AC_REPLACE_FUNCS
>> for strcasecmp(3) and GROFF_NEED_DECLARATION + AC_CHECK_FUNCS for
>> gettimeofday(2).  But if so, that should be cleaned up *after*
>> release.  Besides, my impression may be mistaken, as i said, autoconf
>> is quite contorted and certainly hard to understand.

> Agreed.  There is no need to spend time on that now.  I'll fix my commit
> and remove the 'hypot' modules tomorrow.

My first impulse was to say "presumably, at some time in the (possibly
remote) past, systems existed where libm provided a viable implementation
of hypot(), but <math.h> failed to declare it.  Your propsed direction
might break compilation on such systems, whatever they are."

But repo archeology gives me the impression that's probably not
what actually happened.  In groff 1.10 (1995), pic.h uncoditionally
contained a declaration of hypot().  Then starting from 1.14 (1999),
that declaration was wrapped in #ifndef MATH_H_DECLARES_HYPOT,
controlled by a test in ./configure.

So presumably what happened is the reverse: the test was likely added
not because systems showed up lacking the dclaration in <math.h>,
but rather because the clash of the local declaration with <math.h>
started to cause trouble on some systems.  We don't seem to have
any evidence that systems without MATH_H_DECLARES_HYPOT ever existed.

For that reason, i agree with your plan to use neither
GROFF_NEED_DECLARATION([hypot]) nor the gnulib hypot module,
effectively implying that we will never define NEED_DECLARATION_HYPOT,
and also implying that we strictly rely on the hypot() prototype
being present in <math.h>.

Yours,
  Ingo

Reply via email to