|
Bugzilla – Full Text Bug Listing |
| Summary: | [LLVM] error: comparison of unsigned expression < 0 is always false | ||
|---|---|---|---|
| Product: | ns-3 | Reporter: | Gustavo J. A. M. Carneiro <gjcarneiro> |
| Component: | dsdv | Assignee: | Hemanth Narra <hemanthnarra222> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | ns-bugs, tommaso.pecorella |
| Priority: | P5 | ||
| Version: | ns-3-dev | ||
| Hardware: | All | ||
| OS: | All | ||
| Bug Depends on: | |||
| Bug Blocks: | 1345 | ||
| Attachments: |
Removes the if that is never executed
patch to fix bug 1369 in dsdv-routing-protocol.cc |
||
Created attachment 1355 [details]
Removes the if that is never executed
Patch to solve the "comparison of unsigned expression < 0 is always false" error message of clang. The path removes the if, this solution should be evaluate by the maintainer of the module to be sure it is correct.
I disagree with the patch.
The correct fix is:
if (allRoutes.size () == 0)
{
return;
}
or, better
if (allRoutes.empty())
{
return;
}
On the other hand, later the map is traversed with an iterator. Thus removing the if() is not introducing a bug, it's just removing an optimization (it wasn't working anyway right now).
T.
Created attachment 1361 [details] patch to fix bug 1369 in dsdv-routing-protocol.cc Yes, I agree. we need this if statement. Here is the patch that fixes this bug. Marking this bug as fixed. Daniel, can you please upload this patch to the repository? Pushed to changeset 7767 - 657d0877064e |
With clang++ 2.9: [ 856/1334] cxx: src/dsdv/model/dsdv-routing-protocol.cc -> build/src/dsdv/model/dsdv-routing-protocol.cc.1.o ../src/dsdv/model/dsdv-routing-protocol.cc:843:25: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare] if (allRoutes.size () < 0) ~~~~~~~~~~~~~~~~~ ^ ~ 1 error generated.