Compilation error #8

Closed
opened 2022-03-09 16:56:27 +00:00 by axelgenus · 3 comments
axelgenus commented 2022-03-09 16:56:27 +00:00 (Migrated from github.com)

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
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 2022-03-09 18:09:01 +00:00 (Migrated from github.com)

That compilation error is because your compiler is treating warnings as errors, probably from having -Werror set somewhere.

That compilation error is because your compiler is treating warnings as errors, probably from having `-Werror` set somewhere.
axelgenus commented 2022-03-10 08:02:09 +00:00 (Migrated from github.com)

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.

[1] ae76637db8

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. [1] https://github.com/deleterium/zenpower/commit/ae76637db84c51e66f6300bc77656c0377828479
axelgenus commented 2022-03-10 08:10:52 +00:00 (Migrated from github.com)

I guess I fixed by just adding this to the Makefile:

KBUILD_CFLAGS += -Wimplicit-fallthrough=3
I guess I fixed by just adding this to the Makefile: ```Makefile KBUILD_CFLAGS += -Wimplicit-fallthrough=3 ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: a/zenpower3#8
No description provided.