Jim Meyering <[EMAIL PROTECTED]> writes: > Ben Pfaff <[EMAIL PROTECTED]> wrote: >> I wanted to use verify_true instead of if...abort, but GCC -Wall >> gave an annoying "statement with no effect" warning. > You can use (void) verify_true (...).
Thank you. I don't know why that didn't occur to me. I installed the appended patch. Bruno Haible <[EMAIL PROTECTED]> writes: > verify_true() is meant to be used in an expression context. In a declaration > context (e.g. at the beginning of a function or of a compound statement) > you can use verify(). That's true, of course. I wanted to put the call to it in the middle of the block, though, because that is where it seems most natural to me, especially if any more calls to popcount32 were to become necessary. 2007-07-23 Ben Pfaff <[EMAIL PROTECTED]> * lib/popcount.h: Use verify_true instead of if...abort. * modules/popcount: Depend on verify module. Suggested by Jim Meyering. Index: lib/popcount.h =================================================================== RCS file: /sources/gnulib/gnulib/lib/popcount.h,v retrieving revision 1.2 diff -u -p -r1.2 popcount.h --- lib/popcount.h 23 Jul 2007 04:17:50 -0000 1.2 +++ lib/popcount.h 24 Jul 2007 02:11:32 -0000 @@ -22,17 +22,17 @@ #include <limits.h> #include <stdlib.h> +#include "verify.h" #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR >= 4) #define POPCOUNT_CALCULATION(NAME, TYPE) \ return __builtin_##NAME (x); #else -#define POPCOUNT_CALCULATION(NAME, TYPE) \ - int pop = popcount32 (x); \ - if (CHAR_BIT * sizeof (TYPE) > 32) \ - pop += popcount32 (x >> 31 >> 1); \ - if (CHAR_BIT * sizeof (TYPE) > 64) \ - abort (); \ +#define POPCOUNT_CALCULATION(NAME, TYPE) \ + int pop = popcount32 (x); \ + if (CHAR_BIT * sizeof (TYPE) > 32) \ + pop += popcount32 (x >> 31 >> 1); \ + (void) verify_true (CHAR_BIT * sizeof (TYPE) <= 64); \ return pop; /* Compute and return the population count of the low 32 bits of Index: modules/popcount =================================================================== RCS file: /sources/gnulib/gnulib/modules/popcount,v retrieving revision 1.1 diff -u -p -r1.1 popcount --- modules/popcount 23 Jul 2007 00:21:20 -0000 1.1 +++ modules/popcount 24 Jul 2007 02:11:33 -0000 @@ -7,6 +7,7 @@ m4/popcount.m4 Depends-on: inline +verify configure.ac: gl_POPCOUNT -- Ben Pfaff http://benpfaff.org