Closed Bug 984466 Opened 11 years ago Closed 11 years ago

change CallQueryInterface to assert in cases of trivial conversions

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla31

People

(Reporter: froydnj, Assigned: froydnj)

Details

Attachments

(1 file)

We decided this would be a better thing to do that bug 983719.
Lots of small fixups; they all seem to be fallout from the s/nsILocalFile/nsIFile/ conversion. Detecting conversions to superclasses would be easy, I think, but we'll leave that as a followup.
Attachment #8392305 - Flags: review?(ehsan)
Comment on attachment 8392305 [details] [diff] [review] change CallQueryInterface to assert in cases of trivial conversions Review of attachment 8392305 [details] [diff] [review]: ----------------------------------------------------------------- ::: xpcom/glue/nsISupportsUtils.h @@ +132,5 @@ > + // We permit nsISupports-to-nsISupports here so that one can still obtain > + // the canonical nsISupports pointer with CallQueryInterface. > + static_assert(!mozilla::IsSame<T, DestinationType>::value || > + mozilla::IsSame<DestinationType, nsISupports>::value, > + "don't use CallQueryInterface for compile-time-determinable casts"); I assume you have bsmedberg's blessing on this, but this looks sane.
Attachment #8392305 - Flags: review?(ehsan) → review+
Flags: in-testsuite-
Assignee: nobody → nfroyd
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: