4 ms·
The _DEFAULT_SOURCE change is annoying. Well maintained C codebases that use -Werror combined with _BSD_SOURCE are now broken until they add the additional _DE
by nteon 12y ago
The _DEFAULT_SOURCE change is annoying. Well maintained C codebases that use -Werror combined with _BSD_SOURCE are now broken until they add the additional _DEFAULT_SOURCE define to their build, like Go: https://code.google.com/p/go/source/detail?r=c8059ac4e0ec https://code.google.com/p/go/source/detail?r=c8059ac4e0ec
- stefantalpalaru 12y agoAnd that's why you should never use -Werror by default, regardless of how well maintained your code is.
- JoshTriplett 12y agoYes, you absolutely should. If you need to disable errors for specific warnings, use (for instance) -Werror=no-deprecated-declarations ; however, projects that build without Werror in general tend to fail to actually fix warnings, resulting in an overwhelming pile of them. If you don't feel comfortable turning all warnings into errors, then use -Werror=some-warning and -Werror=some-other-warning to turn specific warnings into errors, to make sure those particular warnings never get into the project.
- cygx 12y agoIf you do use -Werror, provide an easy way for users to disable it via configure flag, environment or make variable. I'm using clang's -Werror -Weverything, which is obviously rather brittle. Building without -Werror is done via make NOWARN=error
- mjg59 12y agoShipping release code with -Werror is an invitation for future breakage when the compiler introduces a new warning. It makes absolute sense in the development tree.
- __david__ 12y agoThat's a fine attitude to have for your development team, but if your source releases to the general public use -Werror then you're doing it wrong. You're practically guaranteeing that the code you ship won't build on your end user's systems unless they happen to have whatever particular flavor of compiler that you tested with. And in 6 months there will be due to new compiler warnings or new libraries and your stable release will break unnecessarily. -Werror is much too fragile for production releases, stop foisting it on unsuspecting users.
- pcwalton 12y agoAs far as I know, the reason why GCC and clang had to add random things like -Wextra and -Weverything is because of -Wall -Werror. Now instead of "all" meaning "all", due to backwards compatibility you have to write various other incantations to mean "really all".