Revert bug 578478 because of issues in parallel builds (generating the yacc/lex tables), and because of a conflict with fatvals

This commit is contained in:
Benjamin Smedberg 2010-08-09 15:22:40 -04:00
Родитель 90f7d8291e
Коммит 2d1bfc5d9c
4 изменённых файлов: 36 добавлений и 116 удалений

Просмотреть файл

@ -420,7 +420,7 @@ ifndef MOZ_AUTO_DEPS
ifneq (,$(OBJS)$(XPIDLSRCS)$(SIMPLE_PROGRAMS))
MDDEPFILES = $(addprefix $(MDDEPDIR)/,$(OBJS:.$(OBJ_SUFFIX)=.pp))
ifndef NO_GEN_XPT
MDDEPFILES += $(addprefix $(MDDEPDIR)/,$(XPIDLSRCS:.idl=.h.pp) $(XPIDLSRCS:.idl=.xpt.pp))
MDDEPFILES += $(addprefix $(MDDEPDIR)/,$(XPIDLSRCS:.idl=.xpt))
endif
endif
endif
@ -1759,17 +1759,9 @@ $(XPIDL_GEN_DIR)/.done:
# don't depend on $(XPIDL_GEN_DIR), because the modification date changes
# with any addition to the directory, regenerating all .h files -> everything.
XPIDL_DEPS = \
$(topsrcdir)/xpcom/idl-parser/header.py \
$(topsrcdir)/xpcom/idl-parser/xpidl.py \
$(NULL)
$(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_DEPS) $(XPIDL_GEN_DIR)/.done
$(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
$(REPORT_BUILD)
$(PYTHON) $(topsrcdir)/config/pythonpath.py \
-I$(topsrcdir)/other-licenses/ply \
-I$(topsrcdir)/xpcom/idl-parser \
$(topsrcdir)/xpcom/idl-parser/header.py --cachedir=$(DEPTH)/xpcom/idl-parser $(XPIDL_FLAGS) $(_VPATH_SRCS) -d $(MDDEPDIR)/$(@F).pp -o $@
$(ELOG) $(XPIDL_COMPILE) -m header -w $(XPIDL_FLAGS) -o $(XPIDL_GEN_DIR)/$* $(_VPATH_SRCS)
@if test -n "$(findstring $*.h, $(EXPORTS))"; \
then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi
@ -1778,7 +1770,7 @@ ifndef NO_GEN_XPT
# into $(XPIDL_MODULE).xpt and export it to $(FINAL_TARGET)/components.
$(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
$(REPORT_BUILD)
$(ELOG) $(XPIDL_COMPILE) -m typelib -w $(XPIDL_FLAGS) -e $@ -d $(MDDEPDIR)/$(@F).pp $(_VPATH_SRCS)
$(ELOG) $(XPIDL_COMPILE) -m typelib -w $(XPIDL_FLAGS) -e $@ -d $(MDDEPDIR)/$*.pp $(_VPATH_SRCS)
# no need to link together if XPIDLSRCS contains only XPIDL_MODULE
ifneq ($(XPIDL_MODULE).idl,$(strip $(XPIDLSRCS)))

Просмотреть файл

@ -420,7 +420,7 @@ ifndef MOZ_AUTO_DEPS
ifneq (,$(OBJS)$(XPIDLSRCS)$(SIMPLE_PROGRAMS))
MDDEPFILES = $(addprefix $(MDDEPDIR)/,$(OBJS:.$(OBJ_SUFFIX)=.pp))
ifndef NO_GEN_XPT
MDDEPFILES += $(addprefix $(MDDEPDIR)/,$(XPIDLSRCS:.idl=.h.pp) $(XPIDLSRCS:.idl=.xpt.pp))
MDDEPFILES += $(addprefix $(MDDEPDIR)/,$(XPIDLSRCS:.idl=.xpt))
endif
endif
endif
@ -1759,17 +1759,9 @@ $(XPIDL_GEN_DIR)/.done:
# don't depend on $(XPIDL_GEN_DIR), because the modification date changes
# with any addition to the directory, regenerating all .h files -> everything.
XPIDL_DEPS = \
$(topsrcdir)/xpcom/idl-parser/header.py \
$(topsrcdir)/xpcom/idl-parser/xpidl.py \
$(NULL)
$(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_DEPS) $(XPIDL_GEN_DIR)/.done
$(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
$(REPORT_BUILD)
$(PYTHON) $(topsrcdir)/config/pythonpath.py \
-I$(topsrcdir)/other-licenses/ply \
-I$(topsrcdir)/xpcom/idl-parser \
$(topsrcdir)/xpcom/idl-parser/header.py --cachedir=$(DEPTH)/xpcom/idl-parser $(XPIDL_FLAGS) $(_VPATH_SRCS) -d $(MDDEPDIR)/$(@F).pp -o $@
$(ELOG) $(XPIDL_COMPILE) -m header -w $(XPIDL_FLAGS) -o $(XPIDL_GEN_DIR)/$* $(_VPATH_SRCS)
@if test -n "$(findstring $*.h, $(EXPORTS))"; \
then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi
@ -1778,7 +1770,7 @@ ifndef NO_GEN_XPT
# into $(XPIDL_MODULE).xpt and export it to $(FINAL_TARGET)/components.
$(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
$(REPORT_BUILD)
$(ELOG) $(XPIDL_COMPILE) -m typelib -w $(XPIDL_FLAGS) -e $@ -d $(MDDEPDIR)/$(@F).pp $(_VPATH_SRCS)
$(ELOG) $(XPIDL_COMPILE) -m typelib -w $(XPIDL_FLAGS) -e $@ -d $(MDDEPDIR)/$*.pp $(_VPATH_SRCS)
# no need to link together if XPIDLSRCS contains only XPIDL_MODULE
ifneq ($(XPIDL_MODULE).idl,$(strip $(XPIDLSRCS)))

Просмотреть файл

@ -58,32 +58,20 @@ def firstCap(str):
def attributeParamName(a):
return "a" + firstCap(a.name)
def attributeParamNames(a):
l = [attributeParamName(a)]
if a.implicit_jscontext:
l.insert(0, "cx")
return ", ".join(l)
def attributeNativeName(a, getter):
binaryname = a.binaryname is not None and a.binaryname or firstCap(a.name)
return "%s%s" % (getter and 'Get' or 'Set', binaryname)
def attributeParamlist(a, getter):
l = ["%s%s" % (a.realtype.nativeType(getter and 'out' or 'in'),
attributeParamName(a))]
if a.implicit_jscontext:
l.insert(0, "JSContext* cx")
return ", ".join(l)
return "%s%s" % (a.realtype.nativeType(getter and 'out' or 'in'),
attributeParamName(a))
def attributeAsNative(a, getter):
scriptable = a.isScriptable() and "NS_SCRIPTABLE " or ""
deprecated = a.deprecated and "NS_DEPRECATED " or ""
params = {'scriptable': scriptable,
'deprecated': deprecated,
'binaryname': attributeNativeName(a, getter),
'paramlist': attributeParamlist(a, getter)}
return "%(deprecated)s%(scriptable)sNS_IMETHOD %(binaryname)s(%(paramlist)s)" % params
return "%(scriptable)sNS_IMETHOD %(binaryname)s(%(paramlist)s)" % params
def methodNativeName(m):
return m.binaryname is not None and m.binaryname or firstCap(m.name)
@ -101,29 +89,24 @@ def methodAsNative(m):
return "%s%s %s(%s)" % (scriptable,
methodReturnType(m, 'NS_IMETHOD'),
methodNativeName(m),
paramlistAsNative(m))
paramlistAsNative(m.params,
m.realtype,
notxpcom=m.notxpcom))
def paramlistAsNative(m, empty='void'):
l = [paramAsNative(p) for p in m.params]
if m.implicit_jscontext:
l.append("JSContext* cx")
if m.optional_argc:
l.append('PRUint8 _argc')
if not m.notxpcom and m.realtype.name != 'void':
l.append(paramAsNative(xpidl.Param(paramtype='out',
type=None,
name='_retval',
attlist=[],
location=None,
realtype=m.realtype)))
def paramlistAsNative(l, rettype, notxpcom, empty='void'):
l = list(l)
if not notxpcom and rettype.name != 'void':
l.append(xpidl.Param(paramtype='out',
type=None,
name='_retval',
attlist=[],
location=None,
realtype=rettype))
if len(l) == 0:
return empty
return ", ".join(l)
return ", ".join([paramAsNative(p) for p in l])
def paramAsNative(p):
if p.paramtype == 'in':
@ -135,18 +118,10 @@ def paramAsNative(p):
p.name,
typeannotate)
def paramlistNames(m):
names = [p.name for p in m.params]
if m.implicit_jscontext:
names.append('cx')
if m.optional_argc:
names.append('_argc')
if not m.notxpcom and m.realtype.name != 'void':
def paramlistNames(l, rettype, notxpcom):
names = [p.name for p in l]
if not notxpcom and rettype.name != 'void':
names.append('_retval')
if len(names) == 0:
return ''
return ', '.join(names)
@ -408,15 +383,15 @@ def write_interface(iface, fd):
if isinstance(member, xpidl.Attribute):
fd.write(tmpl % {'asNative': attributeAsNative(member, True),
'nativeName': attributeNativeName(member, True),
'paramList': attributeParamNames(member)})
'paramList': attributeParamName(member)})
if not member.readonly:
fd.write(tmpl % {'asNative': attributeAsNative(member, False),
'nativeName': attributeNativeName(member, False),
'paramList': attributeParamNames(member)})
'paramList': attributeParamName(member)})
elif isinstance(member, xpidl.Method):
fd.write(tmpl % {'asNative': methodAsNative(member),
'nativeName': methodNativeName(member),
'paramList': paramlistNames(member)})
'paramList': paramlistNames(member.params, member.realtype, member.notxpcom)})
if len(iface.members) == 0:
fd.write('\\\n /* no methods! */')
elif not member.kind in ('attribute', 'method'):
@ -447,7 +422,7 @@ def write_interface(iface, fd):
fd.write(example_tmpl % {'implclass': implclass,
'returntype': methodReturnType(member, 'NS_IMETHODIMP'),
'nativeName': methodNativeName(member),
'paramList': paramlistAsNative(member, empty='')})
'paramList': paramlistAsNative(member.params, member.realtype, notxpcom=member.notxpcom, empty='')})
fd.write('\n')
fd.write(iface_template_epilog)
@ -455,43 +430,15 @@ def write_interface(iface, fd):
if __name__ == '__main__':
from optparse import OptionParser
o = OptionParser()
o.add_option('-I', action='append', dest='incdirs', default=['.'],
help="Directory to search for imported files")
o.add_option('--cachedir', dest='cachedir', default=None,
help="Directory in which to cache lex/parse tables.")
o.add_option('-o', dest='outfile', default=None,
help="Output file (default is stdout)")
o.add_option('-d', dest='depfile', default=None,
help="Generate a make dependency file")
o.add_option('-I', action='append', dest='incdirs', help="Directory to search for imported files", default=[])
o.add_option('--cachedir', dest='cachedir', help="Directory in which to cache lex/parse tables.", default='')
options, args = o.parse_args()
file, = args
if options.cachedir is not None:
if not os.path.isdir(options.cachedir):
os.mkdir(options.cachedir)
if options.cachedir != '':
sys.path.append(options.cachedir)
if options.depfile is not None and options.outfile is None:
print >>sys.stderr, "-d requires -o"
sys.exit(1)
if options.outfile is not None:
outfd = open(options.outfile, 'w')
closeoutfd = True
else:
outfd = sys.stdout
closeoutfd = False
p = xpidl.IDLParser(outputdir=options.cachedir)
idl = p.parse(open(file).read(), filename=file)
idl.resolve(options.incdirs, p)
print_header(idl, outfd, file)
if closeoutfd:
outfd.close()
if options.depfile is not None:
depfd = open(options.depfile, 'w')
deps = [dep.replace('\\', '/') for dep in idl.deps]
print >>depfd, "%s: %s" % (options.outfile, " ".join(deps))
print_header(idl, sys.stdout, file)

