Page MenuHomeFreeBSD

Ugly workaround for clang 15 warning in if_alc.c
ClosedPublic

Authored by dim on Jul 16 2022, 3:12 PM.
Tags
None
Referenced Files
F102988980: D35831.diff
Tue, Nov 19, 1:10 PM
F102915853: D35831.id108231.diff
Mon, Nov 18, 5:20 PM
Unknown Object (File)
Sun, Nov 10, 10:23 AM
Unknown Object (File)
Sun, Nov 10, 3:21 AM
Unknown Object (File)
Sat, Nov 9, 9:16 PM
Unknown Object (File)
Sat, Nov 9, 8:56 PM
Unknown Object (File)
Oct 9 2024, 8:59 PM
Unknown Object (File)
Oct 2 2024, 12:34 AM
Subscribers
None

Details

Summary

Clang 15 warns:

sys/dev/alc/if_alc.c:3441:6: error: variable 'prog' set but not used [-Werror,-Wunused-but-set-variable]
        int prog;
            ^

I understand why it warns, since indeed the whole 'prog' variable is
never really *used* for anything, except incrementing it. So why is it
ther at all?

Can somebody who understands this code figure out what is sensible here?
To just start this review, I commented out all uses of 'prog' but that
could hardly be what the original author intended. It seems the while
loop only cares about 'cons' and 'prod', and if that is enough, the
whole 'prog' variable can be ditched?

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dim requested review of this revision.Jul 16 2022, 3:12 PM
dim created this revision.

I suspect the code for txeof was somehow copied from rxintr and then rewritten. The prog variable there is definitely not needed, consider the fact that it is incremented twice in the normal loop flow as an additional evidence.

This revision was not accepted when it landed; it landed in state Needs Review.Jul 20 2022, 5:08 PM
This revision was automatically updated to reflect the committed changes.