Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tools/compat Move the typedefs before the header inclusions ...
details: https://anonhg.NetBSD.org/src/rev/865c333c81b0
branches: trunk
changeset: 319822:865c333c81b0
user: christos <christos%NetBSD.org@localhost>
date: Tue Jun 12 23:52:56 2018 +0000
description:
Move the typedefs before the header inclusions (except <features.h>) and
explain why.
diffstat:
tools/compat/compat_defs.h | 79 +++++++++++++++++++++++++--------------------
1 files changed, 43 insertions(+), 36 deletions(-)
diffs (107 lines):
diff -r 3dadffac5ab4 -r 865c333c81b0 tools/compat/compat_defs.h
--- a/tools/compat/compat_defs.h Tue Jun 12 23:08:37 2018 +0000
+++ b/tools/compat/compat_defs.h Tue Jun 12 23:52:56 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_defs.h,v 1.110 2018/06/11 18:48:24 maya Exp $ */
+/* $NetBSD: compat_defs.h,v 1.111 2018/06/12 23:52:56 christos Exp $ */
#ifndef __NETBSD_COMPAT_DEFS_H__
#define __NETBSD_COMPAT_DEFS_H__
@@ -30,6 +30,48 @@
#define __USE_ISOC99 1
#endif /* __linux__ && HAVE_FEATURES_H */
+/*
+ * Type substitutes.
+ * These are controlled via HAVE_TYPE protections and some of them are needed
+ * in other header files (in the build tree not in the host). This is because
+ * we are mixing the header files (which don't need them) with extensions
+ * such as the Solaris headers which depend on types defined by the native
+ * system headers, and might be missing in the build host.
+ */
+
+#if !HAVE_ID_T
+typedef unsigned int id_t;
+#endif
+
+#if !HAVE_SOCKLEN_T
+/*
+ * This is defined as int for compatibility with legacy systems (and not
+ * unsigned int), since universally it was int in most systems that did not
+ * define it.
+ */
+typedef int socklen_t;
+#endif
+
+#if !HAVE_U_LONG
+typedef unsigned long u_long;
+#endif
+
+#if !HAVE_U_CHAR
+typedef unsigned char u_char;
+#endif
+
+#if !HAVE_U_INT
+typedef unsigned int u_int;
+#endif
+
+#if !HAVE_U_SHORT
+typedef unsigned short u_short;
+#endif
+
+#if !HAVE_U_LONGLONG_T
+typedef uint64_t u_longlong_t;
+#endif
+
/* System headers needed for (re)definitions below. */
#include <sys/types.h>
@@ -193,37 +235,6 @@
# endif
#endif
-/* Type substitutes. */
-
-#if !HAVE_ID_T
-typedef unsigned int id_t;
-#endif
-
-#if !HAVE_SOCKLEN_T
-/*
- * This is defined as int for compatibility with legacy systems (and not
- * unsigned int), since universally it was int in most systems that did not
- * define it.
- */
-typedef int socklen_t;
-#endif
-
-#if !HAVE_U_LONG
-typedef unsigned long u_long;
-#endif
-
-#if !HAVE_U_CHAR
-typedef unsigned char u_char;
-#endif
-
-#if !HAVE_U_INT
-typedef unsigned int u_int;
-#endif
-
-#if !HAVE_U_SHORT
-typedef unsigned short u_short;
-#endif
-
/* Prototypes for replacement functions. */
#if !HAVE_DECL_ATOLL
@@ -1298,10 +1309,6 @@
#define NBBY 8
#endif
-#if !HAVE_U_LONGLONG_T
-typedef uint64_t u_longlong_t;
-#endif
-
#if !HAVE_U_QUAD_T
/* #define, not typedef, as quad_t exists as a struct on some systems */
#define quad_t long long
Home |
Main Index |
Thread Index |
Old Index