зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1345111 - Make the IPDL compiler error out when it finds sync-messages.ini entries without corresponding IPDL sync messages; r=billm
This ensures that our sync-messages.ini correctly reflects the existing set of sync IPC messages we have.
This commit is contained in:
Родитель
5af1812bae
Коммит
0899f728cc
|
@ -151,6 +151,8 @@ for f in files:
|
|||
log(3, ' pretty printed code:')
|
||||
ipdl.genipdl(ast, codedir)
|
||||
|
||||
ipdl.checkFixedSyncMessages()
|
||||
|
||||
# Second pass: generate code
|
||||
for f in files:
|
||||
# Read from parser cache
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
__all__ = [ 'gencxx', 'genipdl', 'parse', 'typecheck', 'writeifmodified', 'checkSyncMessage' ]
|
||||
__all__ = [ 'gencxx', 'genipdl', 'parse', 'typecheck', 'writeifmodified',
|
||||
'checkSyncMessage', 'checkFixedSyncMessages' ]
|
||||
|
||||
import os, sys
|
||||
from cStringIO import StringIO
|
||||
|
@ -11,7 +12,7 @@ from ipdl.cgen import IPDLCodeGen
|
|||
from ipdl.lower import LowerToCxx, msgenums
|
||||
from ipdl.parser import Parser, ParseError
|
||||
from ipdl.type import TypeCheck
|
||||
from ipdl.checker import checkSyncMessage
|
||||
from ipdl.checker import checkSyncMessage, checkFixedSyncMessages
|
||||
|
||||
from ipdl.cxx.cgen import CxxCodeGen
|
||||
|
||||
|
|
|
@ -8,8 +8,10 @@ from ipdl.ast import Visitor, ASYNC
|
|||
|
||||
class SyncMessageChecker(Visitor):
|
||||
def __init__(self, syncMsgList):
|
||||
self.syncMsgList = syncMsgList
|
||||
self.errors = []
|
||||
SyncMessageChecker.syncMsgList = syncMsgList
|
||||
SyncMessageChecker.seenProtocols = []
|
||||
SyncMessageChecker.seenSyncMessages = []
|
||||
|
||||
def prettyMsgName(self, msg):
|
||||
return "%s::%s" % (self.currentProtocol, msg)
|
||||
|
@ -23,16 +25,24 @@ class SyncMessageChecker(Visitor):
|
|||
(str(loc), msg))
|
||||
|
||||
def visitProtocol(self, p):
|
||||
self.errors = []
|
||||
self.currentProtocol = p.name
|
||||
SyncMessageChecker.seenProtocols.append(p.name)
|
||||
Visitor.visitProtocol(self, p)
|
||||
|
||||
def visitMessageDecl(self, md):
|
||||
pn = self.prettyMsgName(md.name)
|
||||
if md.sendSemantics is not ASYNC and pn not in self.syncMsgList:
|
||||
self.errorUnknownSyncMessage(md.loc, pn)
|
||||
if md.sendSemantics is ASYNC and pn in self.syncMsgList:
|
||||
if md.sendSemantics is not ASYNC:
|
||||
if pn not in SyncMessageChecker.syncMsgList:
|
||||
self.errorUnknownSyncMessage(md.loc, pn)
|
||||
SyncMessageChecker.seenSyncMessages.append(pn)
|
||||
elif pn in SyncMessageChecker.syncMsgList:
|
||||
self.errorAsyncMessageCanRemove(md.loc, pn)
|
||||
|
||||
@staticmethod
|
||||
def getFixedSyncMessages():
|
||||
return set(SyncMessageChecker.syncMsgList) - set(SyncMessageChecker.seenSyncMessages)
|
||||
|
||||
def checkSyncMessage(tu, syncMsgList, errout=sys.stderr):
|
||||
checker = SyncMessageChecker(syncMsgList)
|
||||
tu.accept(checker)
|
||||
|
@ -41,3 +51,12 @@ def checkSyncMessage(tu, syncMsgList, errout=sys.stderr):
|
|||
print >>errout, error
|
||||
return False
|
||||
return True
|
||||
|
||||
def checkFixedSyncMessages(errout=sys.stderr):
|
||||
fixed = SyncMessageChecker.getFixedSyncMessages()
|
||||
for item in fixed:
|
||||
protocol = item.split('::')[0]
|
||||
# Ignore things like sync messages in test protocols we didn't compile.
|
||||
if protocol in SyncMessageChecker.seenProtocols:
|
||||
print >>errout, 'Error: Sync IPC message %s not found, it appears to be fixed.\n' \
|
||||
'Please remove it from sync-messages.ini.' % item
|
||||
|
|
|
@ -471,8 +471,6 @@ description =
|
|||
description =
|
||||
[PDocAccessible::DOMNodeID]
|
||||
description =
|
||||
[PDocAccessible::GetWindowedPluginIAccessible]
|
||||
description =
|
||||
|
||||
# CPOWs
|
||||
[PBrowser::RpcMessage]
|
||||
|
@ -537,8 +535,6 @@ description =
|
|||
description =
|
||||
[PPluginInstance::NPP_GetValue_NPPVpluginWantsAllNetworkStreams]
|
||||
description =
|
||||
[PPluginInstance::NPP_GetValue_NPPVpluginNeedsXEmbed]
|
||||
description =
|
||||
[PPluginInstance::NPP_GetValue_NPPVpluginScriptableNPObject]
|
||||
description =
|
||||
[PPluginInstance::NPP_SetValue_NPNVprivateModeBool]
|
||||
|
@ -619,8 +615,6 @@ description =
|
|||
description =
|
||||
[PPluginInstance::NPN_ConvertPoint]
|
||||
description =
|
||||
[PPluginInstance::NegotiatedCarbon]
|
||||
description =
|
||||
[PPluginInstance::GetCompositionString]
|
||||
description =
|
||||
[PPluginInstance::NPP_NewStream]
|
||||
|
@ -645,8 +639,6 @@ description =
|
|||
description =
|
||||
[PPluginModule::OptionalFunctionsSupported]
|
||||
description =
|
||||
[PPluginModule::PCrashReporter]
|
||||
description =
|
||||
[PPluginModule::ProcessSomeEvents]
|
||||
description =
|
||||
[PPluginModule::NPN_SetException]
|
||||
|
@ -759,8 +751,6 @@ description =
|
|||
description =
|
||||
[PContent::FindPlugins]
|
||||
description =
|
||||
[PContent::PCrashReporter]
|
||||
description =
|
||||
[PContent::NSSU2FTokenIsCompatibleVersion]
|
||||
description =
|
||||
[PContent::NSSU2FTokenIsRegistered]
|
||||
|
@ -801,8 +791,6 @@ description =
|
|||
description =
|
||||
[PContent::AllocateLayerTreeId]
|
||||
description =
|
||||
[PContent::GetGfxInfoFeatureStatus]
|
||||
description =
|
||||
[PContent::BeginDriverCrashGuard]
|
||||
description =
|
||||
[PContent::EndDriverCrashGuard]
|
||||
|
@ -917,12 +905,6 @@ description =
|
|||
description =
|
||||
[PCompositorBridge::PWebRenderBridge]
|
||||
description =
|
||||
[PCompositorWidget::EnterPresentLock]
|
||||
description =
|
||||
[PCompositorWidget::LeavePresentLock]
|
||||
description =
|
||||
[PCompositorWidget::ClearTransparentWindow]
|
||||
description =
|
||||
[PImageBridge::WillClose]
|
||||
description =
|
||||
[PImageBridge::NewCompositable]
|
||||
|
@ -943,8 +925,6 @@ description =
|
|||
description =
|
||||
[PLayerTransaction::RequestProperty]
|
||||
description =
|
||||
[PTexture::DestroySync]
|
||||
description =
|
||||
[PUiCompositorController::Pause]
|
||||
description =
|
||||
[PUiCompositorController::Resume]
|
||||
|
|
Загрузка…
Ссылка в новой задаче