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_ext.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_ext.py')
-rw-r--r-- | numpy/distutils/command/build_ext.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/numpy/distutils/command/build_ext.py b/numpy/distutils/command/build_ext.py index ef54fb25e..cd9b1c6f1 100644 --- a/numpy/distutils/command/build_ext.py +++ b/numpy/distutils/command/build_ext.py @@ -33,6 +33,8 @@ class build_ext (old_build_ext): "specify the Fortran compiler type"), ('parallel=', 'j', "number of parallel jobs"), + ('warn-error', None, + "turn all warnings into errors (-Werror)"), ] help_options = old_build_ext.help_options + [ @@ -40,10 +42,13 @@ class build_ext (old_build_ext): show_fortran_compilers), ] + boolean_options = old_build_ext.boolean_options + ['warn-error'] + def initialize_options(self): old_build_ext.initialize_options(self) self.fcompiler = None self.parallel = None + self.warn_error = None def finalize_options(self): if self.parallel: @@ -69,7 +74,10 @@ class build_ext (old_build_ext): self.include_dirs.extend(incl_dirs) old_build_ext.finalize_options(self) - self.set_undefined_options('build', ('parallel', 'parallel')) + self.set_undefined_options('build', + ('parallel', 'parallel'), + ('warn_error', 'warn_error'), + ) def run(self): if not self.extensions: @@ -116,6 +124,11 @@ class build_ext (old_build_ext): force=self.force) self.compiler.customize(self.distribution) self.compiler.customize_cmd(self) + + if self.warn_error: + self.compiler.compiler.append('-Werror') + self.compiler.compiler_so.append('-Werror') + self.compiler.show_customization() # Setup directory for storing generated extra DLL files on Windows |