From eb7be8c637b7b382161d009b302ae9713470c553 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Sat, 4 Nov 2023 01:24:20 +0100 Subject: Issue #2342: Use [[nodiscard]] in IPDL generation and fix warnings DOM plugin code had two warning in IPC caught by [[nodiscard]], these were fixed in one go. --- dom/plugins/ipc/PluginModuleParent.cpp | 5 ++++- dom/plugins/ipc/PluginUtilsWin.cpp | 4 +++- ipc/ipdl/ipdl/cxx/cgen.py | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index 4dff7b0f41..c4461bc901 100755 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -2210,7 +2210,10 @@ PluginModuleParent::NPP_NewInternal(NPMIMEType pluginType, NPP instance, if (supportsAsyncRender) { // Prefs indicates we want async plugin rendering, make sure // the flash module has support. - CallModuleSupportsAsyncRender(&supportsAsyncRender); + if (!CallModuleSupportsAsyncRender(&supportsAsyncRender)) { + // The actual support call failed. Should not happen; abort. + return NS_ERROR_FAILURE; + } } #ifdef _WIN64 // For 64-bit builds force windowless if the flash library doesn't support diff --git a/dom/plugins/ipc/PluginUtilsWin.cpp b/dom/plugins/ipc/PluginUtilsWin.cpp index db6387a511..83b91b6b29 100644 --- a/dom/plugins/ipc/PluginUtilsWin.cpp +++ b/dom/plugins/ipc/PluginUtilsWin.cpp @@ -34,7 +34,9 @@ public: for (auto iter = mAudioNotificationSet->ConstIter(); !iter.Done(); iter.Next()) { PluginModuleParent* pluginModule = iter.Get()->GetKey(); - pluginModule->SendNPP_SetValue_NPNVaudioDeviceChangeDetails(mChangeDetails); + if (!pluginModule->SendNPP_SetValue_NPNVaudioDeviceChangeDetails(mChangeDetails)) { + // Sending of notification failed. Ignore for now. + } } return NS_OK; } diff --git a/ipc/ipdl/ipdl/cxx/cgen.py b/ipc/ipdl/ipdl/cxx/cgen.py index 30f2f2bca6..7dfb194ea6 100644 --- a/ipc/ipdl/ipdl/cxx/cgen.py +++ b/ipc/ipdl/ipdl/cxx/cgen.py @@ -185,7 +185,7 @@ class CxxCodeGen(CodePrinter, Visitor): self.printdent() if md.warn_unused: - self.write('MOZ_MUST_USE ') + self.write('[[nodiscard]] ') if md.inline: self.write('inline ') if md.never_inline: -- cgit v1.2.3