bug-gnulib
[Top][All Lists]
Advanced

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

unused test files, verify.h problem in libvirt


From: Eric Blake
Subject: unused test files, verify.h problem in libvirt
Date: Fri, 30 Apr 2010 16:06:37 -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

I noticed that on libvirt, two uses of verify() caused compilation
failure when using libvirt's preferred set of gcc warnings and -Werror:

util/util.c:84: error: redundant redeclaration of 'verify_function__'
[-Wredundant-decls]
util/util.c:83: error: previous declaration of 'verify_function__' was here

What's worse, we have test-verify.c that was supposed to catch problems
like this, but it is never getting run.  Why?

$ cat $(git ls-files -- '*-tests') > alltests
$ for f in $(find tests -name 'test-*'); do
>   grep -L $f alltests >/dev/null || echo $f; done
tests/test-stpncpy.out.aix433
tests/test-stpncpy.out.glibc
tests/test-iconvme.c
tests/test-stpncpy.c
tests/test-echo.sh
tests/test-verify.c
tests/test-getpass.c

Because there is no modules/verify-tests.  The other files above need to
be evaluated - why do they exist if no test module mentions them?  But I
will shortly be committing a patch to add the verify-tests module.

Meanwhile, any ideas on how to work around this latest picky warning
from gcc?  Then again, we already have a comment in verify.h:

   * This implementation exploits the fact that GCC does not warn about
     the last declaration mentioned above.  If a future version of GCC
     introduces a warning for this, the problem could be worked around
     by using code specialized to GCC, e.g.,:

       #if 4 <= __GNUC__
       # define verify(R) \
           extern int (* verify_function__ (void)) \
                      [__builtin_constant_p (R) && (R) ? 1 : -1]
       #endif

So there has already been some thought on what to do if gcc gets too
picky (although the solution mentioned in that comment doesn't look like
it will silence -Wredundant-decls).

-- 
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]