[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Intrinsic functions fails AC_CHECK_FUNCS test
From: |
Jerker Bäck |
Subject: |
Intrinsic functions fails AC_CHECK_FUNCS test |
Date: |
Tue, 21 Aug 2007 15:20:51 +0200 |
Hello all,
The test AC_LANG_FUNC_LINK_TRY(C)(FUNCTION) for generic functions invoked by
the macro AC_CHECK_FUNCS (as I understand it), fails if the tested function
is an intrinsic (compiler builtin) function. Like this:
AC_CHECK_FUNCS(memcpy) =>
char memcpy ();
int main ()
{
return memcpy();
;
return 0;
}
conftest.c(72) : warning C4391: 'char memcpy()' : incorrect
return type for intrinsic function, expected 'void'
conftest.c(83) : error C2168: 'memcpy' : too few actual
parameters for intrinsic function
-----------------------------------------------------------
intrinsic prototype:
void * __cdecl memcpy(void *,const void *,size_t);
Compiler: MS x64 compiler 14.00.50727.762
System: x86_64 Interix 6.0
This happens when configure is invoked with CFLAGS for compiler
optimizations (e.g. -O2), which would be the normal case. memcmp, memcpy and
memset are intrinsic, but for example memmove or memchr is not. So a test
for memmove would succeed, but one for memset would fail. If configure is
invoked with disabled optimizations the test works as intended.
I thought a solution would be to force the compiler to not use intrinsics by
a simple addition to the macro, like this:
#ifdef _MSC_VER
#pragma function( $1 )
#endif
=> error C2373: 'memcpy' : redefinition; different type modifiers
noop!
The problem is not trivial and can lead to unexpected fatal behaviour.
Consider this:
GNU texinfo 4.9 configure.ac
AC_REPLACE_FUNCS(memcpy memmove strdup strerror)
=> A gnulib memcpy is added to the build => fatal error
I also tried to list the intrinsic functions in functions.m4
AN_FUNCTION([memcpy], [warn: memcpy is intrinsic])
Seems to have no effect - AN_FUNCTION?
I'm lost, what to do anyone?
Thanks
Erik
-----------------------------------------------------------
Common current intrinsic CRT functions:
abs, _alloca, labs, memcmp, memcpy, memset, _setjmp, strcat, strcmp, strcpy,
strlen, strset, wcscat, wcscmp, wcscpy, wcslen, _wcsset.
c:a 50 common math functions + a bunch of others.
A similar thread:
http://lists.gnu.org/archive/html/bug-autoconf/2007-03/msg00029.html
And the solution was?
- Intrinsic functions fails AC_CHECK_FUNCS test,
Jerker Bäck <=