Skip to contentSkip to conversation

sched_ext: Make string params of __ENUM_set() const

PATCH Applied Kuba Piecuch 2 participants 2 messages Apr 13 Scheduler - sched_ext

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched_ext: Make string params of __ENUM_set() const

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++.

---

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(-)
tools/sched_ext/include/scx/enums.h +1 -1
index 8e7c91575f0b3..c3b09acce824a 100644
@@ -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;
 
Signature · 1 line
2.53.0.1213.gd9a14994de-goog
reviewer Applied
#1 lore raw

Hello,

Quoted 1 line

Kuba Piecuch (1): sched_ext: Make string params of __ENUM_set() const

Applied to sched_ext/for-7.1.

Thanks.
--
tejun