[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: proposed patch to allocsa, vasnprintf for Tandem NSK (OSS)
From: |
Paul Eggert |
Subject: |
Re: proposed patch to allocsa, vasnprintf for Tandem NSK (OSS) |
Date: |
Wed, 11 Oct 2006 12:06:14 -0700 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
Sorry about combining the two ideas into a single patch. Since the
first part has been installed, here's the second proposed part, which
I'm creating so that Bruno doesn't have to go to the work of creating
it.
2006-10-11 Paul Eggert <address@hidden>
Don't assume that 64-bit signed int is available if unsigned int
is, and vice versa.
* lib/allocsa.h (sa_alignment_unsignedlonglong): New constant.
(sa_alignment_max): Don't assume that long long int exists if
unsigned long long int does, and vice versa.
* lib/printf-args.h (TYPE_ULONGLONGINT, argument): Likewise.
* lib/printf-parse.c (PRINTF_PARSE): Likewise.
* lib/vasnprintf.c (VASNPRINTF): Likewise.
* m4/allocsa.m4 (gl_ALLOCSA): Require AC_TYPE_UNSIGNED_LONG_LONG_INT.
* m4/vasnprintf.m4 (gl_PREREQ_PRINTF_ARGS, gl_PREREQ_PRINTF_PARSE):
(gl_PREREQ_VASNPRINTF): Likewise.
* modules/allocsa (Files): Add m4/ulonglong.m4.
* modules/vasnprintf (Files): Likewise.
Index: lib/allocsa.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/allocsa.h,v
retrieving revision 1.7
diff -p -u -r1.7 allocsa.h
--- lib/allocsa.h 11 Oct 2006 16:09:38 -0000 1.7
+++ lib/allocsa.h 11 Oct 2006 19:02:33 -0000
@@ -109,6 +109,9 @@ enum
#ifdef HAVE_LONG_LONG_INT
sa_alignment_longlong = sa_alignof (long long),
#endif
+#ifdef HAVE_UNSIGNED_LONG_LONG_INT
+ sa_alignment_unsignedlonglong = sa_alignof (unsigned long long),
+#endif
#ifdef HAVE_LONG_DOUBLE
sa_alignment_longdouble = sa_alignof (long double),
#endif
@@ -116,6 +119,9 @@ enum
#ifdef HAVE_LONG_LONG_INT
| (sa_alignment_longlong - 1)
#endif
+#ifdef HAVE_UNSIGNED_LONG_LONG_INT
+ | (sa_alignment_unsignedlonglong - 1)
+#endif
#ifdef HAVE_LONG_DOUBLE
| (sa_alignment_longdouble - 1)
#endif
Index: lib/printf-args.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/printf-args.c,v
retrieving revision 1.8
diff -p -u -r1.8 printf-args.c
--- lib/printf-args.c 11 Oct 2006 16:09:38 -0000 1.8
+++ lib/printf-args.c 11 Oct 2006 19:02:33 -0000
@@ -60,6 +60,8 @@ printf_fetchargs (va_list args, argument
case TYPE_LONGLONGINT:
ap->a.a_longlongint = va_arg (args, long long int);
break;
+#endif
+#ifdef HAVE_UNSIGNED_LONG_LONG_INT
case TYPE_ULONGLONGINT:
ap->a.a_ulonglongint = va_arg (args, unsigned long long int);
break;
Index: lib/printf-args.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/printf-args.h,v
retrieving revision 1.5
diff -p -u -r1.5 printf-args.h
--- lib/printf-args.h 11 Oct 2006 16:09:38 -0000 1.5
+++ lib/printf-args.h 11 Oct 2006 19:02:33 -0000
@@ -49,6 +49,8 @@ typedef enum
TYPE_ULONGINT,
#ifdef HAVE_LONG_LONG_INT
TYPE_LONGLONGINT,
+#endif
+#ifdef HAVE_UNSIGNED_LONG_LONG_INT
TYPE_ULONGLONGINT,
#endif
TYPE_DOUBLE,
@@ -89,6 +91,8 @@ typedef struct
unsigned long int a_ulongint;
#ifdef HAVE_LONG_LONG_INT
long long int a_longlongint;
+#endif
+#ifdef HAVE_UNSIGNED_LONG_LONG_INT
unsigned long long int a_ulonglongint;
#endif
float a_float;
Index: lib/printf-parse.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/printf-parse.c,v
retrieving revision 1.8
diff -p -u -r1.8 printf-parse.c
--- lib/printf-parse.c 11 Oct 2006 16:09:38 -0000 1.8
+++ lib/printf-parse.c 11 Oct 2006 19:02:33 -0000
@@ -400,8 +400,9 @@ PRINTF_PARSE (const CHAR_T *format, DIRE
type = TYPE_INT;
break;
case 'o': case 'u': case 'x': case 'X':
-#ifdef HAVE_LONG_LONG_INT
- /* If 'long long' exists and is larger than 'long': */
+#ifdef HAVE_UNSIGNED_LONG_LONG_INT
+ /* If 'unsigned long long' exists and is larger than
+ 'unsigned long': */
if (flags >= 16 || (flags & 4))
type = TYPE_ULONGLONGINT;
else
Index: lib/vasnprintf.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/vasnprintf.c,v
retrieving revision 1.21
diff -p -u -r1.21 vasnprintf.c
--- lib/vasnprintf.c 11 Oct 2006 16:09:38 -0000 1.21
+++ lib/vasnprintf.c 11 Oct 2006 19:02:33 -0000
@@ -323,7 +323,16 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l
case 'd': case 'i': case 'u':
# ifdef HAVE_LONG_LONG_INT
- if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
+ if (type == TYPE_LONGLONGINT)
+ tmp_length =
+ (unsigned int) (sizeof (long long) * CHAR_BIT
+ * 0.30103 /* binary -> decimal */
+ )
+ + 1; /* turn floor into ceil */
+ else
+# endif
+# ifdef HAVE_UNSIGNED_LONG_LONG_INT
+ if (type == TYPE_ULONGLONGINT)
tmp_length =
(unsigned int) (sizeof (unsigned long long) * CHAR_BIT
* 0.30103 /* binary -> decimal */
@@ -353,7 +362,16 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l
case 'o':
# ifdef HAVE_LONG_LONG_INT
- if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
+ if (type == TYPE_LONGLONGINT)
+ tmp_length =
+ (unsigned int) (sizeof (long long) * CHAR_BIT
+ * 0.333334 /* binary -> octal */
+ )
+ + 1; /* turn floor into ceil */
+ else
+# endif
+# ifdef HAVE_UNSIGNED_LONG_LONG_INT
+ if (type == TYPE_ULONGLONGINT)
tmp_length =
(unsigned int) (sizeof (unsigned long long) * CHAR_BIT
* 0.333334 /* binary -> octal */
@@ -381,7 +399,16 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l
case 'x': case 'X':
# ifdef HAVE_LONG_LONG_INT
- if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
+ if (type == TYPE_LONGLONGINT)
+ tmp_length =
+ (unsigned int) (sizeof (long long) * CHAR_BIT
+ * 0.25 /* binary -> hexadecimal */
+ )
+ + 1; /* turn floor into ceil */
+ else
+# endif
+# ifdef HAVE_UNSIGNED_LONG_LONG_INT
+ if (type == TYPE_ULONGLONGINT)
tmp_length =
(unsigned int) (sizeof (unsigned long long) * CHAR_BIT
* 0.25 /* binary -> hexadecimal */
@@ -527,9 +554,13 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l
switch (type)
{
-#ifdef HAVE_LONG_LONG_INT
+#if defined HAVE_LONG_LONG_INT || defined HAVE_UNSIGNED_LONG_LONG_INT
+# ifdef HAVE_LONG_LONG_INT
case TYPE_LONGLONGINT:
+# endif
+# ifdef HAVE_UNSIGNED_LONG_LONG_INT
case TYPE_ULONGLONGINT:
+# endif
*p++ = 'l';
/*FALLTHROUGH*/
#endif
@@ -688,6 +719,8 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l
SNPRINTF_BUF (arg);
}
break;
+#endif
+#ifdef HAVE_UNSIGNED_LONG_LONG_INT
case TYPE_ULONGLONGINT:
{
unsigned long long int arg =
a.arg[dp->arg_index].a.a_ulonglongint;
Index: m4/allocsa.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/allocsa.m4,v
retrieving revision 1.4
diff -p -u -r1.4 allocsa.m4
--- m4/allocsa.m4 11 Oct 2006 16:09:38 -0000 1.4
+++ m4/allocsa.m4 11 Oct 2006 19:02:33 -0000
@@ -1,4 +1,4 @@
-# allocsa.m4 serial 4
+# allocsa.m4 serial 5
dnl Copyright (C) 2003-2004, 2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -11,5 +11,6 @@ AC_DEFUN([gl_ALLOCSA],
AC_REQUIRE([gl_FUNC_ALLOCA])
AC_REQUIRE([gl_EEMALLOC])
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
+ AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
AC_REQUIRE([gt_TYPE_LONGDOUBLE])
])
Index: m4/vasnprintf.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/vasnprintf.m4,v
retrieving revision 1.9
diff -p -u -r1.9 vasnprintf.m4
--- m4/vasnprintf.m4 11 Oct 2006 16:09:38 -0000 1.9
+++ m4/vasnprintf.m4 11 Oct 2006 19:02:33 -0000
@@ -1,4 +1,4 @@
-# vasnprintf.m4 serial 6
+# vasnprintf.m4 serial 7
dnl Copyright (C) 2002-2004, 2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -24,6 +24,7 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
[
AC_REQUIRE([bh_C_SIGNED])
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
+ AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
AC_REQUIRE([gt_TYPE_LONGDOUBLE])
AC_REQUIRE([gt_TYPE_WCHAR_T])
AC_REQUIRE([gt_TYPE_WINT_T])
@@ -33,6 +34,7 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
[
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
+ AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
AC_REQUIRE([gt_TYPE_LONGDOUBLE])
AC_REQUIRE([gt_TYPE_WCHAR_T])
AC_REQUIRE([gt_TYPE_WINT_T])
@@ -46,6 +48,7 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF],
[
AC_REQUIRE([AC_FUNC_ALLOCA])
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
+ AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
AC_REQUIRE([gt_TYPE_LONGDOUBLE])
AC_REQUIRE([gt_TYPE_WCHAR_T])
AC_REQUIRE([gt_TYPE_WINT_T])
Index: modules/allocsa
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/allocsa,v
retrieving revision 1.6
diff -p -u -r1.6 allocsa
--- modules/allocsa 14 Apr 2005 13:05:07 -0000 1.6
+++ modules/allocsa 11 Oct 2006 19:02:33 -0000
@@ -9,6 +9,7 @@ m4/allocsa.m4
m4/eealloc.m4
m4/longlong.m4
m4/longdouble.m4
+m4/ulonglong.m4
Depends-on:
alloca-opt
Index: modules/vasnprintf
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/vasnprintf,v
retrieving revision 1.8
diff -p -u -r1.8 vasnprintf
--- modules/vasnprintf 29 Sep 2004 22:10:44 -0000 1.8
+++ modules/vasnprintf 11 Oct 2006 19:02:34 -0000
@@ -14,6 +14,7 @@ m4/longdouble.m4
m4/wchar_t.m4
m4/wint_t.m4
m4/longlong.m4
+m4/ulonglong.m4
m4/intmax_t.m4
m4/stdint_h.m4
m4/inttypes_h.m4
- Re: proposed patch to allocsa, vasnprintf for Tandem NSK (OSS), (continued)
- Re: proposed patch to allocsa, vasnprintf for Tandem NSK (OSS), Matthew Woehlke, 2006/10/17
- Re: proposed patch to allocsa, vasnprintf for Tandem NSK (OSS), Paul Eggert, 2006/10/17
- Re: proposed patch to allocsa, vasnprintf for Tandem NSK (OSS), Matthew Woehlke, 2006/10/17
- Re: proposed patch to allocsa, vasnprintf for Tandem NSK (OSS), Paul Eggert, 2006/10/17
- Re: [bug-gnulib] Re: [bug-gnulib] proposed patch to allocsa, vasnprintf for Tandem NSK (OSS), Bruno Haible, 2006/10/11
Re: proposed patch to allocsa, vasnprintf for Tandem NSK (OSS), mwoehlke, 2006/10/11
Re: proposed patch to allocsa, vasnprintf for Tandem NSK (OSS),
Paul Eggert <=