[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20241125105240.44219-1-cgoettsche@seltendoof.de>
Date: Mon, 25 Nov 2024 11:52:39 +0100
From: Christian Göttsche <cgoettsche@...tendoof.de>
To:
Cc: Christian Göttsche <cgzones@...glemail.com>,
Brendan Higgins <brendan.higgins@...ux.dev>,
David Gow <davidgow@...gle.com>,
Rae Moar <rmoar@...gle.com>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>,
linux-kselftest@...r.kernel.org,
kunit-dev@...glegroups.com,
linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev
Subject: [PATCH] kunit: constify return of string literals
From: Christian Göttsche <cgzones@...glemail.com>
The function kunit_status_to_ok_not_ok() returns string literals, thus
declare the return value as such.
Reported by clang:
./include/kunit/test.h:143:10: warning: returning 'const char[3]' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
143 | return "ok";
| ^~~~
./include/kunit/test.h:145:10: warning: returning 'const char[7]' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
145 | return "not ok";
| ^~~~~~~~
./include/kunit/test.h:147:9: warning: returning 'const char[8]' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
147 | return "invalid";
| ^~~~~~~~~
Signed-off-by: Christian Göttsche <cgzones@...glemail.com>
---
include/kunit/test.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/kunit/test.h b/include/kunit/test.h
index 34b71e42fb10..ae1b57578476 100644
--- a/include/kunit/test.h
+++ b/include/kunit/test.h
@@ -135,7 +135,7 @@ struct kunit_case {
struct string_stream *log;
};
-static inline char *kunit_status_to_ok_not_ok(enum kunit_status status)
+static inline const char *kunit_status_to_ok_not_ok(enum kunit_status status)
{
switch (status) {
case KUNIT_SKIPPED:
--
2.45.2
Powered by blists - more mailing lists