summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2013-05-13 21:47:17 +0000
committered <ed@FreeBSD.org>2013-05-13 21:47:17 +0000
commitf489ad2feca2af4027fd27065c295185c2ddd646 (patch)
treeaa79f759af2a895083888b10b863a56fa26f13aa /sys/amd64
parent5c8f880a6c5755fe26f8275e63696e42f49bdae0 (diff)
downloadFreeBSD-src-f489ad2feca2af4027fd27065c295185c2ddd646.zip
FreeBSD-src-f489ad2feca2af4027fd27065c295185c2ddd646.tar.gz
Improve readability of static assertions for OFFSET_* macros.
Instead of doing all sorts of weird casting of constants to pointer-pointers, simply use the standard C offsetof() macro to obtain the offset of the respective fields in the structures.
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/vm_machdep.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
index 9883715..acb5b93 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -90,9 +90,10 @@ static u_int cpu_reset_proxyid;
static volatile u_int cpu_reset_proxy_active;
#endif
-CTASSERT((struct thread **)OFFSETOF_CURTHREAD ==
- &((struct pcpu *)NULL)->pc_curthread);
-CTASSERT((struct pcb **)OFFSETOF_CURPCB == &((struct pcpu *)NULL)->pc_curpcb);
+_Static_assert(OFFSETOF_CURTHREAD == offsetof(struct pcpu, pc_curthread),
+ "OFFSETOF_CURTHREAD does not correspond with offset of pc_curthread.");
+_Static_assert(OFFSETOF_CURPCB == offsetof(struct pcpu, pc_curpcb),
+ "OFFSETOF_CURPCB does not correspond with offset of pc_curpcb.");
struct savefpu *
get_pcb_user_save_td(struct thread *td)
OpenPOWER on IntegriCloud