[patch] silence uninitialised variable warnings

Manuel López-Ibáñez lopezibanez@gmail.com
Tue Sep 11 16:31:00 GMT 2007


On 11/09/2007, Brian Sidebotham <micros@valvers.com> wrote:
>
>
> Paweł Sikora wrote:
> > Manuel López-Ibáñez pisze:
> >> On 11/09/2007, Brian Sidebotham <micros@valvers.com> wrote:
> >>> Hi Guys,
> >>>
> >>> Attached is a patch to silence a lot of "var might be used
> >>> uninitialised.."
> >>> warnings - Generally caused by a pointer to the var being passed to a
> >>> function
> >>> that then modifies the contents of the var.
> >>>
> >>
> >> Do you get those warnings with a recent GCC version ?
> >
> > 4.2.2-20070825 produces these warnings.
> > 4.3.0-20070825 works fine and Brian's patch isn't needed
> > (at least for PR32395).
>
> I am using gcc-4.0.3 (the current ubuntu gcc install version). However, are we
> saying that to get a warning-free build you must use an experimental version of
> gcc? The patch silences a good version of gcc whilst building gcc.
>
> There are also a lot of "cast discards qualifiers from pointer target type"
> warnings too, which are next on my list. I am mainly wanting to get the number
> of warnings down for building arm-none-elf and arm-none-eabi.
>
> I appreciate you don't need to support building current svn with gcc-2.95 or
> similar, but if the latest release version of gcc issues these warnings, then I
> think it is reasonable to silence them.
>

And I think it is not reasonable because the warnings were wrong
(unless they stop you from building GCC and I think they don't). Old
versions have bugs that new versions may fix. That is life. GCC is
itself a testsuite, so if we start giving incorrect warnings again,
then they will be detected while bootstrapping. If you implement
workarounds that are not strictly needed, then future regressions
won't be detected.

That is just my opinion. The maintainers of those files may think
differently and approve your patch, though.

Cheers,

Manuel.


More information about the Gcc-patches mailing list