Commit 90a78fbb authored by Emilio Cobos Álvarez's avatar Emilio Cobos Álvarez
Browse files

Bug 1834071 - Allow disabling thread-safety analysis....

Bug 1834071 - Allow disabling thread-safety analysis. r=firefox-build-system-reviewers,sergesanspaille

This doesn't change behavior, it just adds an option to disable
thread-safety analysis in local builds. I want to measure it in
different machines, and this would be useful for that. It's also useful
to workaround stuff like bug 1833676 which causes my builds to OOM
frequently.

Differential Revision: https://phabricator.services.mozilla.com/D178540
parent ff37ef0d
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -16,10 +16,19 @@ option(
def warnings_as_errors(warnings_as_errors):
    if not warnings_as_errors:
        return ""

    return "-Werror"


# Turn on clang thread-safety analysis
option(
    "--enable-thread-safety-analysis",
    # Older clangs don't support AutoUnlock, and have other issues
    default=depends(c_compiler)(
        lambda c: c.type in ("clang", "clang-cl") and c.version >= "8.0"
    ),
    help="{Enable|Disable} thread-safety anaysis",
)

set_config("WARNINGS_AS_ERRORS", warnings_as_errors)

not_clang_cl = depends(c_compiler)(lambda c: c.type != "clang-cl")
@@ -293,14 +302,7 @@ check_and_add_warning(
    when=depends(c_compiler)(lambda c: c.type == "clang" and c.version < "6.0"),
)

# Turn on clang thread-safety analysis
# Older clangs don't support AutoUnlock, and have other issues
check_and_add_warning(
    "-Wthread-safety",
    when=depends(c_compiler)(
        lambda c: c.type in ("clang", "clang-cl") and c.version >= "8.0"
    ),
)
check_and_add_warning("-Wthread-safety", when="--enable-thread-safety-analysis")

# Warn if APIs are used without available() checks on macOS.
check_and_add_warning("-Werror=unguarded-availability-new", when=target_is_osx)