[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSK(OSS) compilation problem
From: |
Paul Eggert |
Subject: |
Re: NSK(OSS) compilation problem |
Date: |
Tue, 10 Oct 2006 23:10:46 -0700 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
I installed the following into gnulib in an attempt to address part of
the porting problem that you mentioned.
2006-10-10 Paul Eggert <address@hidden>
Port to Tandem NSK OSS, which has 64-bit signed int but at most
32-bit unsigned int. Problem reported by Matthew Woehlke in:
http://lists.gnu.org/archive/html/bug-coreutils/2006-10/msg00062.html
More generally, don't assume that 64-bit signed int is available
if unsigned int is, and vice versa.
* lib/inttypes_.h (_PRIu64_PREFIX, _SCNu64_PREFIX): Depend on
unsigned symbols, not on their signed counterparts.
* lib/stdint_.h (uint64_t, uint_least64_t, uint_fast64_t, uintmax_t):
(UINT64_MAX, UINT_LEAST64_MAX, UINT_FAST64_MAX, UINTMAX_MAX):
(UINT64_C, UINTMAX_C):
Likewise.
* lib/strtoimax.c (strtoll): Depend on signed symbols, not their
unsigned counterparts.
(Have_long_long, Unsigned): New macros.
(Int): Renamed from INT.
(strtoimax): Use the new macros.
* m4/stdint.m4 (gl_STDINT_H): Require AC_TYPE_UNSIGNED_LONG_LONG_INT
and substitute HAVE_UNSIGNED_LONG_LONG_INT.
* modules/inttypes (inttypes.h): Substitute
HAVE_UNSIGNED_LONG_LONG_INT.
* modules/stdint (stdint.h): Likewise.
(Files): Add m4/ulonglong.m4.
Index: lib/inttypes_.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/inttypes_.h,v
retrieving revision 1.3
diff -u -r1.3 inttypes_.h
--- lib/inttypes_.h 28 Aug 2006 20:42:18 -0000 1.3
+++ lib/inttypes_.h 11 Oct 2006 05:55:31 -0000
@@ -172,11 +172,11 @@
# endif
# endif
# ifdef UINT64_MAX
-# if INT64_MAX == LONG_MAX
+# if UINT64_MAX == ULONG_MAX
# define _PRIu64_PREFIX "l"
# elif defined _MSC_VER || defined __MINGW32__
# define _PRIu64_PREFIX "I64"
-# elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
+# elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
# define _PRIu64_PREFIX "ll"
# endif
# if !defined PRIo64 || @PRI_MACROS_BROKEN@
@@ -665,11 +665,11 @@
# endif
# endif
# ifdef UINT64_MAX
-# if INT64_MAX == LONG_MAX
+# if UINT64_MAX == ULONG_MAX
# define _SCNu64_PREFIX "l"
# elif defined _MSC_VER || defined __MINGW32__
# define _SCNu64_PREFIX "I64"
-# elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
+# elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
# define _SCNu64_PREFIX "ll"
# endif
# if !defined SCNo64 || @PRI_MACROS_BROKEN@
Index: lib/stdint_.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/stdint_.h,v
retrieving revision 1.33
diff -u -r1.33 stdint_.h
--- lib/stdint_.h 28 Aug 2006 20:42:18 -0000 1.33
+++ lib/stdint_.h 11 Oct 2006 05:55:31 -0000
@@ -124,15 +124,20 @@
#define uint32_t unsigned int
#undef int64_t
-#undef uint64_t
#if LONG_MAX >> 31 >> 31 == 1
# define int64_t long int
-# define uint64_t unsigned long int
#elif defined _MSC_VER
# define int64_t __int64
-# define uint64_t unsigned __int64
#elif @HAVE_LONG_LONG_INT@
# define int64_t long long int
+#endif
+
+#undef uint64_t
+#if ULONG_MAX >> 31 >> 31 >> 1 == 1
+# define uint64_t unsigned long int
+#elif defined _MSC_VER
+# define uint64_t unsigned __int64
+#elif @HAVE_UNSIGNED_LONG_LONG_INT@
# define uint64_t unsigned long long int
#endif
@@ -164,6 +169,8 @@
#define uint_least32_t uint32_t
#ifdef int64_t
# define int_least64_t int64_t
+#endif
+#ifdef uint64_t
# define uint_least64_t uint64_t
#endif
@@ -193,6 +200,8 @@
#define uint_fast32_t unsigned int_fast32_t
#ifdef int64_t
# define int_fast64_t int64_t
+#endif
+#ifdef uint64_t
# define uint_fast64_t uint64_t
#endif
@@ -209,15 +218,20 @@
public header files. */
#undef intmax_t
-#undef uintmax_t
#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
# define intmax_t long long int
-# define uintmax_t unsigned long long int
#elif defined int64_t
# define intmax_t int64_t
-# define uintmax_t uint64_t
#else
# define intmax_t long int
+#endif
+
+#undef uintmax_t
+#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
+# define uintmax_t unsigned long long int
+#elif defined int64_t
+# define uintmax_t uint64_t
+#else
# define uintmax_t unsigned long int
#endif
@@ -253,10 +267,13 @@
#undef INT64_MIN
#undef INT64_MAX
-#undef UINT64_MAX
#ifdef int64_t
# define INT64_MIN (~ INT64_MAX)
# define INT64_MAX INTMAX_C (9223372036854775807)
+#endif
+
+#undef UINT64_MAX
+#ifdef uint64_t
# define UINT64_MAX UINTMAX_C (18446744073709551615)
#endif
@@ -289,10 +306,13 @@
#undef INT_LEAST64_MIN
#undef INT_LEAST64_MAX
-#undef UINT_LEAST64_MAX
#ifdef int64_t
# define INT_LEAST64_MIN INT64_MIN
# define INT_LEAST64_MAX INT64_MAX
+#endif
+
+#undef UINT_LEAST64_MAX
+#ifdef uint64_t
# define UINT_LEAST64_MAX UINT64_MAX
#endif
@@ -325,10 +345,13 @@
#undef INT_FAST64_MIN
#undef INT_FAST64_MAX
-#undef UINT_FAST64_MAX
#ifdef int64_t
# define INT_FAST64_MIN INT64_MIN
# define INT_FAST64_MAX INT64_MAX
+#endif
+
+#undef UINT_FAST64_MAX
+#ifdef uint64_t
# define UINT_FAST64_MAX UINT64_MAX
#endif
@@ -345,13 +368,17 @@
#undef INTMAX_MIN
#undef INTMAX_MAX
-#undef UINTMAX_MAX
#define INTMAX_MIN (~ INTMAX_MAX)
#ifdef INT64_MAX
# define INTMAX_MAX INT64_MAX
-# define UINTMAX_MAX UINT64_MAX
#else
# define INTMAX_MAX INT32_MAX
+#endif
+
+#undef UINTMAX_MAX
+#ifdef UINT64_MAX
+# define UINTMAX_MAX UINT64_MAX
+#else
# define UINTMAX_MAX UINT32_MAX
#endif
@@ -427,27 +454,36 @@
#undef UINT64_C
#if LONG_MAX >> 31 >> 31 == 1
# define INT64_C(x) x##L
-# define UINT64_C(x) x##UL
#elif defined _MSC_VER
# define INT64_C(x) x##i64
-# define UINT64_C(x) x##ui64
#elif @HAVE_LONG_LONG_INT@
# define INT64_C(x) x##LL
+#endif
+#if ULONG_MAX >> 31 >> 31 >> 1 == 1
+# define UINT64_C(x) x##UL
+#elif defined _MSC_VER
+# define UINT64_C(x) x##ui64
+#elif @HAVE_UNSIGNED_LONG_LONG_INT@
# define UINT64_C(x) x##ULL
#endif
/* 7.18.4.2. Macros for greatest-width integer constants */
#undef INTMAX_C
-#undef UINTMAX_C
#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
# define INTMAX_C(x) x##LL
-# define UINTMAX_C(x) x##ULL
#elif defined int64_t
# define INTMAX_C(x) INT64_C(x)
-# define UINTMAX_C(x) UINT64_C(x)
#else
# define INTMAX_C(x) x##L
+#endif
+
+#undef UINTMAX_C
+#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
+# define UINTMAX_C(x) x##ULL
+#elif defined uint64_t
+# define UINTMAX_C(x) UINT64_C(x)
+#else
# define UINTMAX_C(x) x##UL
#endif
Index: lib/strtoimax.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/strtoimax.c,v
retrieving revision 1.16
diff -u -r1.16 strtoimax.c
--- lib/strtoimax.c 13 Sep 2006 22:38:14 -0000 1.16
+++ lib/strtoimax.c 11 Oct 2006 05:55:31 -0000
@@ -33,7 +33,7 @@
"this configure-time declaration test was not run"
# endif
# if !HAVE_DECL_STRTOULL && HAVE_UNSIGNED_LONG_LONG_INT
-unsigned long long strtoull (char const *, char **, int);
+unsigned long long int strtoull (char const *, char **, int);
# endif
#else
@@ -41,33 +41,35 @@
# ifndef HAVE_DECL_STRTOLL
"this configure-time declaration test was not run"
# endif
-# if !HAVE_DECL_STRTOLL && HAVE_UNSIGNED_LONG_LONG_INT
-long long strtoll (char const *, char **, int);
+# if !HAVE_DECL_STRTOLL && HAVE_LONG_LONG_INT
+long long int strtoll (char const *, char **, int);
# endif
#endif
#ifdef UNSIGNED
-# undef HAVE_LONG_LONG_INT
-# define HAVE_LONG_LONG_INT HAVE_UNSIGNED_LONG_LONG_INT
-# define INT uintmax_t
+# define Have_long_long HAVE_UNSIGNED_LONG_LONG_INT
+# define Int uintmax_t
+# define Unsigned unsigned
# define strtoimax strtoumax
# define strtol strtoul
# define strtoll strtoull
#else
-# define INT intmax_t
+# define Have_long_long HAVE_LONG_LONG_INT
+# define Int intmax_t
+# define Unsigned
#endif
-INT
+Int
strtoimax (char const *ptr, char **endptr, int base)
{
-#if HAVE_LONG_LONG_INT
- verify (sizeof (INT) == sizeof (long int)
- || sizeof (INT) == sizeof (long long int));
+#if Have_long_long
+ verify (sizeof (Int) == sizeof (Unsigned long int)
+ || sizeof (Int) == sizeof (Unsigned long long int));
- if (sizeof (INT) != sizeof (long int))
+ if (sizeof (Int) != sizeof (Unsigned long int))
return strtoll (ptr, endptr, base);
#else
- verify (sizeof (INT) == sizeof (long int));
+ verify (sizeof (Int) == sizeof (Unsigned long int));
#endif
return strtol (ptr, endptr, base);
Index: m4/stdint.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/stdint.m4,v
retrieving revision 1.22
diff -u -r1.22 stdint.m4
--- m4/stdint.m4 28 Aug 2006 20:42:18 -0000 1.22
+++ m4/stdint.m4 11 Oct 2006 05:55:31 -0000
@@ -1,4 +1,4 @@
-# stdint.m4 serial 18
+# stdint.m4 serial 19
dnl Copyright (C) 2001-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,
@@ -11,7 +11,7 @@
[
AC_PREREQ(2.59)dnl
- dnl Check for long long int.
+ dnl Check for long long int and unsigned long long int.
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
if test $ac_cv_type_long_long_int = yes; then
HAVE_LONG_LONG_INT=1
@@ -19,6 +19,13 @@
HAVE_LONG_LONG_INT=0
fi
AC_SUBST([HAVE_LONG_LONG_INT])
+ AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
+ if test $ac_cv_type_unsigned_long_long_int = yes; then
+ HAVE_UNSIGNED_LONG_LONG_INT=1
+ else
+ HAVE_UNSIGNED_LONG_LONG_INT=0
+ fi
+ AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT])
dnl Check for <wchar.h>.
AC_CHECK_HEADERS_ONCE([wchar.h])
Index: modules/inttypes
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/inttypes,v
retrieving revision 1.14
diff -u -r1.14 inttypes
--- modules/inttypes 7 Oct 2006 18:57:13 -0000 1.14
+++ modules/inttypes 11 Oct 2006 05:55:31 -0000
@@ -26,6 +26,7 @@
-e 's|@''ABSOLUTE_INTTYPES_H''@|$(ABSOLUTE_INTTYPES_H)|g' \
-e 's/@''PRI_MACROS_BROKEN''@/$(PRI_MACROS_BROKEN)/g' \
-e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
+ -e
's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
-e 's/@''PRIPTR_PREFIX''@/$(PRIPTR_PREFIX)/g' \
-e 's/@''HAVE_DECL_IMAXABS''@/$(HAVE_DECL_IMAXABS)/g' \
-e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \
Index: modules/stdint
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/stdint,v
retrieving revision 1.15
diff -u -r1.15 stdint
--- modules/stdint 7 Oct 2006 14:54:51 -0000 1.15
+++ modules/stdint 11 Oct 2006 05:55:31 -0000
@@ -11,6 +11,7 @@
m4/stdint.m4
m4/absolute-header.m4
m4/longlong.m4
+m4/ulonglong.m4
Depends-on:
@@ -34,6 +35,7 @@
-e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
-e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
-e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
+ -e
's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
-e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \
-e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \
-e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \
- Re: NSK(OSS) compilation problem, (continued)
- Re: NSK(OSS) compilation problem, Paul Eggert, 2006/10/05
- Re: NSK(OSS) compilation problem, mwoehlke, 2006/10/06
- Re: NSK(OSS) compilation problem, Paul Eggert, 2006/10/06
- Re: NSK(OSS) compilation problem, mwoehlke, 2006/10/09
- Re: NSK(OSS) compilation problem, Paul Eggert, 2006/10/11
- Re: NSK(OSS) compilation problem, mwoehlke, 2006/10/11
- Re: NSK(OSS) compilation problem, Paul Eggert, 2006/10/11
- Re: NSK(OSS) compilation problem (change to m4/extensions.m4), Paul Eggert, 2006/10/11
- Message not available
- Re: NSK(OSS) compilation problem (change to m4/extensions.m4), Ralf Wildenhues, 2006/10/12
- Re: NSK(OSS) compilation problem, Paul Eggert, 2006/10/11
- Re: NSK(OSS) compilation problem,
Paul Eggert <=
- proposed patch to allocsa, vasnprintf for Tandem NSK (OSS), Paul Eggert, 2006/10/11
- Re: [bug-gnulib] proposed patch to allocsa, vasnprintf for Tandem NSK (OSS), Bruno Haible, 2006/10/11
- Re: [bug-gnulib] proposed patch to allocsa, vasnprintf for Tandem NSK (OSS), Bruno Haible, 2006/10/11
- Re: [bug-gnulib] proposed patch to allocsa, vasnprintf for Tandem NSK (OSS), mwoehlke, 2006/10/11
- Message not available
- Re: proposed patch to allocsa, vasnprintf for Tandem NSK (OSS), Paul Eggert, 2006/10/11
- Re: proposed patch to allocsa, vasnprintf for Tandem NSK (OSS), Matthew Woehlke, 2006/10/11
- printf %lld versus %Ld for Tandem NSK (OSS), Paul Eggert, 2006/10/12
- Re: [bug-gnulib] printf %lld versus %Ld for Tandem NSK (OSS), Bruno Haible, 2006/10/12
- Re: NSK(OSS) compilation problem, Paul Eggert, 2006/10/15
- Re: NSK(OSS) compilation problem, Matthew Woehlke, 2006/10/16