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
Unknown Object (File)
Sun, Sep 29, 4:44 PM
Unknown Object (File)
Tue, Sep 10, 1:19 PM
Unknown Object (File)
Thu, Sep 5, 5:59 PM
Unknown Object (File)
Mon, Sep 2, 8:37 PM
Unknown Object (File)
Aug 30 2024, 5:49 AM
Unknown Object (File)
Aug 27 2024, 3:27 AM
Unknown Object (File)
Aug 5 2024, 6:39 AM
Unknown Object (File)
Jul 29 2024, 12:57 PM
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
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 46456
Build 43345: arc lint + arc unit

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.