Просмотреть файл

@ -282,7 +282,6 @@ class Include(object):
self.IDL.resolve(parent.incdirs, parent.parser)
for type in self.IDL.getNames():
parent.setName(type)
parent.deps.extend(self.IDL.deps)
return
raise IDLError("File '%s' not found" % self.filename, self.location)
@ -290,7 +289,6 @@ class Include(object):
class IDL(object):
def __init__(self, productions):
self.productions = productions
self.deps = []
def setName(self, object):
self.namemap.set(object)
@ -646,7 +644,6 @@ class Attribute(object):
binaryname = None
null = None
undefined = None
deprecated = False
def __init__(self, type, name, attlist, readonly, location, doccomments):
self.type = type
@ -695,8 +692,6 @@ class Attribute(object):
self.notxpcom = True
elif name == 'implicit_jscontext':
self.implicit_jscontext = True
elif name == 'deprecated':
self.deprecated = True
else:
raise IDLError("Unexpected attribute '%s'", aloc)
@ -732,7 +727,6 @@ class Method(object):
binaryname = None
implicit_jscontext = False
optional_argc = False
deprecated = False
def __init__(self, type, name, attlist, paramlist, location, doccomments, raises):
self.type = type
@ -763,8 +757,6 @@ class Method(object):
self.implicit_jscontext = True
elif name == 'optional_argc':
self.optional_argc = True
elif name == 'deprecated':
self.deprecated = True
else:
raise IDLError("Unexpected attribute '%s'", aloc)
@ -1322,10 +1314,7 @@ class IDLParser(object):
self.lexer.filename = filename
self.lexer.lineno = 1
self.lexer.input(data)
idl = self.parser.parse(lexer=self)
if filename is not None:
idl.deps.append(filename)
return idl
return self.parser.parse(lexer=self)
def getLocation(self, p, i):
return Location(self.lexer, p.lineno(i), p.lexpos(i))