Bug 1319615 - Delete trailing whitespace from some IPDL files. r=billm draft
authorAndrew McCreight <continuation@gmail.com>
Mon, 21 Nov 2016 13:33:34 -0800
changeset 442646 afc5ad4cf1aab5874d46d00a96f7eb9233a63d54
parent 442068 0534254e9a40b4bade2577c631fe4cfa0b5db41d
child 442647 34dd0cd5cae1993b768b0173f9432544ce993b85
push id36772
push userbmo:continuation@gmail.com
push dateWed, 23 Nov 2016 00:52:31 +0000
reviewersbillm
bugs1319615
milestone53.0a1
Bug 1319615 - Delete trailing whitespace from some IPDL files. r=billm MozReview-Commit-ID: Jetx4ARsSZZ
ipc/ipdl/ipdl/type.py
ipc/ipdl/test/ipdl/IPDLCompile.py
ipc/ipdl/test/ipdl/runtests.py
--- a/ipc/ipdl/ipdl/type.py
+++ b/ipc/ipdl/ipdl/type.py
@@ -418,17 +418,17 @@ class StructType(_CompoundType):
         _CompoundType.__init__(self)
         self.qname = qname
         self.fields = fields            # [ Type ]
 
     def isStruct(self):   return True
     def itercomponents(self):
         for f in self.fields:
             yield f
-    
+
     def name(self): return self.qname.baseid
     def fullname(self): return str(self.qname)
 
 class UnionType(_CompoundType):
     def __init__(self, qname, components):
         _CompoundType.__init__(self)
         self.qname = qname
         self.components = components    # [ Type ]
@@ -547,17 +547,17 @@ def errormsg(loc, fmt, *args):
 
 ##--------------------
 class SymbolTable:
     def __init__(self, errors):
         self.errors = errors
         self.scopes = [ { } ]   # stack({})
         self.globalScope = self.scopes[0]
         self.currentScope = self.globalScope
-    
+
     def enterScope(self, node):
         assert (isinstance(self.scopes[0], dict)
                 and self.globalScope is self.scopes[0])
         assert (isinstance(self.currentScope, dict))
 
         if not hasattr(node, 'symtab'):
             node.symtab = { }
 
@@ -838,17 +838,17 @@ class GatherDecls(TcheckVisitor):
         self.symtab.exitScope(sd)
 
     def visitUnionDecl(self, ud):
         utype = ud.decl.type
 
         # If we've already processed this union, don't do it again.
         if len(utype.components):
             return
-        
+
         for c in ud.components:
             cdecl = self.symtab.lookup(str(c))
             if cdecl is None:
                 self.error(c.loc, "unknown component type `%s' of union `%s'",
                            str(c), ud.name)
                 continue
             utype.components.append(self._canonicalType(cdecl.type, c))
 
@@ -925,17 +925,17 @@ class GatherDecls(TcheckVisitor):
 
             if not (ctordecl and ctordecl.type.isCtor()):
                 self.error(
                     managed.loc,
                     "constructor declaration required for managed protocol `%s' (managed by protocol `%s')",
                     mgdname, p.name)
 
         p.states = { }
