From 6de1ac07d51a4cb3a9619866ef19c459512bf668 Mon Sep 17 00:00:00 2001 From: Mohammad Alsaleh Date: Tue, 8 Sep 2015 18:11:05 +0300 Subject: [PATCH] c_config: Avoid warnings/errors when checking for C functions The check for C functions fails with '-Werror' in GCC (5.2). return (int)p; ^ The cast here triggers this error: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] p=(void*)(%s); ^ This conversion triggers another error with '-pedantic -Werror': error: ISO C forbids conversion of function pointer to object pointer type [-Werror=pedantic] This patch fixes both errors. Signed-off-by: Mohammad Alsaleh --- waflib/Tools/c_config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/waflib/Tools/c_config.py b/waflib/Tools/c_config.py index f78838f2..14243cd8 100644 --- a/waflib/Tools/c_config.py +++ b/waflib/Tools/c_config.py @@ -25,10 +25,10 @@ cfg_ver = { SNIP_FUNCTION = ''' int main(int argc, char **argv) { - void *p; + void (*p)(); (void)argc; (void)argv; - p=(void*)(%s); - return (int)p; + p=(void(*)())(%s); + return !p; } ''' """Code template for checking for functions"""