bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unused test files, verify.h problem in libvirt


From: Eric Blake
Subject: Re: unused test files, verify.h problem in libvirt
Date: Wed, 05 May 2010 14:21:08 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100330 Fedora/3.0.4-1.fc12 Lightning/1.0b1 Thunderbird/3.0.4

On 05/05/2010 01:55 PM, Paul Eggert wrote:
> To fix the problem you mentioned with verify.h, I installed the
> following patch into gnulib.  It uses the new __COUNTER__ macro of GCC
> (4.3 and later), which is designed for this problem.  So this should fix
> the warnings for GCC 4.3 and later.  Older GCCs will still generate the
> warning with -Wredundant_decls, but that's OK: people will upgrade
> eventually.  This patch defines new macros GL_CONCAT and GL_GENSYM which
> may well be useful elsewhere in gnulib, so I gave them a GL_ prefix
> rather than a verify_ prefix; if (as I suspect) they are generally
> useful, we will probably need to break them out into a different .h file.

Thanks for tackling this.

We've started using the _GL_ prefix, rather than GL_, because the
package OpenGL uses the GL_ prefix.
http://lists.gnu.org/archive/html/bug-gnulib/2009-12/msg00153.html

> +
> +/* __COUNTER__ evaluates to 0, 1, 2,..., adding one one each time the

s/one one/one/

> +   preprocessor uses it.  If the preprocessor doesn't support this
> +   builtin macro, define it to 0.  */
> +# ifndef __COUNTER__
> +#  define __COUNTER__ 0
> +# endif

Do you also want to check that it actually increments?  And wouldn't
__LINE__ be a slightly better fallback than 0?  As in:

#if !defined __COUNTER__ || __COUNTER__ == __COUNTER__
# define __COUNTER__ __LINE__
#endif

> 
> -# define verify(R) extern int (* verify_function__ (void)) [verify_true (R)]
> +# define verify(R) \
> +    extern int (* GL_GENSYM(verify_function) (void)) [verify_true (R)]

The trailing __ of the old version was nice to avoid inadvertent
collisions with normal namespace; should we be using
GL_GENSYM(verify_function__) in the new version?

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]