Page MenuHomeFreeBSD

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

Authored by araujo on May 31 2015, 2:02 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 22 2023, 11:07 PM
Unknown Object (File)
May 23 2023, 4:06 AM
Unknown Object (File)
May 23 2023, 3:06 AM
Unknown Object (File)
Apr 30 2023, 8:00 AM
Unknown Object (File)
Mar 4 2023, 9:06 PM
Unknown Object (File)
Feb 14 2023, 1:32 AM
Unknown Object (File)
Apr 28 2017, 12:44 AM
Unknown Object (File)
Apr 3 2017, 11:07 AM
Subscribers

Details

Summary
Test Plan

Build using: make tinderbox

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage

Event Timeline

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

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.

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

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++.

Not interested on it anymore...