summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-06-14 14:05:29 +0200
committerDavid Robillard <d@drobilla.net>2020-06-14 14:05:29 +0200
commit4fbcf65393abb1472c75bd8006a6c58d304c18d9 (patch)
treeec3d4f0a3f678f14e74f22f50b2656cb0d24a494
parent878bdba53979f11fa582088e47997df129e56d16 (diff)
downloadautowaf-4fbcf65393abb1472c75bd8006a6c58d304c18d9.tar.gz
autowaf-4fbcf65393abb1472c75bd8006a6c58d304c18d9.tar.bz2
autowaf-4fbcf65393abb1472c75bd8006a6c58d304c18d9.zip
Make conf.check_function work with strict warnings
-rw-r--r--extras/autowaf.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/extras/autowaf.py b/extras/autowaf.py
index 302cc55..8c314b5 100644
--- a/extras/autowaf.py
+++ b/extras/autowaf.py
@@ -160,10 +160,20 @@ def check_function(conf, lang, name, **args):
"Check for a function"
header_names = Utils.to_list(args['header_name'])
includes = ''.join(['#include <%s>\n' % x for x in header_names])
+ return_type = args['return_type'] if 'return_type' in args else 'int'
+ arg_types = args['arg_types'] if 'arg_types' in args else ''
+
fragment = '''
%s
-int main() { return !(void(*)())(%s); }
-''' % (includes, name)
+
+typedef %s (*Func)(%s);
+
+int main(void) {
+ static const Func ptr = %s;
+ (void)ptr;
+ return 0;
+}
+''' % (includes, return_type, arg_types, name)
check_func = get_check_func(conf, lang)
args['msg'] = 'Checking for %s' % name