whizzscooters / android_kernel_oneplus_sm8250

Other
1 stars 0 forks source link

[Breaking build] Fix a compilation error picked up by Clang 11. #13

Closed hometue closed 3 years ago

hometue commented 3 years ago

Description

I will try to explain why we need to do this pull request. Firstly, why did this only break build in later Clang? I am really not sure. Maybe changes to compiler behavior, although I cannot pinpoint what change it is.

Why is this needed? Well, it shouldn't, but a combination of flags made this a build breaking issue. They enabled -Wstrict-prototypes, which means all functions must declare their arguments explicitly, if it does not take an argument you need to specify by declaring it as foo(void). They then went to set strict prototypes as an error instead of a warning, so compilation will break because of this error.

TLDR: If the kernel source has a function declared without explicity stating its arguments, even if it would be void, it will fail.

FYI, for anyone still reading, the function literally just above it, which is very similar except for small changes gets it right. Oneplus kernel codebase is great isn't it?

Type of change

Checklist

MelvinFMQ commented 3 years ago

Previously, what compiler were you using?

hometue commented 3 years ago

Clang 8 originally, then 9. Made most of the development on 9, then recently shifted to 11. Looked through the release notes but could not find any reason why compile worked previously. By all means it should have still failed, unless Clang 8-9 didn't actually process the flags.

hometue commented 3 years ago

My guess is that the previous Clang versions may have not processed the flags properly. Would make sense, because the release notes I looked through doesn't talk about bug fixes, so perhaps this was not intentional to begin with. Anyway will proceed to merge.