inttostr: simplify by removing unnecessary redundancy
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 24 Oct 2010 17:11:16 +0000 (10:11 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 24 Oct 2010 17:15:59 +0000 (10:15 -0700)
* lib/anytostr.c: Don't include verify.h.
(anytostr): Don't verify that TYPE_SIGNED (inttype) equals
inttype_is_signed.  Instead, disable the bogus GCC warnings, so that
there's no need for inttype_is_signed and for calling TYPE_SIGNED.
* 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'.

ChangeLog
lib/anytostr.c
lib/imaxtostr.c
lib/inttostr.c
lib/offtostr.c
lib/uinttostr.c
lib/umaxtostr.c
modules/inttostr

index f312a8816f2abe129b8d5998c5fc7e537e6dc2b5..95328fe7fc1b0382d9bea2cc3ed83294cd546d32 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-10-23  Paul Eggert  <eggert@cs.ucla.edu>
+
+       inttostr: simplify by removing unnecessary redundancy
+       * lib/anytostr.c: Don't include verify.h.
+       (anytostr): Don't verify that TYPE_SIGNED (inttype) equals
+       inttype_is_signed.  Instead, disable the bogus GCC warnings, so that
+       there's no need for inttype_is_signed and for calling TYPE_SIGNED.
+       * 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'.
+
 2010-10-23  Bruno Haible  <bruno@clisp.org>
 
        nl_langinfo: Mention problem with CRNCYSTR on NetBSD 5.0.
index 27ad985024ce55ffa786682334d1366e1667a114..eb71553b8dd19ee77bdf04693974e50c6e7f9ba4 100644 (file)
 
 /* 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"
-#include "verify.h"
 
 /* Convert I to a printable string in BUF, which must be at least
    INT_BUFSIZE_BOUND (INTTYPE) bytes long.  Return the address of the
 char * __attribute_warn_unused_result__
 anytostr (inttype i, char *buf)
 {
-  verify (TYPE_SIGNED (inttype) == inttype_is_signed);
   char *p = buf + INT_STRLEN_BOUND (inttype);
   *p = 0;
 
-#if inttype_is_signed
   if (i < 0)
     {
       do
@@ -43,7 +45,6 @@ anytostr (inttype i, char *buf)
       *--p = '-';
     }
   else
-#endif
     {
       do
         *--p = '0' + i % 10;
index d2a0429b0d3b682be78d827fa6f5cde91cbfe627..b91ac98c4e260a07b8c37ea04a3022f3ed2e5ac1 100644 (file)
@@ -1,4 +1,3 @@
 #define anytostr imaxtostr
 #define inttype intmax_t
-#define inttype_is_signed 1
 #include "anytostr.c"
index 14db9b8c11f6c426a7bd0d695ccd1da27a6aae9a..c96b5ca39be62bdeda4071ce6c46280f458c4449 100644 (file)
@@ -1,4 +1,3 @@
 #define anytostr inttostr
 #define inttype int
-#define inttype_is_signed 1
 #include "anytostr.c"
index 68f2b695be1285b7777155dd6d1d2fef13e8d9b0..96082aafc0fdcdb4858a2f858575325ddd05fee0 100644 (file)
@@ -1,4 +1,3 @@
 #define anytostr offtostr
 #define inttype off_t
-#define inttype_is_signed 1
 #include "anytostr.c"
index 21fa3761a90fd1223cd3350d1b20d920ab532e32..48fd98f21c5ba521613a84129e9f2c960c2e32eb 100644 (file)
@@ -1,4 +1,3 @@
 #define anytostr uinttostr
 #define inttype unsigned int
-#define inttype_is_signed 0
 #include "anytostr.c"
index 7fd995084e76157d6cd60dae4dc0cbb3e4e7f7d9..f95bfc3ee0b7c54c0d80ad9ea521a1999c9c0967 100644 (file)
@@ -1,4 +1,3 @@
 #define anytostr umaxtostr
 #define inttype uintmax_t
-#define inttype_is_signed 0
 #include "anytostr.c"
index 495ef25cf57f43c7d8315bb2fcdc5d22aacf0593..6bbec2895560537a93eace32579961c74efefe64 100644 (file)
@@ -14,7 +14,6 @@ m4/inttostr.m4
 Depends-on:
 intprops
 stdint
-verify
 
 configure.ac:
 gl_INTTOSTR