summaryrefslogtreecommitdiff
path: root/numpy/distutils/command/autodist.py
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2014-07-07 21:16:30 +0900
committerDavid Cournapeau <cournape@gmail.com>2014-07-07 21:38:31 +0900
commit8a1496df7ad58936a8f9ff929ff629f3d38f51d8 (patch)
tree765ebbe09dc2ee34575b2e04e6b2318e7be00f29 /numpy/distutils/command/autodist.py
parent9cede2744726c77b65839396aaad7c99e5435bc0 (diff)
downloadnumpy-8a1496df7ad58936a8f9ff929ff629f3d38f51d8.tar.gz
FEAT: add a check_gcc_variable_attribute function in config command.
Diffstat (limited to 'numpy/distutils/command/autodist.py')
-rw-r--r--numpy/distutils/command/autodist.py17
1 files changed, 17 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)