check that ctors and dtors have been declared for managed protocols

This commit is contained in:
Chris Jones 2009-07-08 10:37:32 -05:00
parent bbe448b3ef
commit 9026ee09d1
3 changed files with 21 additions and 8 deletions

View File

@ -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)')

View File

@ -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.

View File

@ -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)