virtualsquare / virtualsquare/vde-2
Comparison of unsigned expression < 0 is always false
Open
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 255
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
Description
When compiling the latest master, clang points out that some of your comparisons are tautological:
vxlan.c:108:10: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (len < 0)
~~~ ^ ~
vde_autolink.c:865:41: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if( (curlink->portno = port_reserve()) < 0 ){
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
wirefilter.c:214:12: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (next < 0) next=0;
~~~~ ^ ~
wirefilter.c:1638:35: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
(markovdelay < delay || delay < 0)) delay=markovdelay;
~~~~~ ^ ~
wirefilter.c:1649:38: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (speeddelay < delay || delay < 0) delay=speeddelay;
~~~~~ ^ ~
wirefilter.c:1664:39: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (speeddelay < delay || delay < 0) delay=speeddelay;
~~~~~ ^ ~
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the warning sites in vxlan.c:108, vde_autolink.c:865, and wirefilter.c:214, 1638, 1649, and 1664, then inspect the declared types and surrounding logic. Compile with clang to reproduce the warnings; done means the listed tautological-comparison warnings are resolved without changing intended behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100