Software Quality Binutils

Joel Sherrill joel@rtems.org
Fri Aug 17 18:25:00 GMT 2018


On Tue, Aug 14, 2018 at 8:22 AM, Paul Koning <paulkoning@comcast.net> wrote:

>
>
> > On Aug 14, 2018, at 7:12 AM, John Darrington <
> john@darrington.wattle.id.au> wrote:
> >
> > ...
> > I think it's flagging things like:
> >
> > if (cond)
> > {
> >  do_this ();
> >  do_that ();
> > }
> > else
> > {
> >  do_this ();
> > }
> >
> > ... which it wants changed to:
> >
> > do_this ();
> > if (cond)
> > do_that ();
> >
> >
> > which of-course has the same effect iff evaluating cond does not
> > have side effects.
>
> Not so; if do_this() may change cond, then the two are semantically
> different.
>

When looking at static analyzer output for RTEMS, we took places like this
as a suggestion that either this change is a nice idea or we need a comment
to indicate that cond could actually change as a side-effect. We don't
someone
to be tempted if it is dangerous or wrong.

Is this Sonar the same as GrammaTech CodeSonar?

--joel


>
>         paul
>
>



More information about the Binutils mailing list