bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

printf.c port to Solaris 8 + 32-bit GCC (strtoimax/strtoumax)


From: Paul Eggert
Subject: printf.c port to Solaris 8 + 32-bit GCC (strtoimax/strtoumax)
Date: Wed, 28 Jul 2004 00:01:42 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

I installed this fix encountered when porting coreutils CVS to Solaris
8 + 32-bit GCC.  This was a portability bug that I introduced in the
2004-07-06 change to printf.c; sorry about that.

2004-07-27  Paul Eggert  <address@hidden>

        * src/printf.c (strtiomax, strtoumax): Declare if not already
        declared: this fixes a portability bug with Solaris 8 + GCC.
        (STRTOX): Parenthesize use of macro arg as expression.
        (vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
        parentheses.
        * configure.ac: Check for declaration of strtoumax, for
        src/printf.c.

Index: src/printf.c
===================================================================
RCS file: /home/eggert/coreutils/cu/src/printf.c,v
retrieving revision 1.92
diff -p -u -r1.92 printf.c
--- src/printf.c        12 Jul 2004 06:36:55 -0000      1.92
+++ src/printf.c        28 Jul 2004 06:38:07 -0000
@@ -57,6 +57,13 @@
 #include "error.h"
 #include "unicodeio.h"
 
+#if ! (HAVE_DECL_STRTOIMAX || defined strtoimax)
+intmax_t strtoimax ();
+#endif
+#if ! (HAVE_DECL_STRTOUMAX || defined strtoumax)
+uintmax_t strtoumax ();
+#endif
+
 /* The official name of this program (e.g., no `g' prefix).  */
 #define PROGRAM_NAME "printf"
 
@@ -177,15 +184,15 @@ FUNC_NAME (char const *s)                                 
         \
   else                                                                  \
     {                                                                   \
       errno = 0;                                                        \
-      val = LIB_FUNC_EXPR;                                              \
+      val = (LIB_FUNC_EXPR);                                            \
       verify (s, end);                                                  \
     }                                                                   \
   return val;                                                           \
 }                                                                       \
 
-STRTOX (intmax_t,    vstrtoimax, (strtoimax (s, &end, 0)))
-STRTOX (uintmax_t,   vstrtoumax, (strtoumax (s, &end, 0)))
-STRTOX (long double, vstrtold,   (c_strtold (s, &end)))
+STRTOX (intmax_t,    vstrtoimax, strtoimax (s, &end, 0))
+STRTOX (uintmax_t,   vstrtoumax, strtoumax (s, &end, 0))
+STRTOX (long double, vstrtold,   c_strtold (s, &end))
 
 /* Output a single-character \ escape.  */
 
Index: configure.ac
===================================================================
RCS file: /home/eggert/coreutils/cu/configure.ac,v
retrieving revision 1.52
diff -p -u -r1.52 configure.ac
--- configure.ac        6 Jul 2004 16:13:17 -0000       1.52
+++ configure.ac        28 Jul 2004 06:36:59 -0000
@@ -225,10 +225,12 @@ if test $jm_cv_sys_tiocgwinsz_needs_term
 fi
 
 # For src/kill.c.
-AC_CHECK_DECLS([strtoimax])
 AC_CHECK_DECLS([strsignal, sys_siglist, _sys_siglist, __sys_siglist], , ,
   [AC_INCLUDES_DEFAULT
 #include <signal.h>])
+
+# For src/kill.c and src/printf.c.
+AC_CHECK_DECLS([strtoimax, strtoumax])
 
 gl_LIB_CHECK
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]