]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Define wordsize.h macros everywhere
authorSteve Ellcey <sellcey@caviumnetworks.com>
Fri, 4 Nov 2016 16:37:44 +0000 (09:37 -0700)
committerSteve Ellcey <sellcey@caviumnetworks.com>
Fri, 4 Nov 2016 16:37:44 +0000 (09:37 -0700)
* bits/wordsize.h: Add documentation.
* sysdeps/aarch64/bits/wordsize.h : New file
* sysdeps/generic/stdint.h (PTRDIFF_MIN, PTRDIFF_MAX): Update
definitions.
(SIZE_MAX): Change ifdef to if in __WORDSIZE32_SIZE_ULONG check.
* sysdeps/gnu/bits/utmp.h (__WORDSIZE_TIME64_COMPAT32): Check
with #if instead of #ifdef.
* sysdeps/gnu/bits/utmpx.h (__WORDSIZE_TIME64_COMPAT32): Ditto.
* sysdeps/mips/bits/wordsize.h (__WORDSIZE32_SIZE_ULONG,
__WORDSIZE32_PTRDIFF_LONG, __WORDSIZE_TIME64_COMPAT32):
Add or change defines.
* sysdeps/powerpc/powerpc32/bits/wordsize.h: Likewise.
* sysdeps/powerpc/powerpc64/bits/wordsize.h: Likewise.
* sysdeps/s390/s390-32/bits/wordsize.h: Likewise.
* sysdeps/s390/s390-64/bits/wordsize.h: Likewise.
* sysdeps/sparc/sparc32/bits/wordsize.h: Likewise.
* sysdeps/sparc/sparc64/bits/wordsize.h: Likewise.
* sysdeps/tile/tilegx/bits/wordsize.h: Likewise.
* sysdeps/tile/tilepro/bits/wordsize.h: Likewise.
* sysdeps/unix/sysv/linux/alpha/bits/wordsize.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/wordsize.h: Likewise.
* sysdeps/wordsize-32/bits/wordsize.h: Likewise.
* sysdeps/wordsize-64/bits/wordsize.h: Likewise.
* sysdeps/x86/bits/wordsize.h: Likewise.

21 files changed:
ChangeLog
bits/wordsize.h
sysdeps/aarch64/bits/wordsize.h [new file with mode: 0644]
sysdeps/generic/stdint.h
sysdeps/gnu/bits/utmp.h
sysdeps/gnu/bits/utmpx.h
sysdeps/mips/bits/wordsize.h
sysdeps/powerpc/powerpc32/bits/wordsize.h
sysdeps/powerpc/powerpc64/bits/wordsize.h
sysdeps/s390/s390-32/bits/wordsize.h
sysdeps/s390/s390-64/bits/wordsize.h
sysdeps/sparc/sparc32/bits/wordsize.h
sysdeps/sparc/sparc64/bits/wordsize.h
sysdeps/tile/tilegx/bits/wordsize.h
sysdeps/tile/tilepro/bits/wordsize.h
sysdeps/unix/sysv/linux/alpha/bits/wordsize.h
sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
sysdeps/wordsize-32/bits/wordsize.h
sysdeps/wordsize-64/bits/wordsize.h
sysdeps/x86/bits/wordsize.h

index dd5a7f9617f6ac883721a57d7d4564b249d9c5eb..8f84ac657d80f1c72a52aeb95425d41a78e1b03a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2016-11-04  Yury Norov  <ynorov@caviumnetworks.com>
+           Steve Ellcey  <sellcey@caviumnetworks.com>
+
+       * bits/wordsize.h: Add documentation.
+       * sysdeps/aarch64/bits/wordsize.h : New file
+       * sysdeps/generic/stdint.h (PTRDIFF_MIN, PTRDIFF_MAX): Update
+       definitions.
+       (SIZE_MAX): Change ifdef to if in __WORDSIZE32_SIZE_ULONG check.
+       * sysdeps/gnu/bits/utmp.h (__WORDSIZE_TIME64_COMPAT32): Check
+       with #if instead of #ifdef.
+       * sysdeps/gnu/bits/utmpx.h (__WORDSIZE_TIME64_COMPAT32): Ditto.
+       * sysdeps/mips/bits/wordsize.h (__WORDSIZE32_SIZE_ULONG,
+       __WORDSIZE32_PTRDIFF_LONG, __WORDSIZE_TIME64_COMPAT32):
+       Add or change defines.
+       * sysdeps/powerpc/powerpc32/bits/wordsize.h: Likewise.
+       * sysdeps/powerpc/powerpc64/bits/wordsize.h: Likewise.
+       * sysdeps/s390/s390-32/bits/wordsize.h: Likewise.
+       * sysdeps/s390/s390-64/bits/wordsize.h: Likewise.
+       * sysdeps/sparc/sparc32/bits/wordsize.h: Likewise.
+       * sysdeps/sparc/sparc64/bits/wordsize.h: Likewise.
+       * sysdeps/tile/tilegx/bits/wordsize.h: Likewise.
+       * sysdeps/tile/tilepro/bits/wordsize.h: Likewise.
+       * sysdeps/unix/sysv/linux/alpha/bits/wordsize.h: Likewise.
+       * sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h: Likewise.
+       * sysdeps/unix/sysv/linux/sparc/bits/wordsize.h: Likewise.
+       * sysdeps/wordsize-32/bits/wordsize.h: Likewise.
+       * sysdeps/wordsize-64/bits/wordsize.h: Likewise.
+       * sysdeps/x86/bits/wordsize.h: Likewise.
+
 2016-11-04  Wilco Dijkstra  <wdijkstr@arm.com>
            Kevin Petit  <kevin.petit@arm.com>
 
index 9ef0e8526a6cbcc66e2fa9387a15f9776a536375..14edae3a11d01c9714172d9dd6b78b38b086c36c 100644 (file)
@@ -1 +1,27 @@
 #error "This file must be written based on the data type sizes of the target"
+
+/* The following entries are a template for what defines should be in the
+   wordsize.h header file for a target.  */
+
+/* Size in bits of the 'long int' and pointer types.  */
+#define __WORDSIZE
+
+/* This should be set to 1 if __WORDSIZE is 32 and size_t is type
+   'unsigned long' instead of type 'unsigned int'.  This will ensure
+   that SIZE_MAX is defined as an unsigned long constant instead of an
+   unsigned int constant.  Set to 0 if __WORDSIZE is 32 and size_t is
+   'unsigned int' and leave undefined if __WORDSIZE is 64.  */
+#define __WORDSIZE32_SIZE_ULONG
+
+/* This should be set to 1 if __WORDSIZE is 32 and ptrdiff_t is type 'long'
+   instead of type 'int'.  This will ensure that PTRDIFF_MIN and PTRDIFF_MAX
+   are defined as long constants instead of int constants.  Set to 0 if
+   __WORDSIZE is 32 and ptrdiff_t is type 'int' and leave undefined if
+   __WORDSIZE is 64.  */
+#define __WORDSIZE32_PTRDIFF_LONG
+
+/* Set to 1 in order to force time types to be 32 bits instead of 64 bits in
+   struct lastlog and struct utmp{,x} on 64-bit ports.  This may be done in
+   order to make 64-bit ports compatible with 32-bit ports.  Set to 0 for
+   64-bit ports where the time types are 64-bits or for any 32-bit ports.  */
+#define __WORDSIZE_TIME64_COMPAT32
diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h
new file mode 100644 (file)
index 0000000..eadbb48
--- /dev/null
@@ -0,0 +1,28 @@
+/* Determine the wordsize from the preprocessor defines.
+
+   Copyright (C) 2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifdef __LP64__
+# define __WORDSIZE                    64
+#else
+# define __WORDSIZE                    32
+# define __WORDSIZE32_SIZE_ULONG       1
+# define __WORDSIZE32_PTRDIFF_LONG     1
+#endif
+
+#define __WORDSIZE_TIME64_COMPAT32     0
index 5428dbc30d7283d2f948a04fe451f408c3bc7d38..8e4347c6231dafaa57e5e68d2e1f897c0b0a5a3f 100644 (file)
@@ -249,8 +249,13 @@ typedef unsigned long long int     uintmax_t;
 #  define PTRDIFF_MIN          (-9223372036854775807L-1)
 #  define PTRDIFF_MAX          (9223372036854775807L)
 # else
-#  define PTRDIFF_MIN          (-2147483647-1)
-#  define PTRDIFF_MAX          (2147483647)
+#  if __WORDSIZE32_PTRDIFF_LONG
+#   define PTRDIFF_MIN         (-2147483647L-1)
+#   define PTRDIFF_MAX         (2147483647L)
+#  else
+#   define PTRDIFF_MIN         (-2147483647-1)
+#   define PTRDIFF_MAX         (2147483647)
+#  endif
 # endif
 
 /* Limits of `sig_atomic_t'.  */
@@ -261,7 +266,7 @@ typedef unsigned long long int      uintmax_t;
 # if __WORDSIZE == 64
 #  define SIZE_MAX             (18446744073709551615UL)
 # else
