Hello,
I am compiling a C++ program (LyX) with compaq cxx 6.2 in strict ansi
mode. It happens that no C functions are found by autoconf 2.52
AC_CHECK_FUNC macro, because the program bug1.C (attached, taken from
what autoconf uses) produces:
fantomas: cxx -std strict_ansi bug1.C
cxx: Error: bug1.C, line 22: a value of type "char (*)() C" cannot be
assigned to an entity of type "char (*)()"
f = memmove;
--^
cxx: Info: 1 error detected in the compilation of "bug1.C".
[I get only a warning in 'ansi' mode]
The solution is to declare also f as 'extern "C"', as done in bug2.C
(attached too). In this case, I only get the warning
fantomas: cxx -std strict_ansi bug2.C
cxx: Warning: bug2.C, line 6: Expected type
"void *(void *, const void *, unsigned long) C" is incompatible with
declared type "char () C", function will not be made intrinsic
char memmove ();
-----^
but I presume this is not a problem.
Please let me know if you need more information on this. I'd be glad
to see this fixed in next release...
JMarc
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char memmove (); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char memmove ();
char (*f) ();
int
main ()
{
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_memmove) || defined (__stub___memmove)
choke me
#else
f = memmove;
#endif
;
return 0;
}
#ifdef __cplusplus
extern "C" {
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char memmove ();
char (*f) ();
#ifdef __cplusplus
}
#endif
int
main ()
{
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_memmove) || defined (__stub___memmove)
choke me
#else
f = memmove;
#endif
;
return 0;
}