XPIDL: Improve integration with mozilla::Result in generated C++ code
Categories
(Core :: XPCOM, task)
Tracking
()
People
(Reporter: sg, Unassigned)
References
Details
Bug 1637605 added a generic function template ToResultInvoke which adapts a XPCOM-style function with a nsresult return value and an output parameter at the end of the parameter list. Using this generic function is rather brittle, a slightly nicer use requires a macro. This could be further simplified by either
- generating a generic non-virtual, non-static member function template in every C++ interface that implicitly binds to the instance and calls the existing
ToResultInvoketo adapt tomozilla::Result, or - generating non-virtual, non-static member functions for each function that calls the existing
ToResultInvokewith the corresponding virtual member function to adapt tomozilla::Result, - generating non-virtual, non-static member functions for each function that contains custom code to call the corresponding virtual member function to adapt to
mozilla::Result.
The latter could also support functions with multiple output parameters more easily than extending ToResultInvoke to support this case.
| Reporter | ||
Comment 1•5 years ago
|
||
Note that in the meantime, a pair of macros (MOZ_TO_RESULT_INVOKE and MOZ_TO_RESULT_INVOKE_TYPED) has been added to make the use a bit more concise. Until now, there are ca. 180 uses of these macros (https://searchfox.org/mozilla-central/search?q=MOZ_TO_RESULT_INVOKE&path=). Solving this bug would allow returning to a more standard C++ syntax.
Description
•