drepper(a)redhat.com (Ulrich Drepper) writes:
> I'd argue that any upstream package which includes -Werror by
default
> is broken, considering how often gcc warnings change.
And I argue that we apparently must come to a state where -Werror is
enabled automatically.
I would really like to use it, but existing APIs (SUSv3) do not support
warning free development. E.g. 'dlsym()' returns an object pointer, but
often a function pointer is wanted. I do not know a way to write
| #include <dlfcn.h>
|
| int main()
| {
| void (*foo)() = dlsym(0, "foo");
| void (*bar)() = (void (*)())dlsym(0, "bar");
|
| foo();
| bar();
| }
warning-free:
| $ gcc -ldl -Wall -pedantic -W -Werror -std=c99 dlsym.c
| cc1: warnings being treated as errors
| dlsym.c: In function 'main':
| dlsym.c:5: warning: ISO C forbids initialization between function pointer and 'void
*'
| dlsym.c:6: warning: ISO C forbids conversion of object pointer to function pointer type
Or, I maintain a library which provides some deprecated functions and
gives out warnings at link-time when they are used. The same project has
some legacy tools (used by some people) which are triggering exactly
these warnings. Enforcing '-Werror' would make it either impossible to
mark obsolete functions (bad for developers), or to build legacy tools
(bad for some users).
Enrico