Compilation error
axelgenus opened this issue · 3 comments
axelgenus commented
Module build fails on my Gentoo box:
make[1]: Entering directory '/usr/src/linux-5.15.26-gentoo'
CC [M] /home/alessandro/Projects/zenpower3/zenpower.o
/home/alessandro/Projects/zenpower3/zenpower.c: In function ‘zenpower_read’:
/home/alessandro/Projects/zenpower3/zenpower.c:315:33: error: this statement may fall through [-Werror=implicit-fallthrough=]
315 | channel -= 1; // hwmon_in have different indexing, see note at zenpower_info
| ~~~~~~~~^~~~
/home/alessandro/Projects/zenpower3/zenpower.c:318:17: note: here
318 | case hwmon_curr:
| ^~~~
cc1: all warnings being treated as errors
make[2]: *** [scripts/Makefile.build:277: /home/alessandro/Projects/zenpower3/zenpower.o] Error 1
make[1]: *** [Makefile:1868: /home/alessandro/Projects/zenpower3] Error 2
make[1]: Leaving directory '/usr/src/linux-5.15.26-gentoo'
make: *** [Makefile:27: modules] Error 2
Ta180m commented
That compilation error is because your compiler is treating warnings as errors, probably from having -Werror
set somewhere.
axelgenus commented
It seems that gentoo-sources set -Wimplicit-fallthrough=5
in /lib/modules/$(KVERSION)/build/Makefile so the comment is actually disregarded.
Another fork [1] has this patched. I'll try to rebase and make a PR.
axelgenus commented
I guess I fixed by just adding this to the Makefile:
KBUILD_CFLAGS += -Wimplicit-fallthrough=3