Bruno Haible <[email protected]> wrote: > Hi Jim, > >> * lib/inttostr.c: Use #pragma GCC diagnostic ignored "-Wtype-limits"
I find it useful. > In other words, the effort to get rid of the warning is too high. > Then why use the warning at all? I prefer not to disable the warning project-wide. when I can easily ignore one known occurrence in a single file. > Additionally, #pragma GCC diagnostic hampers maintainability ... This function is so small, I don't expect it to move or be modified. >> +#pragma GCC diagnostic ignored "-Wtype-limits" > > Older versions of GCC warn about unsupported pragmas [3]. Therefore IMO this > needs > to be enclosed in > #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2) > #endif Good suggestion. Done as follows: Since Paul hasn't objected, I've gone ahead and pushed the following change: >From 19b4d0fb6a9dff94b74fc948880da2f0c7ddd3e9 Mon Sep 17 00:00:00 2001 From: Jim Meyering <[email protected]> Date: Sun, 30 Nov 2008 17:36:15 +0100 Subject: [PATCH] inttostr.c: suppress a warning * lib/inttostr.c: Use #pragma GCC diagnostic ignored "-Wtype-limits" to ignore "...unsigned expression < 0 is always false" warnings. --- lib/inttostr.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/lib/inttostr.c b/lib/inttostr.c index 4ba71f5..ed6a693 100644 --- a/lib/inttostr.c +++ b/lib/inttostr.c @@ -1,6 +1,6 @@ /* inttostr.c -- convert integers to printable strings - Copyright (C) 2001, 2006 Free Software Foundation, Inc. + Copyright (C) 2001, 2006, 2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,6 +17,11 @@ /* Written by Paul Eggert */ +/* Tell gcc not to warn about the (i < 0) test, below. */ +#if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__ +# pragma GCC diagnostic ignored "-Wtype-limits" +#endif + #include <config.h> #include "inttostr.h" -- 1.6.1.198.g1eb4d
