зеркало из https://github.com/mozilla/pjs.git
Bug 518881: Make Send/Call*() methods for IPDL parent actors warn_unused_result. r=bent
This commit is contained in:
Родитель
30361f401e
Коммит
784888920c
|
@ -447,7 +447,7 @@ class FriendClassDecl(Node):
|
|||
|
||||
class MethodDecl(Node):
|
||||
def __init__(self, name, params=[ ], ret=Type('void'),
|
||||
virtual=0, const=0, pure=0, static=0,
|
||||
virtual=0, const=0, pure=0, static=0, warn_unused=0,
|
||||
typeop=None):
|
||||
assert not (virtual and static)
|
||||
assert not pure or virtual # pure => virtual
|
||||
|
@ -467,6 +467,7 @@ class MethodDecl(Node):
|
|||
self.const = const # bool
|
||||
self.pure = pure # bool
|
||||
self.static = static # bool
|
||||
self.warn_unused = warn_unused # bool
|
||||
self.typeop = typeop # Type or None
|
||||
|
||||
def __deepcopy__(self, memo):
|
||||
|
@ -474,7 +475,7 @@ class MethodDecl(Node):
|
|||
self.name,
|
||||
copy.deepcopy(self.params, memo),
|
||||
copy.deepcopy(self.ret, memo),
|
||||
self.virtual, self.const, self.pure, self.static,
|
||||
self.virtual, self.const, self.pure, self.static, self.warn_unused,
|
||||
copy.deepcopy(self.typeop, memo))
|
||||
|
||||
class MethodDefn(Block):
|
||||
|
|
|
@ -216,6 +216,8 @@ class CxxCodeGen(CodePrinter, Visitor):
|
|||
|
||||
if md.const:
|
||||
self.write(' const')
|
||||
if md.warn_unused:
|
||||
self.write(' NS_WARN_UNUSED_RESULT')
|
||||
if md.pure:
|
||||
self.write(' = 0')
|
||||
|
||||
|
|
|
@ -4202,6 +4202,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
|||
md.sendMethod().name,
|
||||
params=md.makeCxxParams(paramsems='in', returnsems='out',
|
||||
side=self.side, implicit=implicit),
|
||||
warn_unused=(self.side == 'parent'),
|
||||
ret=Type.BOOL)
|
||||
if md.decl.type.isCtor():
|
||||
decl.ret = md.actorDecl().bareType(self.side)
|
||||
|
@ -4270,6 +4271,7 @@ class _ClassDeclDefn:
|
|||
md.decl.name = (clsname +'::'+ md.decl.name)
|
||||
md.decl.virtual = 0
|
||||
md.decl.static = 0
|
||||
md.decl.warn_unused = 0
|
||||
for param in md.decl.params:
|
||||
if isinstance(param, Param):
|
||||
param.default = None
|
||||
|
|
|
@ -132,6 +132,7 @@ EXPORTS_mozilla = \
|
|||
Monitor.h \
|
||||
Mutex.h \
|
||||
SSE.h \
|
||||
unused.h \
|
||||
$(NULL)
|
||||
|
||||
SDK_LIBRARY = \
|
||||
|
|
|
@ -79,6 +79,7 @@ XPCOM_GLUENS_SRC_LCPPSRCS = \
|
|||
BlockingResourceBase.cpp \
|
||||
DeadlockDetector.cpp \
|
||||
SSE.cpp \
|
||||
unused.cpp \
|
||||
nsAutoLock.cpp \
|
||||
nsGenericFactory.cpp \
|
||||
nsProxyRelease.cpp \
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* vim: sw=2 ts=8 et :
|
||||
*/
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at:
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Chris Jones <jones.chris.g@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "mozilla/unused.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
const unused_t unused = unused_t();
|
||||
|
||||
} // namespace mozilla
|
|
@ -0,0 +1,61 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* vim: sw=2 ts=8 et :
|
||||
*/
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at:
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Chris Jones <jones.chris.g@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef mozilla_unused_h
|
||||
#define mozilla_unused_h
|
||||
|
||||
#include "nscore.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
//
|
||||
// Suppress GCC warnings about unused return values with
|
||||
// unused << SomeFuncDeclaredWarnUnusedReturnValue();
|
||||
//
|
||||
struct NS_COM_GLUE unused_t { };
|
||||
|
||||
extern const unused_t unused NS_COM_GLUE;
|
||||
|
||||
template<typename T>
|
||||
inline void operator<<(const unused_t& /*unused*/, const T& /*unused*/) { }
|
||||
|
||||
}
|
||||
|
||||
#endif // mozilla_unused_h
|
Загрузка…
Ссылка в новой задаче