Skip to content

Commit

Permalink
ENH: use pragma instead of generic warning when detecting for functio…
Browse files Browse the repository at this point in the history
…n attributes.
  • Loading branch information
cournape committed Jul 7, 2014
1 parent 8457aab commit 9cede27
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions numpy/distutils/command/autodist.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,18 @@ def check_compiler_gcc4(cmd):
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()
Expand Down

0 comments on commit 9cede27

Please sign in to comment.