diff options
author | Ralf Gommers <ralf.gommers@gmail.com> | 2019-09-20 20:29:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-20 20:29:17 +0200 |
commit | aa5be97f467bd98a7993030e313b108d0b6fa5eb (patch) | |
tree | db6200f5d00c5b43a736718405184e68a2c2b6ea /numpy/distutils/command/build_clib.py | |
parent | 815061c3ce9672b850147a0bc3535ebb220913e0 (diff) | |
parent | 05bed28f9818a04f0b748ca0e11168ef22ee2614 (diff) | |
download | numpy-aa5be97f467bd98a7993030e313b108d0b6fa5eb.tar.gz |
Merge pull request #14527 from mattip/c-warnings-as-error
BLD: add warn-error option, adds -Werror to compiler
Diffstat (limited to 'numpy/distutils/command/build_clib.py')
-rw-r--r-- | numpy/distutils/command/build_clib.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/numpy/distutils/command/build_clib.py b/numpy/distutils/command/build_clib.py index 910493a77..13edf0717 100644 --- a/numpy/distutils/command/build_clib.py +++ b/numpy/distutils/command/build_clib.py @@ -33,15 +33,18 @@ class build_clib(old_build_clib): ('inplace', 'i', 'Build in-place'), ('parallel=', 'j', "number of parallel jobs"), + ('warn-error', None, + "turn all warnings into errors (-Werror)"), ] - boolean_options = old_build_clib.boolean_options + ['inplace'] + boolean_options = old_build_clib.boolean_options + ['inplace', 'warn-error'] def initialize_options(self): old_build_clib.initialize_options(self) self.fcompiler = None self.inplace = 0 self.parallel = None + self.warn_error = None def finalize_options(self): if self.parallel: @@ -50,7 +53,10 @@ class build_clib(old_build_clib): except ValueError: raise ValueError("--parallel/-j argument must be an integer") old_build_clib.finalize_options(self) - self.set_undefined_options('build', ('parallel', 'parallel')) + self.set_undefined_options('build', + ('parallel', 'parallel'), + ('warn_error', 'warn_error'), + ) def have_f_sources(self): for (lib_name, build_info) in self.libraries: @@ -86,6 +92,10 @@ class build_clib(old_build_clib): self.compiler.customize(self.distribution, need_cxx=self.have_cxx_sources()) + if self.warn_error: + self.compiler.compiler.append('-Werror') + self.compiler.compiler_so.append('-Werror') + libraries = self.libraries self.libraries = None self.compiler.customize_cmd(self) |