Closed Bug 984466 Opened 6 years ago Closed 6 years ago

change CallQueryInterface to assert in cases of trivial conversions

Categories

(Core :: XPCOM, defect)

defect
Not set

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+
Yes, this did have Benjamin's blessing. :)

https://hg.mozilla.org/integration/mozilla-inbound/rev/e17405b3cc01
Flags: in-testsuite-
Assignee: nobody → nfroyd
https://hg.mozilla.org/mozilla-central/rev/e17405b3cc01
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
You need to log in before you can comment on or make changes to this bug.