summaryrefslogtreecommitdiff
path: root/numpy/distutils/command/autodist.py
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2014-07-07 20:47:10 +0900
committerDavid Cournapeau <cournape@gmail.com>2014-07-07 21:38:31 +0900
commit9cede2744726c77b65839396aaad7c99e5435bc0 (patch)
treef0fc59eee979909ffd47c7df8e5a91135a91d37c /numpy/distutils/command/autodist.py
parent8457aab2ad29745dc8984a467a79c7673b9f636a (diff)
downloadnumpy-9cede2744726c77b65839396aaad7c99e5435bc0.tar.gz
ENH: use pragma instead of generic warning when detecting for function attributes.
Diffstat (limited to 'numpy/distutils/command/autodist.py')
-rw-r--r--numpy/distutils/command/autodist.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/numpy/distutils/command/autodist.py b/numpy/distutils/command/autodist.py
index 61afc0233..ec00bcbdb 100644
--- a/numpy/distutils/command/autodist.py
+++ b/numpy/distutils/command/autodist.py
@@ -46,11 +46,18 @@ main()
def check_gcc_function_attribute(cmd, attribute, name):
"""Return True if the given function attribute is supported."""
cmd._check_compiler()
- body = "int %s %s(void*);" % (attribute, name)
- ret, output = cmd.try_output_compile(body, None, None)
- if not ret or len(output) > 0:
- return False
- return True
+ body = """
+#pragma GCC diagnostic error "-Wattributes"
+#pragma clang diagnostic error "-Wattributes"
+
+int %s %s(void*);
+
+int
+main()
+{
+}
+""" % (attribute, name)
+ return cmd.try_compile(body, None, None) != 0
def check_compile_without_warning(cmd, body):
cmd._check_compiler()