cddl/sbin/zpool build warning fixes
Diff Detail
Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
Comment Actions
Changelog:
Pre-fix warnings are at: https://gist.github.com/aprieger-llnw/cf6d6401aa8e52d3e6fabc094b997bcb
- cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
- warning: field width should have type 'int', but argument has type 'size_t' (aka 'unsigned long') [-Wformat]
- fix: added the explicit modifier (int) to the parameter on lines 2847, 2849, 2917, 2919, 2961
- warning: format specifies type 'unsigned long long' but the argument has type 'uint64_t' (aka 'unsigned long') [-Wformat]
- fix: changed the print format modifier from "%llu" to "%"PRIu64 on lines 2949, 4605, 4609, 4879, 4886, 5083, 5206
- warning: format specifies type 'long long' but the argument has type 'uint64_t' (aka 'unsigned long') [-Wformat]
- fix: changed the print format modifier from "%lld" to "%"PRIu64 on lines 5194, 5200
- warning: field width should have type 'int', but argument has type 'size_t' (aka 'unsigned long') [-Wformat]
- cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
- warning: taking the absolute value of unsigned type 'unsigned long' has no effect [-Wabsolute-value]
- fix: explicitly casted the two sides of the subtraction expression to (long) from (unsigned longs) because unsigned longs cannot become negative and will instead loop to the higher bound of the number limits
- warning: taking the absolute value of unsigned type 'unsigned long' has no effect [-Wabsolute-value]
Comment Actions
Made a mistake in casting the unsigned longs to integers, needed to be cast to longs to accomodate for the size differences
| cddl/contrib/opensolaris/cmd/zpool/zpool_main.c | ||
|---|---|---|
| 5192 | This is changing the output from signed to unsigned. The value does appear to be unsigned, but we want to make sure we don't change this if it should be signed | |
| cddl/contrib/opensolaris/cmd/zpool/zpool_main.c | ||
|---|---|---|
| 5192 | fnvlist_lookup_uint64() seems to return uint64_t ... so isn't this change "more correct"? sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_fnvpair.c uint64_t
fnvlist_lookup_uint64(nvlist_t *nvl, const char *name)
{
uint64_t rv;
VERIFY0(nvlist_lookup_uint64(nvl, name, &rv));
return (rv);
} | |