-        
+
         if len(p.transitionStmts):
             p.startStates = [ ts for ts in p.transitionStmts
                               if ts.state.start ]
             if 0 == len(p.startStates):
                 p.startStates = [ p.transitionStmts[0] ]
 
         # declare implicit "any", "dead", and "dying" states
         self.declare(loc=State.ANY.loc,
@@ -961,30 +961,30 @@ class GatherDecls(TcheckVisitor):
             self.seentriggers = set()
             trans.accept(self)
 
         if not (p.decl.type.stateless
                 or (p.decl.type.isToplevel()
                     and None is self.symtab.lookup(_DELETE_MSG))):
             # add a special state |state DEAD: null goto DEAD;|
             deadtrans = TransitionStmt.makeNullStmt(State.DEAD)
-            p.states[State.DEAD] = deadtrans           
+            p.states[State.DEAD] = deadtrans
             if p.decl.type.hasReentrantDelete:
                 dyingtrans = TransitionStmt.makeNullStmt(State.DYING)
                 p.states[State.DYING] = dyingtrans
 
         # visit the message decls once more and resolve the state names
         # attached to actor params and returns
         def resolvestate(loc, actortype):
             assert actortype.isIPDL() and actortype.isActor()
 
             # already resolved this guy's state
             if isinstance(actortype.state, Decl):
                 return
-            
+
             if actortype.state is None:
                 # we thought this was a C++ type until type checking,
                 # when we realized it was an IPDL actor type.  But
                 # that means that the actor wasn't specified to be in
                 # any particular state
                 actortype.state = State.ANY
 
             statename = actortype.state.name
@@ -1177,17 +1177,17 @@ class GatherDecls(TcheckVisitor):
         mname = t.msg
         if t in self.seentriggers:
             self.error(loc, "trigger `%s' appears multiple times", t.msg)
         self.seentriggers.add(t)
 
         mdecl = self.symtab.lookup(mname)
         if mdecl is not None and mdecl.type.isIPDL() and mdecl.type.isProtocol():
             mdecl = self.symtab.lookup(mname +'Constructor')
-        
+
         if mdecl is None:
             self.error(loc, "message `%s' has not been declared", mname)
         elif not mdecl.type.isMessage():
             self.error(
                 loc,
                 "`%s' should have message type, but instead has type `%s'",
                 mname, mdecl.type.typename())
         else:
@@ -1242,17 +1242,17 @@ def checkcycles(p, stack=None):
 
     if stack is None:
         stack = []
 
     for cp in p.manages:
         # special case for self-managed protocols
         if cp is p:
             continue
-        
+
         if cp in stack:
             return [stack + [p, cp]]
         cycles += checkcycles(cp, stack + [p])
 
     return cycles
 
 def formatcycles(cycles):
     r = []
@@ -1323,17 +1323,17 @@ class CheckTypes(TcheckVisitor):
     def visitUnionDecl(self, ud):
         if not fullyDefined(ud.decl.type):
             self.error(ud.decl.loc,
                        "union `%s' is only partially defined", ud.name)
 
 
     def visitProtocol(self, p):
         self.ptype = p.decl.type
-        
+
         # check that we require no more "power" than our manager protocols
         ptype, pname = p.decl.type, p.decl.shortname
 
         if len(p.spawnsStmts) and not ptype.isToplevel():
             self.error(p.decl.loc,
                        "protocol `%s' is not top-level and so cannot declare |spawns|",
                        pname)
 
@@ -1449,17 +1449,17 @@ class CheckTypes(TcheckVisitor):
             self.error(
                 loc,
                 "|manages| declaration in protocol `%s' does not match any |manager| declaration in protocol `%s'",
                 pname, mgsname)
 
 
     def visitManager(self, mgr):
         # FIXME/bug 541126: check that the protocol graph is acyclic
-        
+
         pdecl = mgr.of.decl
         ptype, pname = pdecl.type, pdecl.shortname
 
         mgrdecl = mgr.decl
         mgrtype, mgrname = mgrdecl.type, mgrdecl.shortname
 
         # we added this information; sanity check it
         assert ptype.isManagedBy(mgrtype)
@@ -1518,29 +1518,29 @@ class CheckTypes(TcheckVisitor):
             self.error(
                 loc,
                 "message `%s' in protocol `%s' requests compression but is not async or is special (ctor or dtor)",
                 mname[:-len('constructor')], pname)
 
         if mtype.isCtor() and not ptype.isManagerOf(mtype.constructedType()):
             self.error(
                 loc,
-                "ctor for protocol `%s', which is not managed by protocol `%s'", 
+                "ctor for protocol `%s', which is not managed by protocol `%s'",
                 mname[:-len('constructor')], pname)
 
 
     def visitTransition(self, t):
         _YNC = [ ASYNC, SYNC ]
 
         loc = t.loc
         impliedDirection, impliedSems = {
             SEND: [ OUT, _YNC ], RECV: [ IN, _YNC ],
             CALL: [ OUT, INTR ],  ANSWER: [ IN, INTR ],
          } [t.trigger]
-        
+
         if (OUT is impliedDirection and t.msg.type.isIn()
             or IN is impliedDirection and t.msg.type.isOut()
             or _YNC is impliedSems and t.msg.type.isInterrupt()
             or INTR is impliedSems and (not t.msg.type.isInterrupt())):
             mtype = t.msg.type
 
             self.error(
                 loc, "%s %s message `%s' is not `%s'd",
@@ -2142,17 +2142,17 @@ direction as trigger |t|'''
             return '[error]'
 
         T1 = stateName(T1)
         T2 = stateName(T2)
         U1 = stateName(U1)
         U2 = stateName(U2)
 
         return T1, M1.msg.progname, U1, T2, M2.msg.progname, U2
-        
+
 
     def reportRaceError(self, loc, S, t1Seq, t2Seq):
         T1, M1, U1, T2, M2, U2 = self._normalizeTransitionSequences(t1Seq, t2Seq)
         self.error(
             loc,
 """in protocol `%(P)s', the sequence of events
      parent:    +--`send %(M1)s'-->( state `%(T1)s' )--`recv %(M2)s'-->( state %(U1)s )
                /
--- a/ipc/ipdl/test/ipdl/IPDLCompile.py
+++ b/ipc/ipdl/test/ipdl/IPDLCompile.py
@@ -18,17 +18,17 @@ class IPDLCompile:
 
         tmpoutdir = tempfile.mkdtemp(prefix='ipdl_unit_test')
 
         try:
             self.argv.extend([
                 '-d', tmpoutdir,
                 self.specfilename
             ])
-            
+
             proc = subprocess.Popen(args=self.argv,
                                     stdout=subprocess.PIPE,
                                     stderr=subprocess.PIPE)
             self.stdout, self.stderr = proc.communicate()
 
             self.returncode = proc.returncode
             assert self.returncode is not None
 
@@ -64,12 +64,12 @@ exception being raised.'''
         assert self.completed()
 
         return None is not re.search(r'Traceback (most recent call last):',
                                      self.stderr)
 
     def ok(self):
         '''Return True iff compiling self.specstring was successful.'''
         assert self.completed()
-        
+
         return (not self.exception()
                 and not self.error()
                 and (0 == self.returncode))
--- a/ipc/ipdl/test/ipdl/runtests.py
+++ b/ipc/ipdl/test/ipdl/runtests.py
@@ -17,29 +17,29 @@ class IPDLTestCase(unittest.TestCase):
     def mkFailMsg(self):
         return '''
 ### Command: %s
 ### stderr:
 %s'''% (' '.join(self.compile.argv), self.compile.stderr)
 
     def shortDescription(self):
         return '%s test of "%s"'% (self.__class__.__name__, self.filename)
-    
+
 
 class OkTestCase(IPDLTestCase):
     '''An invocation of the IPDL compiler on a valid specification.
 The IPDL compiler should not produce errors or exceptions.'''
 
     def __init__(self, ipdlargv, filename):
         IPDLTestCase.__init__(self, ipdlargv, filename)
 
     def checkPassed(self):
         self.assertTrue(self.compile.ok(), self.mkFailMsg())
 
-  
+
 class ErrorTestCase(IPDLTestCase):
     '''An invocation of the IPDL compiler on an *invalid* specification.
 The IPDL compiler *should* produce errors but not exceptions.'''
 
     def __init__(self, ipdlargv, filename):
         IPDLTestCase.__init__(self, ipdlargv, filename)
 
     def checkPassed(self):