Advice Wanted on sonic.c Indentation Warning

Joel Sherrill joel at rtems.org
Sat Mar 19 20:59:29 UTC 2016


Hi

GCC 6.0 previews give the indentation warning below

../../../../../rtems/c/src/libchip/network/sonic.c:837:11: warning:
statement is indented as if it were guarded by... [-Wmisleading-indentation]

on this code from sonic.c.

      for (i = 0 ; i < 2 ; i++) {
        if ((*sc->read_register)( rp, SONIC_REG_RRP ) ==
            (*sc->read_register)( rp, SONIC_REG_RSA ))
          (*sc->write_register)(
            rp,
            SONIC_REG_RRP,
            (*sc->read_register)( rp, SONIC_REG_REA )
          );
          (*sc->write_register)(
             rp,
             SONIC_REG_RRP,
             (*sc->read_register)(rp, SONIC_REG_RRP) -
sizeof(ReceiveResource_t)
          );
      }

>From the comments, this code was written for RTEMS. Assuming it
works (and it did on both a DMV177 and erc32 Tharsys board), then
I am prone to add braces to the if and move the second write register
to the left.

That at least makes the code match what the compiler thinks was written.

Any thoughts?

--joel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20160319/b0522186/attachment.html>


More information about the devel mailing list