# HG changeset patch # User Ted Mielczarek # Date 1531763534 14400 # Mon Jul 16 13:52:14 2018 -0400 # Node ID 5f20a8a55268a579911b0494243a34311e836ec6 # Parent 3b30f3c2ad27e3e72fad8c338f7139cd45ef7009 bug 1409276 - disable warnings-as-errors for Rust libraries/programs. r=chmanchester When compiling C/C++ sources via Rust build scripts there's no point in enabling warnings-as-errors as all such code is third-party code. MozReview-Commit-ID: 5pGH6w9ZE2I diff --git a/build/templates.mozbuild b/build/templates.mozbuild --- a/build/templates.mozbuild +++ b/build/templates.mozbuild @@ -48,23 +48,28 @@ def CppUnitTests(names, ext='.cpp'): Binary() @template def Library(name): '''Template for libraries.''' LIBRARY_NAME = name +@template +def AllowCompilerWarnings(): + COMPILE_FLAGS['WARNINGS_AS_ERRORS'] = [] @template def RustLibrary(name, features=None, target_dir=None): '''Template for Rust libraries.''' Library(name) IS_RUST_LIBRARY = True + # Some Rust build scripts compile C/C++ sources, don't error on warnings for them. + AllowCompilerWarnings() if features: RUST_LIBRARY_FEATURES = features if target_dir: RUST_LIBRARY_TARGET_DIR = target_dir @@ -120,33 +125,31 @@ def HostLibrary(name): HOST_LIBRARY_NAME = name @template def HostRustLibrary(name, features=None): '''Template for host Rust libraries.''' HostLibrary(name) IS_RUST_LIBRARY = True + # Some Rust build scripts compile C/C++ sources, don't error on warnings for them. + AllowCompilerWarnings() if features: HOST_RUST_LIBRARY_FEATURES = features @template def DisableStlWrapping(): COMPILE_FLAGS['STL'] = [] @template def NoVisibilityFlags(): COMPILE_FLAGS['VISIBILITY'] = [] @template -def AllowCompilerWarnings(): - COMPILE_FLAGS['WARNINGS_AS_ERRORS'] = [] - -@template def ForceInclude(*headers): """Force includes a set of header files in C++ compilations""" if CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'): include_flag = '-FI' else: include_flag = '-include' for header in headers: CXXFLAGS += [include_flag, header] diff --git a/testing/geckodriver/moz.build b/testing/geckodriver/moz.build --- a/testing/geckodriver/moz.build +++ b/testing/geckodriver/moz.build @@ -1,13 +1,15 @@ # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. RUST_PROGRAMS += ["geckodriver"] +# Some Rust build scripts compile C/C++ sources, don't error on warnings for them. +AllowCompilerWarnings() # # https://bugzil.la/1425365 # if CONFIG["OS_ARCH"] != "WINNT": # - RustTest("geckodriver") # + RUST_TESTS = ["geckodriver"] with Files("**"): BUG_COMPONENT = ("Testing", "Marionette")