about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog37
-rw-r--r--bits/stdint-intn.h29
-rw-r--r--bits/stdint-uintn.h29
-rw-r--r--conform/Makefile6
-rw-r--r--include/netdb.h2
-rw-r--r--inet/netinet/in.h2
-rw-r--r--posix/sys/types.h27
-rw-r--r--resolv/netdb.h2
-rw-r--r--stdlib/Makefile3
-rw-r--r--sysdeps/generic/stdint.h28
10 files changed, 105 insertions, 60 deletions
diff --git a/ChangeLog b/ChangeLog
index c0bb010f5f..a37bdd584a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,40 @@
+2017-05-04  Joseph Myers  <joseph@codesourcery.com>
+
+	[BZ #21455]
+	* bits/stdint-intn.h: New file.
+	* bits/stdint-uintn.h: Likewise.
+	* stdlib/Makefile (headers): Add bits/stdint-intn.h and
+	bits/stdint-uintn.h.
+	* inet/netinet/in.h: Include <bits/stdint-uintn.h> instead of
+	<stdint.h>.
+	* posix/sys/types.h: Include <bits/stdint-intn.h>.
+	(__int8_t_defined): Do not define here.
+	(int8_t): Likewise.
+	(int16_t): Likewise.
+	(int32_t): Likewise.
+	(int64_t): Likewise.
+	[__GNUC_PREREQ (2, 7)] (__intN_t): Likewise.
+	* resolv/netdb.h: Include <bits/stdint-uintn.h> instead of
+	<stdint.h>.
+	* include/netdb.h [_ISOMAC]: Do not include <stdint.h>.
+	* sysdeps/generic/stdint.h: Include <bits/stdint-intn.h> and
+	<bits/stdint-uintn.h>.
+	(int8_t): Do not define here.
+	(int16_t): Likewise.
+	(int32_t): Likewise.
+	(int64_t): Likewise.
+	(uint8_t): Likewise.
+	(uint16_t): Likewise.
+	(uint32_t): Likewise.
+	(uint64_t): Likewise.
+	* conform/Makefile (test-xfail-XPG42/arpa/inet.h/conform): Remove
+	variable.
+	(test-xfail-XPG42/netdb.h/conform): Likewise.
+	(test-xfail-XPG42/netinet/in.h/conform): Likewise.
+	(test-xfail-UNIX98/arpa/inet.h/conform): Likewise.
+	(test-xfail-UNIX98/netdb.h/conform): Likewise.
+	(test-xfail-UNIX98/netinet/in.h/conform): Likewise.
+
 2017-05-04  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
 
 	* sysdeps/generic/math_private.h (mathx_hidden_def): New macro.
diff --git a/bits/stdint-intn.h b/bits/stdint-intn.h
new file mode 100644
index 0000000000..87374865e2
--- /dev/null
+++ b/bits/stdint-intn.h
@@ -0,0 +1,29 @@
+/* Define intN_t types.
+   Copyright (C) 2017 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/>.  */
+
+#ifndef _BITS_STDINT_INTN_H
+#define _BITS_STDINT_INTN_H	1
+
+#include <bits/types.h>
+
+typedef __int8_t int8_t;
+typedef __int16_t int16_t;
+typedef __int32_t int32_t;
+typedef __int64_t int64_t;
+
+#endif /* bits/stdint-intn.h */
diff --git a/bits/stdint-uintn.h b/bits/stdint-uintn.h
new file mode 100644
index 0000000000..d27b7786ab
--- /dev/null
+++ b/bits/stdint-uintn.h
@@ -0,0 +1,29 @@
+/* Define uintN_t types.
+   Copyright (C) 2017 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/>.  */
+
+#ifndef _BITS_STDINT_UINTN_H
+#define _BITS_STDINT_UINTN_H	1
+
+#include <bits/types.h>
+
+typedef __uint8_t uint8_t;
+typedef __uint16_t uint16_t;
+typedef __uint32_t uint32_t;
+typedef __uint64_t uint64_t;
+
+#endif /* bits/stdint-uintn.h */
diff --git a/conform/Makefile b/conform/Makefile
index 2039ae8df7..63556b5bdb 100644
--- a/conform/Makefile
+++ b/conform/Makefile
@@ -163,16 +163,10 @@ test-xfail-XOPEN2K8/ndbm.h/conform = yes
 # Unsorted expected failures.
 test-xfail-XPG4/signal.h/conform = yes
 test-xfail-XPG4/sys/wait.h/conform = yes
-test-xfail-XPG42/arpa/inet.h/conform = yes
-test-xfail-XPG42/netdb.h/conform = yes
-test-xfail-XPG42/netinet/in.h/conform = yes
 test-xfail-XPG42/signal.h/conform = yes
 test-xfail-XPG42/sys/wait.h/conform = yes
 test-xfail-XPG42/ucontext.h/conform = yes
 test-xfail-POSIX/sys/wait.h/conform = yes
-test-xfail-UNIX98/arpa/inet.h/conform = yes
-test-xfail-UNIX98/netdb.h/conform = yes
-test-xfail-UNIX98/netinet/in.h/conform = yes
 test-xfail-UNIX98/signal.h/conform = yes
 test-xfail-UNIX98/sys/wait.h/conform = yes
 test-xfail-UNIX98/ucontext.h/conform = yes
diff --git a/include/netdb.h b/include/netdb.h
index e1f051d16a..d425a64506 100644
--- a/include/netdb.h
+++ b/include/netdb.h
@@ -1,8 +1,8 @@
 #ifndef	_NETDB_H
 #include <resolv/netdb.h>
-#include <stdint.h>
 
 #ifndef _ISOMAC
+# include <stdint.h>
 /* Macros for accessing h_errno from inside libc.  */
 # if IS_IN_LIB
 #  undef  h_errno
diff --git a/inet/netinet/in.h b/inet/netinet/in.h
index e064188721..f94b4b4e1c 100644
--- a/inet/netinet/in.h
+++ b/inet/netinet/in.h
@@ -19,7 +19,7 @@
 #define	_NETINET_IN_H	1
 
 #include <features.h>
-#include <stdint.h>
+#include <bits/stdint-uintn.h>
 #include <sys/socket.h>
 #include <bits/types.h>
 
diff --git a/posix/sys/types.h b/posix/sys/types.h
index b3a27c51f0..c6326b1910 100644
--- a/posix/sys/types.h
+++ b/posix/sys/types.h
@@ -153,22 +153,11 @@ typedef unsigned int uint;
 
 /* These size-specific names are used by some of the inet code.  */
 
-#if !__GNUC_PREREQ (2, 7)
+#include <bits/stdint-intn.h>
 
-/* These types are defined by the ISO C99 header <inttypes.h>. */
-# ifndef __int8_t_defined
-#  define __int8_t_defined
-typedef	char int8_t;
-typedef	short int int16_t;
-typedef	int int32_t;
-#  if __WORDSIZE == 64
-typedef long int int64_t;
-#  else
-__extension__ typedef long long int int64_t;
-#  endif
-# endif
+#if !__GNUC_PREREQ (2, 7)
 
-/* But these were defined by ISO C without the first `_'.  */
+/* These were defined by ISO C without the first `_'.  */
 typedef	unsigned char u_int8_t;
 typedef	unsigned short int u_int16_t;
 typedef	unsigned int u_int32_t;
@@ -183,19 +172,9 @@ typedef int register_t;
 #else
 
 /* For GCC 2.7 and later, we can use specific type-size attributes.  */
-# define __intN_t(N, MODE) \
-  typedef int int##N##_t __attribute__ ((__mode__ (MODE)))
 # define __u_intN_t(N, MODE) \
   typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE)))
 
