[PATCH:xorg-macros] Use AC_LANG_PROGRAM in XORG_CHECK_MALLOC_ZERO to clear autoconf-2.68 warnings

Alan Coopersmith alan.coopersmith at oracle.com
Sun Dec 5 11:28:44 PST 2010


Gaetan Nadon wrote:
> On Sun, 2010-12-05 at 01:36 -0800, Alan Coopersmith wrote:
>> Also, calloc() takes two arguments, as the compiler points out when
>> you #include <stdlib.h> instead of faking it badly.
>>
>> -	AC_RUN_IFELSE([
>> -char *malloc();
>> -char *realloc();
>> -char *calloc();
>> -main() {
>> +	AC_RUN_IFELSE([AC_LANG_PROGRAM([
>> +#include <stdlib.h>
>> +],[
> 
> 
> I keep seeing this all the time in config.log (not because of this patch):
> 
>     conftest.c:2: warning: conflicting types for built-in function 'malloc'
>     conftest.c:3: warning: conflicting types for built-in function 'realloc'
>     conftest.c:4: warning: conflicting types for built-in function 'calloc'
>     conftest.c: In function 'main':
>     conftest.c:11: warning: incompatible implicit declaration of built-in function 'exit'
> 
> Seems to come from this macro.

Yes, I think the replacement of the manual declarations with #include <stdlib.h>
will silence those - it certainly silenced the exit one for me.  (I expect it's
complaining about char * vs. void * for the return values from *alloc.)

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list