On Donnerstag, 18. Dezember 2008, Bernhard Walle wrote:
* Werner Hoch [2008-12-18 08:25]:
Bernhard Walle suggest to make that errors ignorable.
That was a different story. In you case the code is just wrong. Nobody can guarantee that you call the function with !(i == 1 || i == 2).
Sorry for my poor example, here's a better one where I can guarantee that it's ok. ---------------- #include <stdio.h> int testfunc(unsigned int i) { switch (i%2) { case 0: return 2; case 1: return 5; } } int main(void) { printf("%d, %d\n", 5, testfunc(5)); printf("%d, %d\n", 4, testfunc(4)); return 0; } ---------------- compiler output: -------- werner@linux-m82i:~/puffer> gcc -Wall main.c main.c: In function ‘testfunc’: main.c:11: warning: control reaches end of non-void function werner@linux-m82i:~/puffer> ./a.out 5, 5 4, 2 werner@linux-m82i:~/puffer> ------- I know that a default statement could fix the compiler warning. ---------- switch (i%2) { case 0: return 2; case 1: return 5; default: /* never reached */ return 5; } ---------- I'd just prefer to disable the check in such cases without patching all the code. Regards Werner -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org