-#  ifdef __WORDSIZE32_SIZE_ULONG
+#  if __WORDSIZE32_SIZE_ULONG
 #   define SIZE_MAX            (4294967295UL)
 #  else
 #   define SIZE_MAX            (4294967295U)
index 2a1ffcbf6fd6d17aceb985c3e9124d9807ca61db..bce1a7ba5f8628f129afea4a74edda6bee06c174 100644 (file)
@@ -35,7 +35,7 @@
    previous logins.  */
 struct lastlog
   {
-#ifdef __WORDSIZE_TIME64_COMPAT32
+#if __WORDSIZE_TIME64_COMPAT32
     int32_t ll_time;
 #else
     __time_t ll_time;
@@ -68,7 +68,7 @@ struct utmp
 /* The ut_session and ut_tv fields must be the same size when compiled
    32- and 64-bit.  This allows data files and shared memory to be
    shared between 32- and 64-bit applications.  */
-#ifdef __WORDSIZE_TIME64_COMPAT32
+#if __WORDSIZE_TIME64_COMPAT32
   int32_t ut_session;          /* Session ID, used for windowing.  */
   struct
   {
index b41548b24cb9b8fe13b9800d3aadeeaeeb38da81..a438660ae9aa4a7c11e6344fb9e252aeefa68e38 100644 (file)
@@ -66,7 +66,7 @@ struct utmpx
 /* The fields ut_session and ut_tv must be the same size when compiled
    32- and 64-bit.  This allows files and shared memory to be shared
    between 32- and 64-bit applications.  */
-#ifdef __WORDSIZE_TIME64_COMPAT32
+#if __WORDSIZE_TIME64_COMPAT32
   __int32_t ut_session;                /* Session ID, used for windowing.  */
   struct
   {
index bc9043544200467ec809c0a2b33684b6b38604bb..7a3546b4f1d58c906a25fc16a65b9e6fa8a62918 100644 (file)
 
 #include <sgidefs.h>
 
-#define __WORDSIZE     _MIPS_SZPTR
+#define __WORDSIZE                     _MIPS_SZPTR
+
 #if _MIPS_SIM == _ABI64
 # define __WORDSIZE_TIME64_COMPAT32    1
+#else
+# define __WORDSIZE_TIME64_COMPAT32    0
+#endif
+
+#if __WORDSIZE == 32
+#define __WORDSIZE32_SIZE_ULONG                0
+#define __WORDSIZE32_PTRDIFF_LONG      0
 #endif
index f31ac9ab083a17cf684a90f6e278a67e0a7da698..04ca9debf00d7ee97ddf83dcd2e66c139bcd9d7c 100644 (file)
@@ -5,4 +5,7 @@
 # define __WORDSIZE_TIME64_COMPAT32    1
 #else
 # define __WORDSIZE    32
+# define __WORDSIZE_TIME64_COMPAT32    0
+# define __WORDSIZE32_SIZE_ULONG       0
+# define __WORDSIZE32_PTRDIFF_LONG     0
 #endif
index f31ac9ab083a17cf684a90f6e278a67e0a7da698..04ca9debf00d7ee97ddf83dcd2e66c139bcd9d7c 100644 (file)
@@ -5,4 +5,7 @@
 # define __WORDSIZE_TIME64_COMPAT32    1
 #else
 # define __WORDSIZE    32
+# define __WORDSIZE_TIME64_COMPAT32    0
+# define __WORDSIZE32_SIZE_ULONG       0
+# define __WORDSIZE32_PTRDIFF_LONG     0
 #endif
index da791fa28eb0dca3adc6ad5a0a1f50b91aa0af27..c7a5fbf65596b81f0ad45e3869c0e0200b18f854 100644 (file)
@@ -5,8 +5,11 @@
 #else
 # define __WORDSIZE    32
 # define __WORDSIZE32_SIZE_ULONG       1
+# define __WORDSIZE32_PTRDIFF_LONG      0
 #endif
 
+#define __WORDSIZE_TIME64_COMPAT32     0
+
 #if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
 
 /* Signal that we didn't used to have a `long double'. The changes all
index da791fa28eb0dca3adc6ad5a0a1f50b91aa0af27..31e0ec6699c5907e640b903827fd704f9c0d1bb5 100644 (file)
@@ -5,8 +5,11 @@
 #else
 # define __WORDSIZE    32
 # define __WORDSIZE32_SIZE_ULONG       1
+# define __WORDSIZE32_PTRDIFF_LONG     0
 #endif
 
+#define __WORDSIZE_TIME64_COMPAT32     0
+
 #if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
 
 /* Signal that we didn't used to have a `long double'. The changes all
index d8fd1a513dc9c2eec4e7e6398231c40d3db12123..2f66f10d7206731a2110721685d0ac6dc184ab14 100644 (file)
@@ -5,4 +5,7 @@
 # define __WORDSIZE_TIME64_COMPAT32    1
 #else
 # define __WORDSIZE    32
+# define __WORDSIZE_TIME64_COMPAT32    0
+# define __WORDSIZE32_SIZE_ULONG       0
+# define __WORDSIZE32_PTRDIFF_LONG     0
 #endif
index d8fd1a513dc9c2eec4e7e6398231c40d3db12123..2f66f10d7206731a2110721685d0ac6dc184ab14 100644 (file)
@@ -5,4 +5,7 @@
 # define __WORDSIZE_TIME64_COMPAT32    1
 #else
 # define __WORDSIZE    32
+# define __WORDSIZE_TIME64_COMPAT32    0
+# define __WORDSIZE32_SIZE_ULONG       0
+# define __WORDSIZE32_PTRDIFF_LONG     0
 #endif
index 5d4e4b4470363a670d7e694c6220a589ffd792da..9dc4da5de97a8f56b7e4b8961ff8e2edfbb0bef9 100644 (file)
@@ -5,4 +5,7 @@
 # define __WORDSIZE_TIME64_COMPAT32    1
 #else
 # define __WORDSIZE    32
+# define __WORDSIZE_TIME64_COMPAT32    0
+# define __WORDSIZE32_SIZE_ULONG       0
+# define __WORDSIZE32_PTRDIFF_LONG     0
 #endif
index da587a2f1217ee1f87e7c26ef3f813762a05c3e7..82815381316d7e07ecd6fa49be94badefb51e0ee 100644 (file)
@@ -1,3 +1,4 @@
 /* Determine the wordsize from the preprocessor defines.  */
 
-#define __WORDSIZE     32
+#define __WORDSIZE                     32
+#define __WORDSIZE_TIME64_COMPAT32     0
index 51fc433d6eaf857c67be29e8012a3f80875e8753..f0961f69cc8e35e9bd63d08057b909fead47614b 100644 (file)
@@ -16,6 +16,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #define __WORDSIZE     64
+#define __WORDSIZE_TIME64_COMPAT32     0
 
 #if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
 
index 3e8a1e0a15f409ce26588146119a5ce9d7138b3f..109f08ccdcf496fc7dff73d98970c659be129099 100644 (file)
@@ -5,6 +5,9 @@
 # define __WORDSIZE_TIME64_COMPAT32    1
 #else
 # define __WORDSIZE    32
+# define __WORDSIZE_TIME64_COMPAT32    0
+# define __WORDSIZE32_SIZE_ULONG       0
+# define __WORDSIZE32_PTRDIFF_LONG     0
 #endif
 
 #if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
index 2d958d29e576b6d0ac05e9dcc5534c2aab62dc9b..76d65799f1b491884da3aec0b3b592c06a3377cf 100644 (file)
@@ -4,6 +4,8 @@
 # define __WORDSIZE    64
 #else
 # define __WORDSIZE    32
+# define __WORDSIZE32_SIZE_ULONG       0
+# define __WORDSIZE32_PTRDIFF_LONG     0
 #endif
 
 #if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
index 2aa16bcde5f64cc1fa123922f0c3e22d3e7803af..a251f3a9231af035664ee167ec0a7c67b6ac31aa 100644 (file)
@@ -15,4 +15,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#define __WORDSIZE     32
+#define __WORDSIZE                     32
+#define __WORDSIZE_TIME64_COMPAT32     0
+#define __WORDSIZE32_SIZE_ULONG                0
+#define __WORDSIZE32_PTRDIFF_LONG      0
index 0944f9e267d5d92a3279d4a3a3516af759a7943b..8b5c502a9bea2480515961408734488d7faf6aef 100644 (file)
@@ -15,4 +15,5 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#define __WORDSIZE     64
+#define __WORDSIZE                     64
+#define __WORDSIZE_TIME64_COMPAT32     0
index e25af287e8a36194813ef383defb8044546b2fde..70f652bca14d65c1de5a21669e7c0ffb8ecfe5ea 100644 (file)
@@ -4,10 +4,14 @@
 # define __WORDSIZE    64
 #else
 # define __WORDSIZE    32
+#define __WORDSIZE32_SIZE_ULONG                0
+#define __WORDSIZE32_PTRDIFF_LONG      0
 #endif
 
 #ifdef __x86_64__
 # define __WORDSIZE_TIME64_COMPAT32    1
 /* Both x86-64 and x32 use the 64-bit system call interface.  */
 # define __SYSCALL_WORDSIZE            64
+#else
+# define __WORDSIZE_TIME64_COMPAT32    0
 #endif