[SAMBA 4] [PATCH] Fix IBM checker warnings

Jelmer Vernooij jelmer at samba.org
Fri Feb 8 15:05:40 GMT 2008


Am Freitag, den 08.02.2008, 08:38 -0600 schrieb Andrew Kroeger:
> Jelmer Vernooij wrote:
> > Am Freitag, den 08.02.2008, 07:05 -0600 schrieb Andrew Kroeger:
> >> Jelmer Vernooij wrote:
> >>> A lot of the changes you've made seem to change:
> >>>
> >>> bool ret = true;
> >>>
> >>> ret &= foo();
> >>>
> >>> to
> >>>
> >>> ret = ret && foo();
> >>>
> >>> (where foo() also returns a boolean)
> >>>
> >>> There is nothing wrong with the first expression, and imho it is a bug
> >>> in the IBM checker that it warns about these sort of expressions.
> >>>
> >>> Any chance you can resubmit without those particular changes? The other
> >>> changes in your patch look ok.
> >> The changes of:
> >> 		ret &= foo();
> >> 	to
> >> 		ret = ret && foo();
> >> were intentional.
> >>
> >> The number of issues reported by the IBM checker were becoming quite
> >> high, and over half of those were related to boolean issues my proposed
> >> patch attempts to correct.
> > I would rather report this issue as a false positive to the IBM checker
> >  authors, as we've already done in the past.
> I would rather quash the issue altogether.
There are alternative ways of dealing with these errors. We can report
it to the IBM checker authors. Afaik they're usually pretty quick when
resolving these issues. IIRC there also is an ignore file of some sort
for the IBM checker that we could add this issue to.

I'm happy to apply patches to make it easier to run certain tools,
especially since checker tools usually warn about code which style is
dubious anyway even if correct. 

However, while those tools can be useful and it is ok to add a
workaround or two to make them happy, I think we shouldn't let them
dictate the way we work too much. If possible, we should rather fix
those tools to behave correctly.

"ret = ret && " is harder to read and write than "&=", and the latter
should be considered correct too.

> The C language specification does not have an "&=" for boolean arguments
>  (s.b.. "&&=").  Without such an extension, I would like to see my
> proposed patch stand.
I don't see why &= shouldn't work on boolean types. "&" does a bitwise
AND. In the case of a boolean type, there is only one bit that matters.

All of the compilers seem to be happy with us using "&=".

> I'm not pointing fingers, but it seems to me that a lot of Samba 4
> development happens without watching what the buildfarm system
> actually
> does - until it's too late.  
What do you mean exactly with "until it's too late" ?

> I'm just trying to
> help keep the focus on the right side of the development effort.
I know, and your contributions are much appreciated :-)

Cheers,

Jelmer

-- 
Jelmer Vernooij <jelmer at samba.org> - http://samba.org/~jelmer/
Jabber: jelmer at jabber.fsfe.org


More information about the samba-technical mailing list