Closed Bug 858320 Opened 12 years ago Closed 10 years ago

Analysis to find unused struct members

Categories

(Developer Infrastructure :: Source Code Analysis, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: jruderman, Unassigned)

References

Details

(Whiteboard: [MemShrink:P3])

A struct member might be useless if:

* It always has the same value (e.g. bug 851025).
* It is never read.
* It is only read immediately after being assigned.

and:

* The member isn't intentional padding for alignment.  (Not sure how these are usually marked -- maybe with a '_' prefix?)
* The struct is not seen being cast to another type.
clang's -Wunused-private-field (which is enabled by -Wall, and thus on in normal Mozilla builds) identifies private struct members that are never read, in at least some cases.  See bug 825105 for some examples.  I don't know exactly which cases it detects, and I couldn't find any documentation on that option.
Whiteboard: [MemShrink] → [MemShrink:P3]
I think -Wunused-private-field is the best we can hope to achieve here.  We hit only a few of that warning right now, mostly in imported code.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WORKSFORME
Product: Core → Firefox Build System
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.