>From the gcc manual: `__FUNCTION__' is another name for `__func__'. Older versions of GCC recognize only this name. However, it is not standardized. For maximum portability, we recommend you use `__func__', but provide a fallback definition with the preprocessor:
#if __STDC_VERSION__ < 199901L # if __GNUC__ >= 2 # define __func__ __FUNCTION__ # else # define __func__ "<unknown>" # endif #endif The __func__ module will add the block above to config.h, to make sure that __func__ is usable. If there are other pre-C99 compilers that use other ways of printing the function name, I suppose the module could be extended with those. What do you think? I was unsure where to document this, it isn't either a function or header file, strictly speaking. /Simon diff --git a/ChangeLog b/ChangeLog index 040fffa..f58fa96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-02-28 Simon Josefsson <[EMAIL PROTECTED]> + + * modules/__func__: New module. + + * m4/__func__.m4: New file. + 2008-02-28 Sergey Poznyakoff <[EMAIL PROTECTED]> * build-aux/bootstrap (source_base, m4_base)
# __func__.m4 serial 1 dnl Copyright (C) 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # Written by Simon Josefsson AC_DEFUN([gl___FUNC__], [ AC_MSG_NOTICE([making sure __func__ is available]) AH_VERBATIM(__FUNC__, [ #if __STDC_VERSION__ < 199901L # if __GNUC__ >= 2 # define __func__ __FUNCTION__ # else # define __func__ "<unknown>" # endif #endif ]) ])
Description: Make sure __func__ is usable even on non-C99 platforms. Files: m4/__func__.m4 Depends-on: configure.ac: gl___FUNC__ Makefile.am: Include: License: LGPL Maintainer: Simon Josefsson