Bug 1291397. Work around clang bug that they didn't actually manage to ship a fix for which causes it to give spurious warnings it shouldn't be giving, which are then fatal due to -Werror. r=dholbert

MozReview-Commit-ID: GbMEvoxGpH1
This commit is contained in:
Boris Zbarsky 2017-03-31 17:09:48 -04:00
Родитель 861a58d5a4
Коммит af7a6137cc
1 изменённых файлов: 22 добавлений и 2 удалений

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

@ -4690,14 +4690,24 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
# For JS-implemented APIs, we refuse to allow passing objects that the # For JS-implemented APIs, we refuse to allow passing objects that the
# API consumer does not subsume. The extra parens around # API consumer does not subsume. The extra parens around
# ($${passedToJSImpl}) suppress unreachable code warnings when # ($${passedToJSImpl}) suppress unreachable code warnings when
# $${passedToJSImpl} is the literal `false`. # $${passedToJSImpl} is the literal `false`. But Apple is shipping a
# buggy clang (clang 3.9) in Xcode 8.3, so there even the parens are not
# enough. So we manually disable some warnings in clang.
if not isinstance(descriptorProvider, Descriptor) or descriptorProvider.interface.isJSImplemented(): if not isinstance(descriptorProvider, Descriptor) or descriptorProvider.interface.isJSImplemented():
templateBody = fill( templateBody = fill(
""" """
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunreachable-code"
#pragma clang diagnostic ignored "-Wunreachable-code-return"
#endif // __clang__
if (($${passedToJSImpl}) && !CallerSubsumes($${val})) { if (($${passedToJSImpl}) && !CallerSubsumes($${val})) {
ThrowErrorMessage(cx, MSG_PERMISSION_DENIED_TO_PASS_ARG, "${sourceDescription}"); ThrowErrorMessage(cx, MSG_PERMISSION_DENIED_TO_PASS_ARG, "${sourceDescription}");
$*{exceptionCode} $*{exceptionCode}
} }
#ifdef __clang__
#pragma clang diagnostic pop
#endif // __clang__
""", """,
sourceDescription=sourceDescription, sourceDescription=sourceDescription,
exceptionCode=exceptionCode) + templateBody exceptionCode=exceptionCode) + templateBody
@ -5896,14 +5906,24 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
# For JS-implemented APIs, we refuse to allow passing objects that the # For JS-implemented APIs, we refuse to allow passing objects that the
# API consumer does not subsume. The extra parens around # API consumer does not subsume. The extra parens around
# ($${passedToJSImpl}) suppress unreachable code warnings when # ($${passedToJSImpl}) suppress unreachable code warnings when
# $${passedToJSImpl} is the literal `false`. # $${passedToJSImpl} is the literal `false`. But Apple is shipping a
# buggy clang (clang 3.9) in Xcode 8.3, so there even the parens are not
# enough. So we manually disable some warnings in clang.
if not isinstance(descriptorProvider, Descriptor) or descriptorProvider.interface.isJSImplemented(): if not isinstance(descriptorProvider, Descriptor) or descriptorProvider.interface.isJSImplemented():
templateBody = fill( templateBody = fill(
""" """
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunreachable-code"
#pragma clang diagnostic ignored "-Wunreachable-code-return"
#endif // __clang__
if (($${passedToJSImpl}) && !CallerSubsumes($${val})) { if (($${passedToJSImpl}) && !CallerSubsumes($${val})) {
ThrowErrorMessage(cx, MSG_PERMISSION_DENIED_TO_PASS_ARG, "${sourceDescription}"); ThrowErrorMessage(cx, MSG_PERMISSION_DENIED_TO_PASS_ARG, "${sourceDescription}");
$*{exceptionCode} $*{exceptionCode}
} }
#ifdef __clang__
#pragma clang diagnostic pop
#endif // __clang__
""", """,
sourceDescription=sourceDescription, sourceDescription=sourceDescription,
exceptionCode=exceptionCode) + templateBody exceptionCode=exceptionCode) + templateBody