Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libc/sys Make the t_ucontext.c test more portable



details:   https://anonhg.NetBSD.org/src/rev/ed832f3c9696
branches:  trunk
changeset: 359860:ed832f3c9696
user:      kamil <kamil%NetBSD.org@localhost>
date:      Tue Feb 27 11:15:53 2018 +0000

description:
Make the t_ucontext.c test more portable

Cast _UC_MACHINE_*(&u) to (register_t).
This allows to print the returned values with PRIxREGISTER.

This corrects build failures on MIPS and HPPA.
sizeof(int) == sizeof(long) on these 32-bit systems.

diffstat:

 tests/lib/libc/sys/t_ucontext.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r 5a2bd85968e8 -r ed832f3c9696 tests/lib/libc/sys/t_ucontext.c
--- a/tests/lib/libc/sys/t_ucontext.c   Tue Feb 27 10:09:42 2018 +0000
+++ b/tests/lib/libc/sys/t_ucontext.c   Tue Feb 27 11:15:53 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ucontext.c,v 1.3 2018/02/25 15:31:07 christos Exp $ */
+/* $NetBSD: t_ucontext.c,v 1.4 2018/02/27 11:15:53 kamil Exp $ */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include <sys/cdefs.h>
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_ucontext.c,v 1.3 2018/02/25 15:31:07 christos Exp $");
+__RCSID("$NetBSD: t_ucontext.c,v 1.4 2018/02/27 11:15:53 kamil Exp $");
 
 #include <atf-c.h>
 #include <stdio.h>
@@ -80,7 +80,7 @@
 
        getcontext(&u);
 
-       printf("_UC_MACHINE_SP(u)=%" PRIxREGISTER "\n", _UC_MACHINE_SP(&u));
+       printf("_UC_MACHINE_SP(u)=%" PRIxREGISTER "\n", (register_t)_UC_MACHINE_SP(&u));
 }
 
 ATF_TC(ucontext_fp);
@@ -95,7 +95,7 @@
 
        getcontext(&u);
 
-       printf("_UC_MACHINE_FP(u)=%" PRIxREGISTER "\n", _UC_MACHINE_FP(&u));
+       printf("_UC_MACHINE_FP(u)=%" PRIxREGISTER "\n", (register_t)_UC_MACHINE_FP(&u));
 }
 
 ATF_TC(ucontext_pc);
@@ -110,7 +110,7 @@
 
        getcontext(&u);
 
-       printf("_UC_MACHINE_PC(u)=%" PRIxREGISTER "\n", _UC_MACHINE_PC(&u));
+       printf("_UC_MACHINE_PC(u)=%" PRIxREGISTER "\n", (register_t)_UC_MACHINE_PC(&u));
 }
 
 ATF_TC(ucontext_intrv);
@@ -125,7 +125,7 @@
 
        getcontext(&u);
 
-       printf("_UC_MACHINE_INTRV(u)=%" PRIxREGISTER "\n", _UC_MACHINE_INTRV(&u));
+       printf("_UC_MACHINE_INTRV(u)=%" PRIxREGISTER "\n", (register_t)_UC_MACHINE_INTRV(&u));
 }
 
 ATF_TP_ADD_TCS(tp)



Home | Main Index | Thread Index | Old Index