From 9026ee09d140f1d96097d198a7603c106c107c4d Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Wed, 8 Jul 2009 10:37:32 -0500 Subject: [PATCH] check that ctors and dtors have been declared for managed protocols --- ipc/ipdl/ipdl.py | 3 ++- ipc/ipdl/ipdl/parser.py | 2 +- ipc/ipdl/ipdl/type.py | 24 ++++++++++++++++++------ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/ipc/ipdl/ipdl.py b/ipc/ipdl/ipdl.py index e79f11c7216b..fce604d27656 100755 --- a/ipc/ipdl/ipdl.py +++ b/ipc/ipdl/ipdl.py @@ -44,7 +44,8 @@ def log(minv, fmt, *args): op = optparse.OptionParser(usage='ipdl.py [options] IPDLfiles...') op.add_option('-d', '--output-dir', dest='outputdir', default='.', help='Directory in which to put generated headers') -op.add_option('-I', '--include', dest='includedirs', action='append', +op.add_option('-I', '--include', dest='includedirs', default=[ ], + action='append', help='Additional directory to search for included protocol specifications') op.add_option('-v', '--verbose', dest='verbosity', default=1, action='count', help='Verbose logging (specify -vv or -vvv for very verbose logging)') diff --git a/ipc/ipdl/ipdl/parser.py b/ipc/ipdl/ipdl/parser.py index aa150da42a61..5ba4ec5f6541 100644 --- a/ipc/ipdl/ipdl/parser.py +++ b/ipc/ipdl/ipdl/parser.py @@ -99,7 +99,7 @@ class Parser: for incdir in self.includedirs +[ '' ]: realpath = os.path.join(incdir, filepath) if os.path.isfile(realpath): - return realpath + return os.path.abspath(realpath) return None # returns a GCC-style string representation of the include stack. diff --git a/ipc/ipdl/ipdl/type.py b/ipc/ipdl/ipdl/type.py index 4c8c37c55623..859313c00157 100644 --- a/ipc/ipdl/ipdl/type.py +++ b/ipc/ipdl/ipdl/type.py @@ -410,15 +410,27 @@ class GatherDecls(Visitor): msg.accept(self) del self.currentProtocolDecl + for managed in p.managesStmts: + mgdname = managed.name + ctordecl = self.symtab.lookup(mgdname +'Constructor') + dtordecl = self.symtab.lookup(mgdname +'Destructor') + + if not(ctordecl and dtordecl + and ctordecl.type.isCtor() and dtordecl.type.isDtor()): + self.errors.append( + errormsg( + managed.loc, + "constructor and destructor declarations are required for managed protocol `%s' (managed by protocol `%s')", + mgdname, p.name)) + for trans in p.transitionStmts: trans.accept(self) - # declare all the little C++ thingies that will be generated. - - # they're not relevant to IPDL itself, but those ("invisible") - # symbols can clash with others in the IPDL spec, and we'd like - # to catch those before C++ compilers are allowed to obfuscate - # the error + # FIXME/cjones declare all the little C++ thingies that will + # be generated. they're not relevant to IPDL itself, but + # those ("invisible") symbols can clash with others in the + # IPDL spec, and we'd like to catch those before C++ compilers + # are allowed to obfuscate the error self.symtab.exitScope(p)