Subject: Re: [bug-diffutils] bug#16467: Diffutils 3.3 v. VMS (et al.)

From: Paul Eggert <[email-masked]>
Date: Thu, 16 Jan 2014 13:04:34 -0800

On 01/16/2014 06:06 AM, Steven M. Schweda wrote:

> The C macro HAVE_DECL_STRTOLL is still used in lib/strtoimax.c, but
> seems to have disappeared from the Tru64-generated config.h.  My fault
> or yours?

I think it's a gnulib bug.  We don't run into compilers lacking
'long long' often nowadays, so I'm not surprised the bug is there.

I pushed the following patch to gnuliband am cc'ing to bug-gnulib.
Does this fix the problem for you?

---
 ChangeLog       | 11 +++++++++++
 lib/strtoimax.c | 16 ++++++++++------
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9a9f00b..ebfba06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2014-01-16  Paul Eggert  <[email-masked]>
+
+    strtoimax: port to platforms lacking 'long long'
+    VMS's pre-C99 compiler lacks 'long long', so 'configure' doesn't
+    check whether strtoll is declared, which causes the C file to
+    wrongly report an error.  Problem reported by Steven M. Schweda in:
+    http://lists.gnu.org/archive/html/bug-diffutils/2014-01/msg00003.html
+    * lib/strtoimax.c (strtoull):
+    Declare only if HAVE_UNSIGNED_LONG_LONG_INT.
+    (strtoll): Declare only if HAVE_LONG_LONG_INT.
+
 2014-01-16  Daniel Albers  <[email-masked]>  (tiny change)
 
     relocatable-perl: fix texi syntax
diff --git a/lib/strtoimax.c b/lib/strtoimax.c
index 219ebaf..2c33d58 100644
--- a/lib/strtoimax.c
+++ b/lib/strtoimax.c
@@ -28,20 +28,24 @@
 #include "verify.h"
 
 #ifdef UNSIGNED
-# ifndef HAVE_DECL_STRTOULL
+# if HAVE_UNSIGNED_LONG_LONG_INT
+#  ifndef HAVE_DECL_STRTOULL
 "this configure-time declaration test was not run"
-# endif
-# if !HAVE_DECL_STRTOULL && HAVE_UNSIGNED_LONG_LONG_INT
+#  endif
+#  if !HAVE_DECL_STRTOULL
 unsigned long long int strtoull (char const *, char **, int);
+#  endif
 # endif
 
 #else
 
-# ifndef HAVE_DECL_STRTOLL
+# if HAVE_LONG_LONG_INT
+#  ifndef HAVE_DECL_STRTOLL
 "this configure-time declaration test was not run"
-# endif
-# if !HAVE_DECL_STRTOLL && HAVE_LONG_LONG_INT
+#  endif
+#  if !HAVE_DECL_STRTOLL
 long long int strtoll (char const *, char **, int);
+#  endif
 # endif
 #endif
 
-- 
1.8.4.2