Page MenuHomeFreeBSD

Silence several set but not used variables, spotted by CLANG.
AbandonedPublic

Authored by araujo on May 31 2015, 2:02 PM.

Details

Summary
Test Plan

Build using: make tinderbox

Diff Detail

Repository
rS FreeBSD src repository
Lint
Lint OK
Unit
No Unit Test Coverage

Event Timeline

araujo retitled this revision from to Silence several set but not used variables, spotted by CLANG..May 31 2015, 2:02 PM
araujo updated this object.
araujo edited the test plan for this revision. (Show Details)
araujo updated this revision to Diff 5833.
araujo updated this object.May 31 2015, 2:04 PM
araujo edited the test plan for this revision. (Show Details)
araujo added reviewers: rodrigc, emaste, bapt.
bapt added a reviewer: kib.May 31 2015, 2:06 PM
kib edited edge metadata.EditedMay 31 2015, 3:29 PM
kib requested changes to this revision.

The goal of the work to remove warnings is to improve the code, not to shut up the compiler. For 'unused local variables' warnings, this means that each case must be analyzed and either unused variable is useless and must be removed, or there is a coding error which resulted in the needed calculation being ignored.

The patch silences the warnings and hides either cosmetic or serious errors. As such, it is wrong. Better leave the warning around for somebody else to do real investigation.

P.S. Probably, the only non-hackish use of the unused attribute is to mark the unused arguments of an implementation of the externally-specified interface. One of the best examples are argc/argv main()' arguments in the hosted program which does not take any cmd line args. Local vars must almost never be unused.

This revision now requires changes to proceed.May 31 2015, 3:29 PM

Got the point! I'm gonna keep this review request until I can verify case by case and submit in different review requests to finish these changes specified here.

Thanks.

rodrigc edited edge metadata.Dec 18 2015, 8:07 PM
rodrigc requested changes to this revision.

I agree with @kib. I don't like this patch in its current form.

emaste added inline comments.Dec 18 2015, 8:23 PM
lib/libc/stdio/vfwscanf.c
269

This one for example looks like it came from a similar structure as convert_wccl above and should be deleted; perhaps convert_wccl should also drop wcp0 and use n++.

araujo abandoned this revision.Jan 18 2016, 6:37 AM

Not interested on it anymore...