Module Name: src
Committed By: riastradh
Date: Wed Nov 14 17:09:08 UTC 2018
Modified Files:
src/external/cddl/osnet/sys/sys: isa_defs.h
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/sys/sys/isa_defs.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/cddl/osnet/sys/sys/isa_defs.h
diff -u src/external/cddl/osnet/sys/sys/isa_defs.h:1.2 src/external/cddl/osnet/sys/sys/isa_defs.h:1.3
--- src/external/cddl/osnet/sys/sys/isa_defs.h:1.2 Sat Feb 21 15:00:30 2015
+++ src/external/cddl/osnet/sys/sys/isa_defs.h Wed Nov 14 17:09:08 2018
@@ -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>
-
-#if defined(__i386__)
-#if !defined(_ILP32)
-#define _ILP32
-#endif
-
-#elif defined(__amd64__)
-#if !defined(_LP64)
-#define _LP64
-#endif
+#ifndef _OSNET_SYS_ISA_DEFS_H_
+#define _OSNET_SYS_ISA_DEFS_H_
-#elif defined(__arm__)
-#if !defined(_ILP32)
-#define _ILP32
-#endif
+#include <sys/cdefs.h>
+#ifdef _LP64
+__CTASSERT(sizeof(int) == 4);
+__CTASSERT(sizeof(long) == 8);
+__CTASSERT(sizeof(void *) == 8);
#else
-#error "architecture not supported"
+/*
+ * 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
+
+#endif /* _OSNET_SYS_ISA_DEFS_H_ */