Closed Bug 500868 Opened 15 years ago Closed 6 years ago

Warn about unnecessarily virtual methods

Categories

(Developer Infrastructure :: Source Code Analysis, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: jruderman, Unassigned)

References

Details

(Keywords: perf)

Might be useful to have an analysis capable of warning:

"No subclasses implement this virtual method. Does it really need to be virtual?"

I believe this would require doing analysis across compilation units, which is tricky.
Actually we have a lot of those methods. These are needed to call things across shared libaries
Hmm, could we have a special annotation for virtual methods that are meant to cross library boundaries?  Also, if no implementations are found and the base class is abstract, there's no need to warn.
Keywords: perf
(In reply to comment #2)
> Hmm, could we have a special annotation for virtual methods that are meant to
> cross library boundaries?  Also, if no implementations are found and the base
> class is abstract, there's no need to warn.

I've run into this during dead code analysis, you run into all kinds of APIs exported by mozilla that aren't used much inside.

We could mark all idl-derived stuff easily and automagically. But i'm still not sure if it's worth the hassle for the rest.
Product: Core → Firefox Build System
We are not realistically going to have these kinds of analyses across compilation units anytime soon.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INCOMPLETE
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.