[PATCH sched_ext/for-7.1] sched_ext: Make string params of __ENUM_set() const
From: Kuba Piecuch
Date: Mon Apr 13 2026 - 08:49:27 EST
A small change to improve type safety/const correctness.
__COMPAT_read_enum() already has const string parameters.
It fixes a warning when using the header in C++ code:
error: ISO C++11 does not allow conversion from string literal
to 'char *' [-Werror,-Wwritable-strings]
That's because string literals have type char[N] in C and
const char[N] in C++.
Signed-off-by: Kuba Piecuch <jpiecuch@xxxxxxxxxx>
---
Not sure whether upstream cares about C++, but figured I'd send it in
anyway. Also not sure if it merits CC'ing stable (probably not?)
Would appreciate your input!
tools/sched_ext/include/scx/enums.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/sched_ext/include/scx/enums.h b/tools/sched_ext/include/scx/enums.h
index 8e7c91575f0b3..c3b09acce824a 100644
--- a/tools/sched_ext/include/scx/enums.h
+++ b/tools/sched_ext/include/scx/enums.h
@@ -9,7 +9,7 @@
#ifndef __SCX_ENUMS_H
#define __SCX_ENUMS_H
-static inline void __ENUM_set(u64 *val, char *type, char *name)
+static inline void __ENUM_set(u64 *val, const char *type, const char *name)
{
bool res;
--
2.53.0.1213.gd9a14994de-goog