diff options
| author | David Cournapeau <cournape@gmail.com> | 2014-07-07 21:16:30 +0900 |
|---|---|---|
| committer | David Cournapeau <cournape@gmail.com> | 2014-07-07 21:38:31 +0900 |
| commit | 8a1496df7ad58936a8f9ff929ff629f3d38f51d8 (patch) | |
| tree | 765ebbe09dc2ee34575b2e04e6b2318e7be00f29 /numpy/distutils/command | |
| parent | 9cede2744726c77b65839396aaad7c99e5435bc0 (diff) | |
| download | numpy-8a1496df7ad58936a8f9ff929ff629f3d38f51d8.tar.gz | |
FEAT: add a check_gcc_variable_attribute function in config command.
Diffstat (limited to 'numpy/distutils/command')
| -rw-r--r-- | numpy/distutils/command/autodist.py | 17 | ||||
| -rw-r--r-- | numpy/distutils/command/config.py | 4 |
2 files changed, 21 insertions, 0 deletions
diff --git a/numpy/distutils/command/autodist.py b/numpy/distutils/command/autodist.py index ec00bcbdb..8598b33e6 100644 --- a/numpy/distutils/command/autodist.py +++ b/numpy/distutils/command/autodist.py @@ -59,6 +59,23 @@ main() """ % (attribute, name) return cmd.try_compile(body, None, None) != 0 +def check_gcc_variable_attribute(cmd, attribute): + """Return True if the given variable attribute is supported.""" + cmd._check_compiler() + body = """ +#pragma GCC diagnostic error "-Wattributes" +#pragma clang diagnostic error "-Wattributes" + +int %s foo; + +int +main() +{ + return 0; +} +""" % (attribute, ) + return cmd.try_compile(body, None, None) != 0 + def check_compile_without_warning(cmd, body): cmd._check_compiler() ret, output = cmd.try_output_compile(body, None, None) diff --git a/numpy/distutils/command/config.py b/numpy/distutils/command/config.py index 512471d7f..513d1b064 100644 --- a/numpy/distutils/command/config.py +++ b/numpy/distutils/command/config.py @@ -17,6 +17,7 @@ import distutils from numpy.distutils.exec_command import exec_command from numpy.distutils.mingw32ccompiler import generate_manifest from numpy.distutils.command.autodist import (check_gcc_function_attribute, + check_gcc_variable_attribute, check_inline, check_compiler_gcc4, check_compile_without_warning) @@ -428,6 +429,9 @@ int main () def check_gcc_function_attribute(self, attribute, name): return check_gcc_function_attribute(self, attribute, name) + def check_gcc_variable_attribute(self, attribute): + return check_gcc_variable_attribute(self, attribute) + def check_compile_without_warning(self, code): """Returns True if the given code may be compiled without warning.""" return check_compile_without_warning(self, code) |
