Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/cddl/osnet/sys/sys Define _LP64 or _ILP32 for all a...
details: https://anonhg.NetBSD.org/src/rev/5ceb07002f26
branches: trunk
changeset: 994582:5ceb07002f26
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Nov 14 17:09:08 2018 +0000
description:
Define _LP64 or _ILP32 for all architectures.
Rather than write out a table for each architecture, rely on the C
compiler to define _LP64 for 64-bit ones, on the assumption that
anything not LP64 is ILP32, and on CTASSERTs to verify this
assumption so that if it's wrong it'll fail safely with a noisy build
failure.
Gives zfs half a chance of building on, e.g., powerpc.
diffstat:
external/cddl/osnet/sys/sys/isa_defs.h | 42 ++++++++++++++++-----------------
1 files changed, 20 insertions(+), 22 deletions(-)
diffs (60 lines):
diff -r aa7ec52c75e0 -r 5ceb07002f26 external/cddl/osnet/sys/sys/isa_defs.h
--- a/external/cddl/osnet/sys/sys/isa_defs.h Wed Nov 14 12:05:29 2018 +0000
+++ b/external/cddl/osnet/sys/sys/isa_defs.h Wed Nov 14 17:09:08 2018 +0000
@@ -1,12 +1,9 @@
-/* $NetBSD: isa_defs.h,v 1.2 2015/02/21 15:00:30 ozaki-r Exp $ */
+/* $NetBSD: isa_defs.h,v 1.3 2018/11/14 17:09:08 riastradh Exp $ */
/*-
- * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
* All rights reserved.
*
- * This code is derived from software contributed to The NetBSD Foundation
- * by Andrew Doran.
- *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -29,23 +26,24 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/types.h>
+#ifndef _OSNET_SYS_ISA_DEFS_H_
+#define _OSNET_SYS_ISA_DEFS_H_
+
+#include <sys/cdefs.h>
-#if defined(__i386__)
-#if !defined(_ILP32)
-#define _ILP32
+#ifdef _LP64
+__CTASSERT(sizeof(int) == 4);
+__CTASSERT(sizeof(long) == 8);
+__CTASSERT(sizeof(void *) == 8);
+#else
+/*
+ * For 64-bit architectures the compiler defines _LP64. All else in
+ * NetBSD is ILP32 for now.
+ */
+__CTASSERT(sizeof(int) == 4);
+__CTASSERT(sizeof(long) == 4);
+__CTASSERT(sizeof(void *) == 4);
+#define _ILP32 1
#endif
-#elif defined(__amd64__)
-#if !defined(_LP64)
-#define _LP64
-#endif
-
-#elif defined(__arm__)
-#if !defined(_ILP32)
-#define _ILP32
-#endif
-
-#else
-#error "architecture not supported"
-#endif
+#endif /* _OSNET_SYS_ISA_DEFS_H_ */
Home |
Main Index |
Thread Index |
Old Index