-# ifndef __int8_t_defined
-#  define __int8_t_defined
-__intN_t (8, __QI__);
-__intN_t (16, __HI__);
-__intN_t (32, __SI__);
-__intN_t (64, __DI__);
-# endif
-
 __u_intN_t (8, __QI__);
 __u_intN_t (16, __HI__);
 __u_intN_t (32, __SI__);
diff --git a/resolv/netdb.h b/resolv/netdb.h
index f4eb1a7d60..936fab95ed 100644
--- a/resolv/netdb.h
+++ b/resolv/netdb.h
@@ -25,7 +25,7 @@
 #include <features.h>
 
 #include <netinet/in.h>
-#include <stdint.h>
+#include <bits/stdint-uintn.h>
 #ifdef __USE_MISC
 /* This is necessary to make this include file properly replace the
    Sun version.  */
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 5751b5d600..4206f2566e 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -28,7 +28,8 @@ headers	:= stdlib.h bits/stdlib.h bits/stdlib-ldbl.h bits/stdlib-float.h      \
 	   errno.h sys/errno.h bits/errno.h				      \
 	   ucontext.h sys/ucontext.h					      \
 	   alloca.h fmtmsg.h						      \
-	   bits/stdlib-bsearch.h sys/random.h
+	   bits/stdlib-bsearch.h sys/random.h bits/stdint-intn.h	      \
+	   bits/stdint-uintn.h
 
 routines	:=							      \
 	atof atoi atol atoll						      \
diff --git a/sysdeps/generic/stdint.h b/sysdeps/generic/stdint.h
index 13790e3ce3..b553c52665 100644
--- a/sysdeps/generic/stdint.h
+++ b/sysdeps/generic/stdint.h
@@ -31,34 +31,10 @@
 /* Exact integral types.  */
 
 /* Signed.  */
-
-/* There is some amount of overlap with <sys/types.h> as known by inet code */
-#ifndef __int8_t_defined
-# define __int8_t_defined
-typedef signed char		int8_t;
-typedef short int		int16_t;
-typedef int			int32_t;
-# if __WORDSIZE == 64
-typedef long int		int64_t;
-# else
-__extension__
-typedef long long int		int64_t;
-# endif
-#endif
+#include <bits/stdint-intn.h>
 
 /* Unsigned.  */
-typedef unsigned char		uint8_t;
-typedef unsigned short int	uint16_t;
-#ifndef __uint32_t_defined
-typedef unsigned int		uint32_t;
-# define __uint32_t_defined
-#endif
-#if __WORDSIZE == 64
-typedef unsigned long int	uint64_t;
-#else
-__extension__
-typedef unsigned long long int	uint64_t;
-#endif
+#include <bits/stdint-uintn.h>
 
 
 /* Small types.  */