On Mon, Aug 19, 2019 at 12:13:42PM +0200, BALATON Zoltan wrote:
On Sun, 18 Aug 2019, Programmingkid wrote:
The -Werror option treats warnings as errors. I would not consider a warning to be a genuine error. I always remove -Werror in order for OpenBIOS to compile on my system. So far this works well.
These warnings often mean that there may be a problem or at least the code is not completely obvious just the compiler is not sure if it's really an error or could not exactly identify it and it might work but needs review. That's what warning means so definitely not to be ignored. It's a good idea to write code that compiles without warnings and is correct without any doubt which -Werror ensures.
No, it usually ensures your code does not compile, instead.
(Especially for portable code. Warnings are only acceptable if you need to do something very tricky and you know it will work but it's rarely the case that's needed.) If it compiles and works with warnings you're lucky but that does not mean the code cannot be improved. If you need removing -Werror to compile with your compiler maybe a better way is to report those problems so they can be fixed (maybe they are actual bugs that gcc did not notice so far) rather than removing -Werror and ignoring potential problems.
And shipping with -Werror enabled is a disservice to your users.
Users have a different environment than you tested with -- compiler version, etc.
Segher