Simon Josefsson wrote:
> Ok to push?
3 nits:
> +A small function is:
> +
> [EMAIL PROTECTED]
> +#include <config.h>
> +...
> +printf ("%s: something happened\n", __func__);
> [EMAIL PROTECTED] smallexample
I don't see a function here. Did you mean "A small example is:" ?
> + AH_VERBATIM(__FUNC__, [
> +#if !HAVE_DECL___FUNC__
> +# define __func__ "<unknown function>"
> +#endif
> + ])
This relies on the AH_VERBATIM argument to be inserted in config.h.in after
the conditional HAVE_DECL___FUNC__ definition. But this is not guaranteed:
AH_VERBATIMs are sorted according to the key, i.e. on "__FUNC__". But the
other sort key (from AC_CHECK_DECLS) is not specified, nor is the locale.
Isn't this simpler?
AC_CHECK_DECLS([__func__])
if test "$ac_cv_have_decl___func__" != yes; then
AC_DEFINE([__func__], ["<unknown function>"],
[Define as a replacement for the ISO C99 __func__ variable.])
fi
> + AC_CHECK_DECLS([__func__])
Is this right?? AC_CHECK_DECLS checks for a declaration as a function. What
you want is to know whether it's declared as a variable(!), when used inside
a function(!).
There is a macro gt_CHECK_VAR_DECL in gnulib, but it assumes the variable
is also declared outside of functions.
So I think this needs a hand-written AC_TRY_COMPILE invocation here.
Bruno