git: 946d76fb154b - stable/14 - kyua: fix gcc builds

From: Igor Ostapenko <igoro_at_FreeBSD.org>
Date: Thu, 17 Oct 2024 13:49:49 UTC
The branch stable/14 has been updated by igoro:

URL: https://cgit.FreeBSD.org/src/commit/?id=946d76fb154bde23115ec4463d7968ee803769c8

commit 946d76fb154bde23115ec4463d7968ee803769c8
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2024-07-19 23:24:35 +0000
Commit:     Igor Ostapenko <igoro@FreeBSD.org>
CommitDate: 2024-10-17 13:45:15 +0000

    kyua: fix gcc builds
    
    For some reason execenv::exec() isn't successfully marked noreturn
    (rlibby reports that virtual functions can't be noreturn), but calling
    methods are so gcc rightly complains.  Work around this by adding
    explicit __builtin_unreachable() calls.
    
    Reviewed by:    imp, markj
    Fixes:          257e70f1d5ee kyua: Add FreeBSD Jail execution environment support
    Differential Revision:  https://reviews.freebsd.org/D46041
    
    (cherry picked from commit 47fb5d2b13c5ca8e1a3b05ed223d62ea4b43b3e8)
    
    Approved by:    kp (mentor), markj (mentor)
---
 contrib/kyua/engine/atf.cpp   | 2 ++
 contrib/kyua/engine/plain.cpp | 1 +
 contrib/kyua/engine/tap.cpp   | 1 +
 3 files changed, 4 insertions(+)

diff --git a/contrib/kyua/engine/atf.cpp b/contrib/kyua/engine/atf.cpp
index f6746dd2f29f..47f3bd2a1903 100644
--- a/contrib/kyua/engine/atf.cpp
+++ b/contrib/kyua/engine/atf.cpp
@@ -196,6 +196,7 @@ engine::atf_interface::exec_test(const model::test_program& test_program,
     auto e = execenv::get(test_program, test_case_name);
     e->init();
     e->exec(args);
+    __builtin_unreachable();
 }
 
 
@@ -227,6 +228,7 @@ engine::atf_interface::exec_cleanup(
 
     auto e = execenv::get(test_program, test_case_name);
     e->exec(args);
+    __builtin_unreachable();
 }
 
 
diff --git a/contrib/kyua/engine/plain.cpp b/contrib/kyua/engine/plain.cpp
index 9a2c63f8b663..0aba9b3fb6fa 100644
--- a/contrib/kyua/engine/plain.cpp
+++ b/contrib/kyua/engine/plain.cpp
@@ -110,6 +110,7 @@ engine::plain_interface::exec_test(
     auto e = execenv::get(test_program, test_case_name);
     e->init();
     e->exec(args);
+    __builtin_unreachable();
 }
 
 
diff --git a/contrib/kyua/engine/tap.cpp b/contrib/kyua/engine/tap.cpp
index ed35ba40433f..716212d18d02 100644
--- a/contrib/kyua/engine/tap.cpp
+++ b/contrib/kyua/engine/tap.cpp
@@ -157,6 +157,7 @@ engine::tap_interface::exec_test(
     auto e = execenv::get(test_program, test_case_name);
     e->init();
     e->exec(args);
+    __builtin_unreachable();
 }