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 - add __unreachable() after ATF_REQUIRE(p...



details:   https://anonhg.NetBSD.org/src/rev/318baa6c2cd3
branches:  trunk
changeset: 448508:318baa6c2cd3
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Feb 04 09:35:11 2019 +0000

description:
- add __unreachable() after ATF_REQUIRE(pid > 0) where pid <= 0.
- rearrange one switch so that the -1/0/default cases are the
  same order in all instances.

diffstat:

 tests/lib/libc/sys/t_wait.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (65 lines):

diff -r bfae379a7ea5 -r 318baa6c2cd3 tests/lib/libc/sys/t_wait.c
--- a/tests/lib/libc/sys/t_wait.c       Mon Feb 04 09:31:22 2019 +0000
+++ b/tests/lib/libc/sys/t_wait.c       Mon Feb 04 09:35:11 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_wait.c,v 1.8 2017/01/13 19:28:55 christos Exp $ */
+/* $NetBSD: t_wait.c,v 1.9 2019/02/04 09:35:11 mrg Exp $ */
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_wait.c,v 1.8 2017/01/13 19:28:55 christos Exp $");
+__RCSID("$NetBSD: t_wait.c,v 1.9 2019/02/04 09:35:11 mrg Exp $");
 
 #include <sys/wait.h>
 #include <sys/resource.h>
@@ -76,11 +76,12 @@
        pid_t pid;
 
        switch (pid = fork()) {
-       case -1:
-               ATF_REQUIRE(pid > 0);
        case 0:
                exit(0x5a5a5a5a);
                /*NOTREACHED*/
+       case -1:
+               ATF_REQUIRE(pid > 0);
+               __unreachable();
        default:
                ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
                ATF_REQUIRE(WIFEXITED(st) && WEXITSTATUS(st) == 0x5a);
@@ -114,6 +115,7 @@
                /*FALLTHROUGH*/
        case -1:
                ATF_REQUIRE(pid > 0);
+               __unreachable();
        default:
                ATF_REQUIRE(kill(pid, SIGTERM) == 0);
                ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
@@ -150,6 +152,7 @@
                /*FALLTHROUGH*/
        case -1:
                ATF_REQUIRE(pid > 0);
+               __unreachable();
        default:
                ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
                ATF_REQUIRE(WIFSIGNALED(st) && WTERMSIG(st) == SIGSEGV
@@ -186,6 +189,7 @@
                /*FALLTHROUGH*/
        case -1:
                ATF_REQUIRE(pid > 0);
+               __unreachable();
        default:
                ATF_REQUIRE(kill(pid, SIGSTOP) == 0);
                ATF_REQUIRE(wait6(P_PID, pid, &st, WSTOPPED, &wru, &si) == pid);
@@ -252,6 +256,7 @@
                /*FALLTHROUGH*/
        case -1:
                ATF_REQUIRE(pid > 0);
+               __unreachable();
        }
 
        printf("Before loop of SIGSTOP/SIGCONT sequence %zu times\n", N);



Home | Main Index | Thread Index | Old Index