Bug 1339275: Define JSPropertySpec values in a way that's easier for Visual Studio to initialize. r=Waldo

MozReview-Commit-ID: BMCunTjUapN
This commit is contained in:
David Major 2017-02-22 10:11:54 +13:00
Родитель bb5fe68fae
Коммит ec8b79d7fd
1 изменённых файлов: 13 добавлений и 5 удалений

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

@ -2224,9 +2224,17 @@ class PropertyDefiner:
specType = "const " + specType
arrays = fill(
"""
// We deliberately use brace-elision to make Visual Studio produce better initalization code.
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-braces"
#endif
static ${specType} ${name}_specs[] = {
${specs}
};
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
${disablers}
// Can't be const because the pref-enabled boolean needs to be writable
@ -2689,7 +2697,7 @@ class AttrDefiner(PropertyDefiner):
accessor = "GenericBindingGetter"
jitinfo = ("&%s_getterinfo" %
IDLToCIdentifier(attr.identifier.name))
return "{ { %s, %s } }" % \
return "%s, %s" % \
(accessor, jitinfo)
def setter(attr):
@ -2697,7 +2705,7 @@ class AttrDefiner(PropertyDefiner):
attr.getExtendedAttribute("PutForwards") is None and
attr.getExtendedAttribute("Replaceable") is None and
attr.getExtendedAttribute("LenientSetter") is None):
return "JSNATIVE_WRAPPER(nullptr)"
return "nullptr, nullptr"
if self.static:
accessor = 'set_' + IDLToCIdentifier(attr.identifier.name)
jitinfo = "nullptr"
@ -2711,7 +2719,7 @@ class AttrDefiner(PropertyDefiner):
else:
accessor = "GenericBindingSetter"
jitinfo = "&%s_setterinfo" % IDLToCIdentifier(attr.identifier.name)
return "{ { %s, %s } }" % \
return "%s, %s" % \
(accessor, jitinfo)
def specData(attr):
@ -2720,8 +2728,8 @@ class AttrDefiner(PropertyDefiner):
return self.generatePrefableArray(
array, name,
lambda fields: ' { "%s", %s, { { %s, %s } } }' % fields,
' JS_PS_END',
lambda fields: ' { "%s", %s, %s, %s }' % fields,
' { nullptr, 0, nullptr, nullptr, nullptr, nullptr }',
'JSPropertySpec',
PropertyDefiner.getControllingCondition, specData, doIdArrays)