bug 1409276 - disable warnings-as-errors for Rust libraries/programs. r?build draft
authorTed Mielczarek <ted@mielczarek.org>
Mon, 16 Jul 2018 13:52:14 -0400
changeset 822698 c12de60121d7b5a37019ba0fbb29ab9040c6ee62
parent 822697 f999890c76992de75f521140cb3a47e6e0c513f6
child 822699 2cf2e79d753a92d49009e6f7a7522a68218d56b1
push id117452
push userbmo:ted@mielczarek.org
push dateWed, 25 Jul 2018 19:39:28 +0000
reviewersbuild
bugs1409276
milestone63.0a1
bug 1409276 - disable warnings-as-errors for Rust libraries/programs. r?build 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
build/templates.mozbuild
testing/geckodriver/moz.build
--- a/build/templates.mozbuild
+++ b/build/templates.mozbuild
@@ -58,16 +58,18 @@ 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
 
 
@@ -123,16 +125,18 @@ 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'] = []
 
--- 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":
     RUST_TESTS = [
         "geckodriver",
         "webdriver",
 
         # TODO: Move to mozbase/rust/moz.build once those crates can be