changeset 6722:106fa2e6b67f

Fix for OpenBSD.
author Bruno Haible <bruno@clisp.org>
date Wed, 29 Mar 2006 13:08:31 +0000
parents 93d12db0d11f
children 82dc3ee09c34
files lib/ChangeLog lib/stdint_.h
diffstat 2 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,9 @@
+2006-03-29  Mark D. Baushke  <mdb@gnu.org>
+            Bruno Haible  <bruno@clisp.org>
+
+	* stdint_.h: On OpenBSD, don't redefine types already included in
+	<sys/types.h> and <inttypes.h>.
+
 2006-03-24  Eric Blake  <ebb9@byu.net>
 
 	* time_r.c (copy_string_result): Remove, as it is no longer used.
--- a/lib/stdint_.h
+++ b/lib/stdint_.h
@@ -33,6 +33,16 @@
 #if defined(__FreeBSD__)
 # include <sys/inttypes.h>
 #endif
+#if defined(__OpenBSD__)
+  /* In OpenBSD 3.8, <sys/types.h> includes <machine/types.h>, which defines
+     int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
+     <inttypes.h> includes <machine/types.h> and also defines intptr_t and
+     uintptr_t.  */
+# include <sys/types.h>
+# if HAVE_INTTYPES_H
+#  include <inttypes.h>
+# endif
+#endif
 #if defined(__linux__) && HAVE_SYS_BITYPES_H
   /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
      int{8,16,32,64}_t and __BIT_TYPES_DEFINED__.  In libc5 >= 5.2.2 it is
@@ -62,7 +72,7 @@
 
 /* 7.18.1.1. Exact-width integer types */
 
-#if !defined(__FreeBSD__)
+#if !(defined(__FreeBSD__) || defined(__OpenBSD__))
 
 #ifdef _STDINT_H_NEED_SIGNED_INT_TYPES
 typedef signed char    int8_t;
@@ -97,7 +107,7 @@
 #define _STDINT_H_HAVE_INT64
 #endif
 
-#endif /* !FreeBSD */
+#endif /* !(FreeBSD || OpenBSD) */
 
 /* 7.18.1.2. Minimum-width integer types */
 
@@ -127,14 +137,14 @@
 
 /* 7.18.1.4. Integer types capable of holding object pointers */
 
-#if !defined(__FreeBSD__)
+#if !(defined(__FreeBSD__) || (defined(__OpenBSD__) && HAVE_INTTYPES_H))
 
 /* On some platforms (like IRIX6 MIPS with -n32) sizeof(void*) < sizeof(long),
    but this doesn't matter here.  */
 typedef long          intptr_t;
 typedef unsigned long uintptr_t;
 
-#endif /* !FreeBSD */
+#endif /* !(FreeBSD || (OpenBSD && HAVE_INTTYPES_H)) */
 
 /* 7.18.1.5. Greatest-width integer types */