Message ID | 1467843094-2914-1-git-send-email-ynorov@caviumnetworks.com |
---|---|
State | New |
Headers | show |
Yury Norov <ynorov@caviumnetworks.com> writes: > diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h > new file mode 100644 > index 0000000..8bcbea9 > --- /dev/null > +++ b/sysdeps/aarch64/bits/wordsize.h > @@ -0,0 +1,29 @@ > +/* 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 > +# define __WORDSIZE32_SIZE_ULONG 0 > +# define __WORDSIZE32_PTRDIFF_LONG 0 > +#else > +# define __WORDSIZE 32 > +# define __WORDSIZE32_SIZE_ULONG 1 > +# define __WORDSIZE32_PTRDIFF_LONG 1 > +#endif There should be a comment explaining their meaning. > + Trailing empty line (in all files). Andreas.
On Thu, Jul 07, 2016 at 12:54:27AM +0200, Andreas Schwab wrote: > Yury Norov <ynorov@caviumnetworks.com> writes: > > > diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h > > new file mode 100644 > > index 0000000..8bcbea9 > > --- /dev/null > > +++ b/sysdeps/aarch64/bits/wordsize.h > > @@ -0,0 +1,29 @@ > > +/* 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 > > +# define __WORDSIZE32_SIZE_ULONG 0 > > +# define __WORDSIZE32_PTRDIFF_LONG 0 > > +#else > > +# define __WORDSIZE 32 > > +# define __WORDSIZE32_SIZE_ULONG 1 > > +# define __WORDSIZE32_PTRDIFF_LONG 1 > > +#endif > > There should be a comment explaining their meaning. __WORDSIZE and __WORDSIZE32_SIZE_ULONG are not new macros, so no description is needed, right? I don't know much about __WORDSIZE32_PTRDIFF_LONG. Andrew told it's for some testcases in gcc testsuite. > > + > > Trailing empty line (in all files). > > Andreas. Oh, I did it right opposite. Will fix later. Yury.
Yury Norov <ynorov@caviumnetworks.com> writes: > __WORDSIZE and __WORDSIZE32_SIZE_ULONG are not new macros, so no > description is needed, right? Some documentation is always needed. A good place would be bits/wordsize.h, adding a template that can be copied for a new port. Andreas.
diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h new file mode 100644 index 0000000..8bcbea9 --- /dev/null +++ b/sysdeps/aarch64/bits/wordsize.h @@ -0,0 +1,29 @@ +/* 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 +# define __WORDSIZE32_SIZE_ULONG 0 +# define __WORDSIZE32_PTRDIFF_LONG 0 +#else +# define __WORDSIZE 32 +# define __WORDSIZE32_SIZE_ULONG 1 +# define __WORDSIZE32_PTRDIFF_LONG 1 +#endif + diff --git a/sysdeps/generic/stdint.h b/sysdeps/generic/stdint.h index 4427627..3d26d0b 100644 --- a/sysdeps/generic/stdint.h +++ b/sysdeps/generic/stdint.h @@ -248,8 +248,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'. */ @@ -260,7 +265,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) diff --git a/sysdeps/mips/bits/wordsize.h b/sysdeps/mips/bits/wordsize.h index bc90435..896e6ce 100644 --- a/sysdeps/mips/bits/wordsize.h +++ b/sysdeps/mips/bits/wordsize.h @@ -21,3 +21,7 @@ #if _MIPS_SIM == _ABI64 # define __WORDSIZE_TIME64_COMPAT32 1 #endif + +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 + diff --git a/sysdeps/powerpc/powerpc32/bits/wordsize.h b/sysdeps/powerpc/powerpc32/bits/wordsize.h index f31ac9a..5d4bfcc 100644 --- a/sysdeps/powerpc/powerpc32/bits/wordsize.h +++ b/sysdeps/powerpc/powerpc32/bits/wordsize.h @@ -6,3 +6,7 @@ #else # define __WORDSIZE 32 #endif + +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 + diff --git a/sysdeps/powerpc/powerpc64/bits/wordsize.h b/sysdeps/powerpc/powerpc64/bits/wordsize.h index f31ac9a..5d4bfcc 100644 --- a/sysdeps/powerpc/powerpc64/bits/wordsize.h +++ b/sysdeps/powerpc/powerpc64/bits/wordsize.h @@ -6,3 +6,7 @@ #else # define __WORDSIZE 32 #endif + +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 + diff --git a/sysdeps/s390/s390-32/bits/wordsize.h b/sysdeps/s390/s390-32/bits/wordsize.h index da791fa..d9307dc 100644 --- a/sysdeps/s390/s390-32/bits/wordsize.h +++ b/sysdeps/s390/s390-32/bits/wordsize.h @@ -17,3 +17,6 @@ # define __NO_LONG_DOUBLE_MATH 1 # endif #endif + +#define __WORDSIZE32_PTRDIFF_LONG 0 + diff --git a/sysdeps/s390/s390-64/bits/wordsize.h b/sysdeps/s390/s390-64/bits/wordsize.h index da791fa..d9307dc 100644 --- a/sysdeps/s390/s390-64/bits/wordsize.h +++ b/sysdeps/s390/s390-64/bits/wordsize.h @@ -17,3 +17,6 @@ # define __NO_LONG_DOUBLE_MATH 1 # endif #endif + +#define __WORDSIZE32_PTRDIFF_LONG 0 + diff --git a/sysdeps/sparc/sparc32/bits/wordsize.h b/sysdeps/sparc/sparc32/bits/wordsize.h index d8fd1a5..1e53e9b 100644 --- a/sysdeps/sparc/sparc32/bits/wordsize.h +++ b/sysdeps/sparc/sparc32/bits/wordsize.h @@ -6,3 +6,7 @@ #else # define __WORDSIZE 32 #endif + +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 + diff --git a/sysdeps/sparc/sparc64/bits/wordsize.h b/sysdeps/sparc/sparc64/bits/wordsize.h index d8fd1a5..1e53e9b 100644 --- a/sysdeps/sparc/sparc64/bits/wordsize.h +++ b/sysdeps/sparc/sparc64/bits/wordsize.h @@ -6,3 +6,7 @@ #else # define __WORDSIZE 32 #endif + +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 + diff --git a/sysdeps/tile/tilegx/bits/wordsize.h b/sysdeps/tile/tilegx/bits/wordsize.h index 5d4e4b4..03b2e06 100644 --- a/sysdeps/tile/tilegx/bits/wordsize.h +++ b/sysdeps/tile/tilegx/bits/wordsize.h @@ -6,3 +6,7 @@ #else # define __WORDSIZE 32 #endif + +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 + diff --git a/sysdeps/tile/tilepro/bits/wordsize.h b/sysdeps/tile/tilepro/bits/wordsize.h index da587a2..e3319cc 100644 --- a/sysdeps/tile/tilepro/bits/wordsize.h +++ b/sysdeps/tile/tilepro/bits/wordsize.h @@ -1,3 +1,7 @@ /* Determine the wordsize from the preprocessor defines. */ #define __WORDSIZE 32 + +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 + diff --git a/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h b/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h index 51fc433..fd8670b 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h @@ -27,3 +27,7 @@ # define __NO_LONG_DOUBLE_MATH 1 # endif #endif + +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 + diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h b/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h index 3e8a1e0..326c389 100644 --- a/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h +++ b/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h @@ -17,3 +17,7 @@ # define __NO_LONG_DOUBLE_MATH 1 # endif #endif + +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 + diff --git a/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h b/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h index 2d958d2..baed304 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h @@ -18,3 +18,7 @@ # endif # endif #endif + +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 + diff --git a/sysdeps/wordsize-32/bits/wordsize.h b/sysdeps/wordsize-32/bits/wordsize.h index 2aa16bc..63f6af5 100644 --- a/sysdeps/wordsize-32/bits/wordsize.h +++ b/sysdeps/wordsize-32/bits/wordsize.h @@ -16,3 +16,7 @@ <http://www.gnu.org/licenses/>. */ #define __WORDSIZE 32 + +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 + diff --git a/sysdeps/wordsize-64/bits/wordsize.h b/sysdeps/wordsize-64/bits/wordsize.h index 0944f9e..6e2dfdd 100644 --- a/sysdeps/wordsize-64/bits/wordsize.h +++ b/sysdeps/wordsize-64/bits/wordsize.h @@ -16,3 +16,7 @@ <http://www.gnu.org/licenses/>. */ #define __WORDSIZE 64 + +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 + diff --git a/sysdeps/x86/bits/wordsize.h b/sysdeps/x86/bits/wordsize.h index e25af28..66d9abf 100644 --- a/sysdeps/x86/bits/wordsize.h +++ b/sysdeps/x86/bits/wordsize.h @@ -11,3 +11,6 @@ /* Both x86-64 and x32 use the 64-bit system call interface. */ # define __SYSCALL_WORDSIZE 64 #endif + +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0