Bug 86081 - -Wtautological-compare diagnostics
Summary: -Wtautological-compare diagnostics
Status: NEEDINFO
Alias: None
Product: p11-glue
Classification: Unclassified
Component: p11-kit (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Stef Walter
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-09 22:24 UTC by Daniel Macks
Modified: 2014-11-14 08:02 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
p11-kit, trust: Fix issues with comparing unsigned integers (1.61 KB, patch)
2014-11-14 08:02 UTC, Stef Walter
Details | Splinter Review

Description Daniel Macks 2014-11-09 22:24:48 UTC
Building 0.22.1 on OS X 10.8, I get warnings:

p11-kit/rpc-message.c:174:14: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
        if (call_id < 0 || call_id >= P11_RPC_CALL_MAX) {
            ~~~~~~~ ^ ~

trust/index.c:902:12: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
        if (count < (CK_ULONG)0UL)
            ~~~~~ ^ ~~~~~~~~~~~~~

In each case, the variable is an unsigned type, so by definition it is >= 0. Not sure what the intent of these code sections are, whether the variable should be signed or if the test should be scrapped, or whatever else
Comment 1 Stef Walter 2014-11-14 08:02:35 UTC
Created attachment 109449 [details] [review]
p11-kit, trust: Fix issues with comparing unsigned integers

These were caught by Clang on OS X 10.8
Comment 2 Stef Walter 2014-11-14 08:02:49 UTC
Does this patch fix the issue?


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.