well... well.. linus is looking out for errors on his branch for a quite sometime and probably notoiced or better irked with simple or medium issues which can be fixed before sending patches.
lets see how this will effect devs and the developnent process of kernel itself.
Announcement
Collapse
No announcement yet.
Linux 5.15 Enabling "-Werror" By Default For All Kernel Builds
Collapse
X
-
It's surprising it hasn't been a case until now. OpenSSL has been doing this for ages.
Leave a comment:
-
Well considering most of Linus' legendary rants have been about code quality this is at the very least tonally consistent with the guy.
I also wouldn't be the least bit surprised if this is primarily aimed at graphics driver devs as they are pretty infamous for their nonchalant attitude towards code quality and even serious warnings thrown up by compilers.
Leave a comment:
-
Originally posted by set135This does not change the bar for code getting in. This is only for robots who otherwise might not flag warnings. Linus has never tolerated warnings and if you ask him to pull code that outputs warnings he will likely not accept it. He also hates useless warnings and patches that do nothing useful except shut them up. So, either the warning is helpful and the code is fixed, or it's useless and shut off.
Linux kernel source tree. Contribute to torvalds/linux development by creating an account on GitHub.
There are few examples in the Linux kernel
#pragma GCC diagnostic ignored "-Wsuggest-attribute=format"
Best practise is really to leave as many compiler error detections on as you can and tag out the areas that those features don't work.
Linus will accept patches that disable invalid warnings from being displayed he will be demanding you have confirmation from the compiler developer before submit the patch or he will have your head.
Leave a comment:
-
Originally posted by NobodyXu View PostLinux kernel doesn’t use standard IO functions provided by C stdio.h, so this option likely do nothing.
Code:extern int my_printf (void *my_object, const char *my_format, ...) __attribute__ ((format (printf, 2, 3)));
Linux kernel source tree. Contribute to torvalds/linux development by creating an account on GitHub.
Linux kernel source tree. Contribute to torvalds/linux development by creating an account on GitHub.
Yes surprise its already declared all over the place around the Linux kernel. So yes -Werror=format-security if you do turn it on with the Linux kernel it really does something.
- Likes 2
Leave a comment:
-
Originally posted by coder View PostDepends on what you mean by "all warnings". Some developers tend to be fairly aggressive, in terms of which they enable.
Originally posted by coder View PostUnfortunately, the more advanced warnings tend to be less reliable, which becomes problematic when someone decides to enact a -Werror policy.
I've seen significant amounts of time wasted, and bugs actually getting introduced, in the course of fixing false-positive warnings (i.e. those which didn't indicate any real problem). In many instances, the resulting code is worse, in terms of being less readable or maintainable. I would argue that most of these warnings shouldn't even have been enabled.
- Likes 1
Leave a comment:
-
Create a combination matrix of supported architectures/compilers.
It grows really fast. Werror prevented me from doing stupid things like assuming int size, or relying on arch specific overflow behaviour (BE/LE differences).
Imagine writing a new driver, testing it on amd64, works fine. Then somebody tries running it on a Big endian MIPS machine. What happens can be very, very surprising... these compiler warnings/errors help catch *a lot* of the low hanging fruit.
- Likes 2
Leave a comment:
-
Originally posted by coder View PostDepends on what you mean by "all warnings". Some developers tend to be fairly aggressive, in terms of which they enable. Unfortunately, the more advanced warnings tend to be less reliable, which becomes problematic when someone decides to enact a -Werror policy.
I've seen significant amounts of time wasted, and bugs actually getting introduced, in the course of fixing false-positive warnings (i.e. those which didn't indicate any real problem). In many instances, the resulting code is worse, in terms of being less readable or maintainable. I would argue that most of these warnings shouldn't even have been enabled.
I've also seen developers take the easy way out. Such as getting rid of unused variables holding return code values, rather than actually checking them and handling errors appropriately. But hey, the warning count was reduced, so the code must be better!
I tried write patch for many projects, where build system prints warning after warning and in the end, I couldn't even quickly see from build log if my code introduced any new warnings...
Yes, you can create wrong fixes, but I believe review process for Linux kernel is good enough to catch these wrong solutions before they go in.
Leave a comment:
-
Originally posted by brad0 View Post
That is very evident.
- Likes 2
Leave a comment:
-
I had a situation recently that surprised me at the time. The architecture I work on has 512 general purpose registers and the ability to address them like RAM. Not too surprisingly, the C compiler doesn't have any recognition of using pointers in this manner. It could auto allocate a variable to a register but all my attempts to define or reassign a pointer to general register space either got warnings or errors.
In the end I used inline assembly to eliminate any confusion.
Leave a comment:
Leave a comment: