Advice Wanted on sonic.c Indentation Warning

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


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->read_register)( rp, SONIC_REG_REA )
             (*sc->read_register)(rp, SONIC_REG_RRP) -

>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?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the devel mailing list