[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] inttostr: simplify by removing unnecessary redundancy
From: |
Jim Meyering |
Subject: |
Re: [PATCH] inttostr: simplify by removing unnecessary redundancy |
Date: |
Fri, 22 Oct 2010 21:23:37 +0200 |
Paul Eggert wrote:
>>From 3a77a23690108e721b8b99f947937bda9026ee07 Mon Sep 17 00:00:00 2001
> From: Paul Eggert <address@hidden>
> Date: Fri, 22 Oct 2010 11:14:17 -0700
> Subject: [PATCH] inttostr: simplify by removing unnecessary redundancy
>
> While looking into the inttostr issues raised recently, I discovered
> that an #if would be a bit cleaner if rewritten as an if (as per
> Spencer & Collyer's classic paper #ifdef Considered Harmful), and
> installed this:
>
> * lib/anytostr.c: Don't include verify.h.
> (anytostr): Don't verify that TYPE_SIGNED (inttype) equals
> inttype_is_signed. Instead, use TYPE_SIGNED (inttype) directly.
> This removes the need for inttype_is_signed, which was put in to
> suppress some GCC warnings about conversions. This rewrite should
> also suppress those warnings.
> * lib/imaxtostr.c (inttype_is_signed): Remove; no longer needed.
> * lib/inttostr.c, lib/offtostr.c, lib/uinttostr.c, lib/umaxtostr.c:
> Likewise.
> * modules/inttostr (Depends-on): Remove 'verify'.
Hi Paul,
I agree completely about favoring if over #if,
but that approach doesn't work here, since it undoes
the change I made to avoid this problem:
[using F13's gcc version 4.4.4 20100630]
cc1: warnings being treated as errors
In file included from uinttostr.c:4:
anytostr.c: In function 'uinttostr':
anytostr.c:34: error: comparison of unsigned expression < 0 is always false
[-Wtype-limits]
make[4]: *** [uinttostr.o] Error 1
With your change, that warning (and with -Werror, failure) is back.
Re: [PATCH] inttostr: simplify by removing unnecessary redundancy, Eric Blake, 2010/10/22