From: Nadav Har'El <n...@scylladb.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

core: avoid warning in reboot() implementation

For some unknown reason, the reboot() function defined by glibc and musl
takes an "int", but the actual RB_* constants used as parameters do not
all fit in a signed int and require unsigned it.

Gcc 12.1.1 started complaining about our reboot() implementation's
using a switch() on an int and giving what seem like unsigned constants,
so in this patch we add an explicit cast to silence this complaint.

Signed-off-by: Nadav Har'El <n...@scylladb.com>

---
diff --git a/core/power.cc b/core/power.cc
--- a/core/power.cc
+++ b/core/power.cc
@@ -24,7 +24,7 @@
 OSV_LIBC_API
 int reboot(int cmd)
 {
-    switch (cmd) {
+    switch ((unsigned)cmd) {
     case RB_POWER_OFF:
         printf("Power down\n");
         osv::poweroff();

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/00000000000000aa7d05e24c5005%40google.com.

Reply via email to