Closed Bug 522776 Opened 15 years ago Closed 4 years ago

Static analysis: Point out member shadowing

Categories

(Developer Infrastructure :: Source Code Analysis, enhancement)

x86
Linux
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: taras.mozilla, Unassigned)

References

(Depends on 1 open bug)

Details

Attachments

(2 files, 2 obsolete files)

Attached patch analysis (obsolete) — Splinter Review
Solaris compiler warns if a stack variable shadows a class member. I got burned by this.

Filing this before i forget about it.
Can we get this running on the static analysis box?
If it runs as part of a standard --with-static-checking build we can!
Attached patch wip (obsolete) — Splinter Review
make this an error is a lot of work. It trips up a lot of code. Could should probably be fixed as it doesn't follow naming conventions
Attachment #406754 - Attachment is obsolete: true
Depends on: 525094
Attached patch finished patchSplinter Review
With this patch the build can proceed. I'll probably need someone else for additional reviews on that 2 cases of member shadowing found in gtk and ssl code.
Attachment #408935 - Attachment is obsolete: true
Attachment #410019 - Flags: review?(benjamin)
Comment on attachment 410019 [details] [diff] [review]
finished patch

I can't tell from this: does this error on function parameters which are named the same as members? There should probably be a test for that case, one way or the other.
Attachment #410019 - Flags: review?(benjamin) → review+
(In reply to comment #5)
> (From update of attachment 410019 [details] [diff] [review])
> I can't tell from this: does this error on function parameters which are named
> the same as members? There should probably be a test for that case, one way or
> the other.

no it doesn't. I couldn't decide if saying anything in that case would be useful or counterproductive.
I tend to think it would be useful but I don't care much: I just want a test so the behavior is clear and doesn't change accidentally.
carrying over Benjamin's review
Attachment #410043 - Flags: review+
Comment on attachment 410043 [details] [diff] [review]
added params testcase

Honza, please review the change in security/.
Attachment #410043 - Flags: review?(honzab.moz)
Comment on attachment 410043 [details] [diff] [review]
added params testcase

Taras, please rename the local variable to something else (something like nssComponentLocal, up to you). This code is old and I'm afraid it could introduce problems during shutdown/profile change, let's leave the current behavior. 

This local variable shadowing the (wrongly named!) member was introduced here: https://bugzilla.mozilla.org/attachment.cgi?id=106168&action=diff#mozilla/security/manager/ssl/src/nsUsageArrayHelper.cpp_sec1

I'll file a new bug to clean this up.
Attachment #410043 - Flags: review?(honzab.moz) → review-
(In reply to comment #10)

> I'll file a new bug to clean this up.

Thanks, can you make it block this bug?
Product: Core → Firefox Build System

No longer the case.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WORKSFORME
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: