Eric Blake <[EMAIL PROTECTED]> writes: > According to Simon Josefsson on 3/4/2008 7:39 AM: > | > | However, what do you think about this? > | > | /Simon > | > |>From 232f8a7255f8addd9724156d7d245b51a7feb72e Mon Sep 17 00:00:00 2001 > | From: Simon Josefsson <[EMAIL PROTECTED]> > | Date: Tue, 4 Mar 2008 15:37:59 +0100 > | Subject: [PATCH] Add module __func__ to provide C99 __func__ variable. > | > | --- > | doc/gnulib.texi | 14 ++++++++++++++ > | m4/__func__.m4 | 20 ++++++++++++++++++++ > | modules/__func__ | 20 ++++++++++++++++++++ > > Maybe it's just me, but I hate typing _ (it involves a shift key and some > coordination). Can we name it modules/func rather than modules/__func__?
Ouch, I have already pushed it. Should we rename it? > | [EMAIL PROTECTED] __func__ > | [EMAIL PROTECTED] __func__ > | + > | +The @code{__func__} module makes sure that you can use the > | [EMAIL PROTECTED] variable as defined by C99 in your code. > > Should we use the C99 terminology, where __func__ is predefined > identifier? Technically, since it is const and not an lvalue, the term > variable is a bit misleading. I agree. > | + > | +A small example is: > | + > | [EMAIL PROTECTED] > | +#include <config.h> > > #include <stdio.h> /* for printf */ Yep. > | +... > | +printf ("%s: something happened\n", __func__); > | [EMAIL PROTECTED] smallexample > > Include a function declaration around the use of __func__ in your example, > since using __func__ outside a function is undefined. I added a main function. > | + ASSERT (strlen (__func__) + 1 == sizeof (__func__)); > > The () around __func__ are extraneous. Thanks. I have pushed the patch below. /Simon >From e2b0fa9ef05ff15dba4f7051e8eede3a27b80589 Mon Sep 17 00:00:00 2001 From: Simon Josefsson <[EMAIL PROTECTED]> Date: Thu, 6 Mar 2008 11:16:06 +0100 Subject: [PATCH] Minor cleanups of __func__ module, suggested by Eric Blake <[EMAIL PROTECTED]>. --- ChangeLog | 9 +++++++++ doc/gnulib.texi | 12 ++++++++---- tests/test-__func__.c | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7b9fa02..16caed6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-03-06 Simon Josefsson <[EMAIL PROTECTED]> + + * doc/gnulib.texi (__func__): Use C99 terminology when talking + about __func__. Make example self-contained. Suggested by Eric + Blake <[EMAIL PROTECTED]>. + + * tests/test-__func__.c (main): Avoid extraneous () around __func. + Suggested by Eric Blake <[EMAIL PROTECTED]>. + 2008-03-05 Simon Josefsson <[EMAIL PROTECTED]> * modules/byteswap (License): Re-license as LGPLv2+. diff --git a/doc/gnulib.texi b/doc/gnulib.texi index 31f51df..8de6d8e 100644 --- a/doc/gnulib.texi +++ b/doc/gnulib.texi @@ -5829,15 +5829,19 @@ generated automatically. @node __func__ @section __func__ -The @code{__func__} module makes sure that you can use the [EMAIL PROTECTED] variable as defined by C99 in your code. +The @code{__func__} module makes sure that you can use the predefined +identifier @code{__func__} as defined by C99 in your code. A small example is: @smallexample #include <config.h> -... -printf ("%s: something happened\n", __func__); +#include <stdio.h> /* for printf */ + +int main (void) [EMAIL PROTECTED] + printf ("%s: hello world\n", __func__); [EMAIL PROTECTED] @end smallexample @node GNU Free Documentation License diff --git a/tests/test-__func__.c b/tests/test-__func__.c index afa6159..7b49026 100644 --- a/tests/test-__func__.c +++ b/tests/test-__func__.c @@ -36,6 +36,6 @@ int main () { - ASSERT (strlen (__func__) + 1 == sizeof (__func__)); + ASSERT (strlen (__func__) + 1 == sizeof __func__); return 0; } -- 1.5.4.1