Missing warning about uninitialized variable.

J.C. Pizarro jcpiza@gmail.com
Thu Nov 29 22:03:00 GMT 2007


On 2007/11/29, John Love-Jensen <eljay@adobe.com> wrote:
> Hi J.C.,
>
> In your ishootyou.c, if your objective is to have the compiler display the
> warning, ala...
>
> gcc -O -Wuninitialized -lm -Wall ishootyou.c -o ishootyou
>
> ishootyou.c:12: warning: 'uninitialized_var_gurka' may be used uninitialized
> in this function
>
> ...how come you are not enabling the warning, as I've done above?
>
> Or even more so, as indicated by the comment in the code, treating it as an
> error?
>
> gcc -Werror -O -Wuninitialized -lm -Wall ishootyou.c -o ishootyou
>
> On my version of GCC, I realize that -Wall enables -Wuninitialized ... but
> ONLY if optimizations are enabled.  Which has already been mentioned by
> someone else in this discussion thread.
>
> Sincerely,
> --Eljay

Put -Werror -Wuninitialized -Wall to one large project that has many warnings,
and it will be tedious to abort the entire project at the first warning!!!

To ignore -Werror is not a solution.

The solution is to implement -Werror-uninitialized. Agree we it?

   J.C.Pizarro



More information about the Gcc-help mailing list