svn commit: r257203 - head/sys/arm/arm

Ian Lepore ian at FreeBSD.org
Sun Oct 27 19:00:05 UTC 2013


On Mon, 2013-10-28 at 04:42 +1100, Bruce Evans wrote:
> On Sun, 27 Oct 2013, Ian Lepore wrote:
> 
> > Log:
> >  Eliminate a compiler warning about extraneous parens.
> 
> Wow, what flags give these warnings?

--- busdma_machdep.o ---
/local/build/staging/freebsd/dp10/src/sys/arm/arm/busdma_machdep.c:811:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
        if ((map->pagesneeded == 0)) {
             ~~~~~~~~~~~~~~~~~^~~~
/local/build/staging/freebsd/dp10/src/sys/arm/arm/busdma_machdep.c:811:24: note: remove extraneous parentheses around the comparison to silence this warning
        if ((map->pagesneeded == 0)) {
            ~                 ^   ~
/local/build/staging/freebsd/dp10/src/sys/arm/arm/busdma_machdep.c:811:24: note: use '=' to turn this equality comparison into an assignment
        if ((map->pagesneeded == 0)) {
                              ^~
                              =

That's what the compiler had to say about it.  I guess in somebody's
mind if it's a probable error to have done 

  if (testandassign = something)

and somehow it's less probably an error to have done

  if ((testandassign = something))

then surely the converse must also be true and double parens not
syntactically necessary in either case must be indicative of error in
one of the cases.

The warning doesn't bother me as much as the two useless notes that
follow it (which are annoying when combined with my editor's feature of
parsing compiler output and jumping to the next error point in the
code).  I've notice clang is particularly chatty, with things like
suggesting what you might have meant when you spell a variable name
wrong.  Before long it's going to be like RPG and COBOL where it's
willing to assume what you meant and try to generate runnable code in
the face of almost any error.

I probably date myself with references to RPG and COBOL, but it does
bring back fond memories of slapping a boilerplate header on every
interoffice memo issued by management and running it through the cobol
compiler, and grading them on whether their memos generated runnable
code or so many errors the compiler gave up.

-- Ian




More information about the svn-src-head mailing list