[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: __func__
From: |
Bruno Haible |
Subject: |
Re: __func__ |
Date: |
Mon, 3 Mar 2008 22:30:29 +0100 |
User-agent: |
KMail/1.5.4 |
Simon Josefsson wrote:
> Ok to push?
3 nits:
> +A small function is:
> +
> address@hidden
> +#include <config.h>
> +...
> +printf ("%s: something happened\n", __func__);
> address@hidden 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
- Re: __func__, Simon Josefsson, 2008/03/03
- Re: __func__,
Bruno Haible <=
- Re: __func__, Simon Josefsson, 2008/03/04
- Re: __func__, Bruno Haible, 2008/03/04
- Re: __func__, Simon Josefsson, 2008/03/06
- Re: AC_COMPILE_IFELSE, Bruno Haible, 2008/03/06
- Re: AC_COMPILE_IFELSE, Ralf Wildenhues, 2008/03/06
- Re: AC_COMPILE_IFELSE, Bruno Haible, 2008/03/06
- Re: AC_COMPILE_IFELSE, Eric Blake, 2008/03/06
- Re: __func__, Eric Blake, 2008/03/04
- Re: __func__, Simon Josefsson, 2008/03/06
- Re: __func__, Jim Meyering, 2008/03/06