autoconf
[Top][All Lists]
Advanced

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

Re: AC_*/AM_* macros for options


From: Paul Eggert
Subject: Re: AC_*/AM_* macros for options
Date: Tue, 29 Oct 2013 14:17:13 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0

On 10/29/2013 01:18 PM, Russ Allbery wrote:
> -Wconversion produces (or at least produced; I've not rechecked recently)
> unfixable warnings for most network code due to macro expansion.

It also produces unfixable warnings for entirely reasonable
code, like this:

/* Return A - B; if the result would overflow,
   return the closest representable value.  */

time_t
time_diff (time_t a, time_t b)
{
  if (b < 0)
    {
      if (TIME_T_MAX + b < a)
        return TIME_T_MAX;
    }
  else
    {
      if (a < TIME_T_MIN + b)
        return TIME_T_MIN;
    }

  return a - b;
}

on platforms where time_t happens to be unsigned.

I expect that we'd run into a many problems like this
if Autoconf enabled -Wconversion by default.  It'd be better to
have a new macro that enables warnings selectively, and encourage
developers to use that macro.  We've been trying to
do that with Gnulib with some success, and if someone
has the energy they could propose a patch along these
likes for Autoconf.



reply via email to

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