Skip to contentSkip to conversation

GCC4 sched.c (x86_64) warning: control may reach end

PATCH New Jesse Millan 1 participant 1 message Jul 8, 2005 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 GCC4 sched.c (x86_64) warning: control may reach end

This patch eliminates the GCC4 warning on the x86_64 platform:

kernel/sched.c:1824: warning: control may reach end of non-void function 'sched_find_first_bit' being inlined.

The change follows the lead of others, i.e. it is guaranteed that at least one of b[0], b[1], or b[2] will have a bit set and evaluate to true. That being said, GCC4.0.0 notices that the code flow does not return anything if b[0], b[1] and b[2] are not true. Since we know better, if it's not b[0] or b[1], it has to be b[2].

---

include/asm-x86_64/bitops.h renamed from include/asm-x86_64/bitops.h~bitops +1 -2
diff -puN include/asm-x86_64/bitops.h~bitops include/asm-x86_64/bitops.h
@@ -348,8 +348,7 @@ static inline int sched_find_first_bit(c
 		return __ffs(b[0]);
 	if (b[1])
 		return __ffs(b[1]) + 64;
-	if (b[2])
-		return __ffs(b[2]) + 128;
+	return __ffs(b[2]) + 128;
 }
 
 /**

_

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors