selftests: Mark ksft_exit_fail_perror() as __noreturn
authorMuhammad Usama Anjum <usama.anjum@collabora.com>
Sun, 14 Apr 2024 06:26:53 +0000 (11:26 +0500)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 6 May 2024 19:57:20 +0000 (13:57 -0600)
Let the compilers (clang) know that this function would just call
exit() and would never return. It is needed to avoid false positive
static analysis errors. All similar functions calling exit()
unconditionally have been marked as __noreturn.

Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/kselftest.h

index 0a983b27771e1722cdbdf34cff56b7e9c846f3a4..3d2256885cffbb5114ea494c2004017891eda471 100644 (file)
@@ -377,7 +377,7 @@ static inline __noreturn __printf(1, 2) int ksft_exit_fail_msg(const char *msg,
        exit(KSFT_FAIL);
 }
 
-static inline void ksft_exit_fail_perror(const char *msg)
+static inline __noreturn void ksft_exit_fail_perror(const char *msg)
 {
 #ifndef NOLIBC
        ksft_exit_fail_msg("%s: %s (%d)\n", msg, strerror(errno), errno);