[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ASSERT and SIGNATURE_CHECK macros
From: |
Eric Blake |
Subject: |
Re: ASSERT and SIGNATURE_CHECK macros |
Date: |
Thu, 24 Dec 2009 06:43:16 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Eric Blake on 12/23/2009 2:45 PM:
>> Possibility 1: Put the SIGNATURE_CHECK into a file tests/signature.h, and put
>> ASSERT, SIZEOF and a few others into tests/macros.h. A test looks like this:
>>
>
> It's less work for me if we go with possibility 2, but I have no qualms with
> the work to go with possibility 1. Either way we create macros.h and put
> ASSERT there, and the creation of macros.h is now decoupled from my signature
> check macro. The difference all boils down to whether SIGNATURE_CHECK is in
> its own header ("signature.h", affecting only the unit tests that include
> it),
> or whether it is in a common header (<config.h>, and probably should be named
> _GL_SIGNATURE_CHECK to avoid pollution, since config.h is also included by
> the
> actual project). I'm 55-45 for going with option 1. Anyone else want to
> speak
> up?
I'm pushing this. The patch is largely a mechanical update to prior
versions, so the attached is only a subset showing how the new file
tests/signature.h fits in, and why signature.h needed an include guard for
test-getopt.c.
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkszb/QACgkQ84KuGfSFAYCLwwCgpq858akQf+Y9JYCvaSlGmxZL
9y8An2HFCXCP4yG3ui55AqV5KWOnZeZo
=C+Jw
-----END PGP SIGNATURE-----
>From 0edc9144a4075990856779d348a5f93ae8b412ba Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Tue, 22 Dec 2009 10:57:14 -0700
Subject: [PATCH] tests: add signature checks
These tests will help catch problems similar to the one recently
fixed for cygwin declaring getsubopt and symlinkat in the wrong header.
* tests/signature.h (SIGNATURE_CHECK): New file.
* modules/atexit-tests (Files): Use it.
* modules/btowc-tests (Files): Likewise.
* modules/canonicalize-lgpl-tests (Files): Likewise.
* modules/ceilf-tests (Files): Likewise.
* modules/ceill-tests (Files): Likewise.
* modules/chown-tests (Files): Likewise.
* modules/dprintf-posix-tests (Files): Likewise.
* modules/dup2-tests (Files): Likewise.
* modules/dup3-tests (Files): Likewise.
* modules/duplocale-tests (Files): Likewise.
* modules/fchdir-tests (Files): Likewise.
* modules/fcntl-tests (Files): Likewise.
* modules/fdopendir-tests (Files): Likewise.
* modules/fflush-tests (Files): Likewise.
* modules/flock-tests (Files): Likewise.
* modules/floorf-tests (Files): Likewise.
* modules/floorl-tests (Files): Likewise.
* modules/fnmatch-tests (Files): Likewise.
* modules/fopen-tests (Files): Likewise.
* modules/fprintf-posix-tests (Files): Likewise.
* modules/freopen-tests (Files): Likewise.
* modules/frexp-nolibm-tests (Files): Likewise.
* modules/frexp-tests (Files): Likewise.
* modules/frexpl-nolibm-tests (Files): Likewise.
* modules/frexpl-tests (Files): Likewise.
* modules/fseek-tests (Files): Likewise.
* modules/fseeko-tests (Files): Likewise.
* modules/fsync-tests (Files): Likewise.
* modules/ftell-tests (Files): Likewise.
* modules/ftello-tests (Files): Likewise.
* modules/futimens-tests (Files): Likewise.
* modules/getaddrinfo-tests (Files): Likewise.
* modules/getcwd-tests (Files): Likewise.
* modules/getdelim-tests (Files): Likewise.
* modules/getdtablesize-tests (Files): Likewise.
* modules/getgroups-tests (Files): Likewise.
* modules/gethostname-tests (Files): Likewise.
* modules/getline-tests (Files): Likewise.
* modules/getopt-posix-tests (Files): Likewise.
* modules/gettimeofday-tests (Files): Likewise.
* modules/glob-tests (Files): Likewise.
* modules/iconv-tests (Files): Likewise.
* modules/inet_ntop-tests (Files): Likewise.
* modules/inet_pton-tests (Files): Likewise.
* modules/isblank-tests (Files): Likewise.
* modules/lchown-tests (Files): Likewise.
* modules/ldexpl-tests (Files): Likewise.
* modules/link-tests (Files): Likewise.
* modules/linkat-tests (Files): Likewise.
* modules/lseek-tests (Files): Likewise.
* modules/lstat-tests (Files): Likewise.
* modules/mbrtowc-tests (Files): Likewise.
* modules/mbsinit-tests (Files): Likewise.
* modules/mbsnrtowcs-tests (Files): Likewise.
* modules/mbsrtowcs-tests (Files): Likewise.
* modules/memchr-tests (Files): Likewise.
* modules/memcmp-tests (Files): Likewise.
* modules/memmem-tests (Files): Likewise.
* modules/memrchr-tests (Files): Likewise.
* modules/mkdir-tests (Files): Likewise.
* modules/mkfifo-tests (Files): Likewise.
* modules/mkfifoat-tests (Files): Likewise.
* modules/mknod-tests (Files): Likewise.
* modules/nanosleep-tests (Files): Likewise.
* modules/nl_langinfo-tests (Files): Likewise.
* modules/obstack-printf-tests (Files): Likewise.
* modules/open-tests (Files): Likewise.
* modules/openat-tests (Files): Likewise.
* modules/perror-tests (Files): Likewise.
* modules/pipe2-tests (Files): Likewise.
* modules/poll-tests (Files): Likewise.
* modules/popen-tests (Files): Likewise.
* modules/posix_spawn-tests (Files): Likewise.
* modules/posix_spawnp-tests (Files): Likewise.
* modules/pread-tests (Files): Likewise.
* modules/printf-posix-tests (Files): Likewise.
* modules/pty-tests (Files): Likewise.
* modules/random_r-tests (Files): Likewise.
* modules/rawmemchr-tests (Files): Likewise.
* modules/readlink-tests (Files): Likewise.
* modules/remove-tests (Files): Likewise.
* modules/rename-tests (Files): Likewise.
* modules/renameat-tests (Files): Likewise.
* modules/rmdir-tests (Files): Likewise.
* modules/round-tests (Files): Likewise.
* modules/roundf-tests (Files): Likewise.
* modules/roundl-tests (Files): Likewise.
* modules/select-tests (Files): Likewise.
* modules/setenv-tests (Files): Likewise.
* modules/sigaction-tests (Files): Likewise.
* modules/sleep-tests (Files): Likewise.
* modules/snprintf-posix-tests (Files): Likewise.
* modules/snprintf-tests (Files): Likewise.
* modules/sprintf-posix-tests (Files): Likewise.
* modules/stat-tests (Files): Likewise.
* modules/strcasestr-tests (Files): Likewise.
* modules/strchrnul-tests (Files): Likewise.
* modules/strerror-tests (Files): Likewise.
* modules/strsignal-tests (Files): Likewise.
* modules/strstr-tests (Files): Likewise.
* modules/strtod-tests (Files): Likewise.
* modules/strverscmp-tests (Files): Likewise.
* modules/symlink-tests (Files): Likewise.
* modules/symlinkat-tests (Files): Likewise.
* modules/times-tests (Files): Likewise.
* modules/trunc-tests (Files): Likewise.
* modules/truncf-tests (Files): Likewise.
* modules/truncl-tests (Files): Likewise.
* modules/tsearch-tests (Files): Likewise.
* modules/uname-tests (Files): Likewise.
* modules/unlink-tests (Files): Likewise.
* modules/unsetenv-tests (Files): Likewise.
* modules/usleep-tests (Files): Likewise.
* modules/utimensat-tests (Files): Likewise.
* modules/vasprintf-tests (Files): Likewise.
* modules/vdprintf-posix-tests (Files): Likewise.
* modules/vfprintf-posix-tests (Files): Likewise.
* modules/vprintf-posix-tests (Files): Likewise.
* modules/vsnprintf-posix-tests (Files): Likewise.
* modules/vsnprintf-tests (Files): Likewise.
* modules/vsprintf-posix-tests (Files): Likewise.
* modules/wcrtomb-tests (Files): Likewise.
* modules/wcsnrtombs-tests (Files): Likewise.
* modules/wcsrtombs-tests (Files): Likewise.
* modules/wcwidth-tests (Files): Likewise.
* tests/test-isfinite.c (isfinite): Ensure macro declaration.
* tests/test-isinf.c (isinf): Likewise.
* tests/test-isnan.c (isnan): Likewise.
* tests/test-signbit.c (signbit): Likewise.
* tests/test-select.c (FD_CLR, FD_ISSET, FD_SET, FD_ZERO): Ensure
declaration, either as macro or with correct signature.
(select): Ensure function under test is declared with correct
signature in correct header.
* tests/test-atexit.c (atexit): Likewise.
* tests/test-btowc.c (btowc): Likewise.
* tests/test-canonicalize-lgpl.c (realpath)
(canonicalize_file_name): Likewise.
* tests/test-ceilf1.c (ceilf): Likewise.
* tests/test-ceill.c (ceill): Likewise.
* tests/test-chown.c (chown): Likewise.
* tests/test-dprintf-posix.c (dprintf): Likewise.
* tests/test-dup2.c (dup2): Likewise.
* tests/test-dup3.c (dup3): Likewise.
* tests/test-duplocale.c (duplocale): Likewise.
* tests/test-fchdir.c (fchdir): Likewise.
* tests/test-fchownat.c (fchownat): Likewise.
* tests/test-fcntl.c (fcntl): Likewise.
* tests/test-fdopendir.c (fdopendir): Likewise.
* tests/test-fflush.c (fflush): Likewise.
* tests/test-flock.c (flock): Likewise.
* tests/test-floorf1.c (floorf): Likewise.
* tests/test-floorl.c (floorl): Likewise.
* tests/test-fnmatch.c (fnmatch): Likewise.
* tests/test-fopen.c (fopen): Likewise.
* tests/test-fprintf-posix.c (fprintf): Likewise.
* tests/test-freopen.c (freopen): Likewise.
* tests/test-frexp.c (frexp): Likewise.
* tests/test-frexpl.c (frexpl): Likewise.
* tests/test-fseek.c (fseek): Likewise.
* tests/test-fseeko.c (fseeko): Likewise.
* tests/test-fstatat.c (fstatat): Likewise.
* tests/test-fsync.c (fsync): Likewise.
* tests/test-ftell.c (ftell): Likewise.
* tests/test-ftello.c (ftello): Likewise.
* tests/test-futimens.c (futimens): Likewise.
* tests/test-getaddrinfo.c (getaddrinfo, freeaddrinfo)
(gai_strerror): Likewise.
* tests/test-getcwd.c (getcwd): Likewise.
* tests/test-getdelim.c (getdelim): Likewise.
* tests/test-getdtablesize.c (getdtablesize): Likewise.
* tests/test-getgroups.c (getgroups): Likewise.
* tests/test-gethostname.c (gethostname): Likewise.
* tests/test-getline.c (getline): Likewise.
* tests/test-getopt.c (getopt, getopt_long, getopt_long_only):
Likewise.
* tests/test-gettimeofday.c (gettimeofday): Likewise.
* tests/test-glob.c (glob, globfree): Likewise.
* tests/test-iconv.c (iconv, iconv_open, iconv_close): Likewise.
* tests/test-inet_ntop.c (inet_ntop): Likewise.
* tests/test-inet_pton.c (inet_pton): Likewise.
* tests/test-isblank.c (isblank): Likewise.
* tests/test-lchown.c (lchown): Likewise.
* tests/test-ldexpl.c (ldexpl): Likewise.
* tests/test-link.c (link): Likewise.
* tests/test-linkat.c (linkat): Likewise.
* tests/test-lseek.c (lseek): Likewise.
* tests/test-lstat.c (lstat): Likewise.
* tests/test-mbrtowc.c (mbrtowc): Likewise.
* tests/test-mbsinit.c (mbsinit): Likewise.
* tests/test-mbsnrtowcs.c (mbsnrtowcs): Likewise.
* tests/test-mbsrtowcs.c (mbsrtowcs): Likewise.
* tests/test-memchr.c (memchr): Likewise.
* tests/test-memcmp.c (memcmp): Likewise.
* tests/test-memmem.c (memmem): Likewise.
* tests/test-memrchr.c (memrchr): Likewise.
* tests/test-mkdir.c (mkdir): Likewise.
* tests/test-mkdirat.c (mkdirat): Likewise.
* tests/test-mkfifo.c (mkfifo): Likewise.
* tests/test-mkfifoat.c (mkfifoat, mknodat): Likewise.
* tests/test-mknod.c (mknod): Likewise.
* tests/test-nanosleep.c (nanosleep): Likewise.
* tests/test-nl_langinfo.c (nl_langinfo): Likewise.
* tests/test-obstack-printf.c (obstack_printf, obstack_vprintf):
Likewise.
* tests/test-open.c (open): Likewise.
* tests/test-openat.c (openat): Likewise.
* tests/test-perror.c (perror): Likewise.
* tests/test-pipe2.c (pipe2): Likewise.
* tests/test-poll.c (poll): Likewise.
* tests/test-popen.c (popen, pclose): Likewise.
* tests/test-posix_spawn1.c (posix_spawnp, posix_spawnattr_init)
(posix_spawnattr_destroy, posix_spawnattr_setsigmask)
(posix_spawnattr_setflags, posix_spawn_file_actions_init)
(posix_spawn_file_actions_destroy)
(posix_spawn_file_actions_addclose)
(posix_spawn_file_actions_addopen)
(posix_spawn_file_actions_adddup2): Likewise.
* tests/test-posix_spawn3.c (posix_spawn): Likewise.
* tests/test-pread.c (pread): Likewise.
* tests/test-printf-posix.c (printf): Likewise.
* tests/test-pty.c (openpty, forkpty): Likewise.
* tests/test-random_r.c (srandom_r, initstate_r, setstate_r)
(random_r): Likewise.
* tests/test-rawmemchr.c (rawmemchr): Likewise.
* tests/test-readlink.c (readlink): Likewise.
* tests/test-remove.c (remove): Likewise.
* tests/test-rename.c (rename): Likewise.
* tests/test-renameat.c (renameat): Likewise.
* tests/test-rmdir.c (rmdir): Likewise.
* tests/test-round1.c (round): Likewise.
* tests/test-roundf1.c (roundf): Likewise.
* tests/test-roundl.c (roundl): Likewise.
* tests/test-setenv.c (setenv): Likewise.
* tests/test-sigaction.c (sigaction): Likewise.
* tests/test-sleep.c (sleep): Likewise.
* tests/test-snprintf.c (snprintf): Likewise.
* tests/test-sprintf-posix.c (sprintf): Likewise.
* tests/test-stat.c (stat): Likewise.
* tests/test-stpncpy.c (stpncpy): Likewise.
* tests/test-strcasestr.c (strcasestr): Likewise.
* tests/test-strchrnul.c (strchrnul): Likewise.
* tests/test-strerror.c (strerror): Likewise.
* tests/test-strsignal.c (strsignal): Likewise.
* tests/test-strstr.c (strstr): Likewise.
* tests/test-strtod.c (strtod): Likewise.
* tests/test-strverscmp.c (strverscmp): Likewise.
* tests/test-symlink.c (symlink): Likewise.
* tests/test-symlinkat.c (symlinkat, readlinkat): Likewise.
* tests/test-times.c (times): Likewise.
* tests/test-trunc1.c (trunc): Likewise.
* tests/test-truncf1.c (truncf): Likewise.
* tests/test-truncl.c (truncl): Likewise.
* tests/test-tsearch.c (tdelete, tfind, tsearch, twalk):
Likewise.
* tests/test-uname.c (uname): Likewise.
* tests/test-unlink.c (unlink): Likewise.
* tests/test-unlinkat.c (unlinkat): Likewise.
* tests/test-unsetenv.c (unsetenv): Likewise.
* tests/test-usleep.c (usleep): Likewise.
* tests/test-utimensat.c (utimensat): Likewise.
* tests/test-vasprintf.c (asprintf, vasprintf): Likewise.
* tests/test-vdprintf-posix.c (vdprintf): Likewise.
* tests/test-vfprintf-posix.c (vfprintf): Likewise.
* tests/test-vprintf-posix.c (vprintf): Likewise.
* tests/test-vsnprintf.c (vsnprintf): Likewise.
* tests/test-vsprintf-posix.c (vsprintf): Likewise.
* tests/test-wcrtomb.c (wcrtomb): Likewise.
* tests/test-wcsnrtombs.c (wcsnrtombs): Likewise.
* tests/test-wcsrtombs.c (wcsrtombs): Likewise.
* tests/test-wcwidth.c (wcwidth): Likewise.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 275 ++++++++++++++++++++++++++++++++++++++++++++
modules/atexit-tests | 1 +
modules/getopt-posix-tests | 1 +
tests/signature.h | 48 ++++++++
tests/test-atexit.c | 6 +-
tests/test-getopt.c | 16 +++
6 files changed, 346 insertions(+), 1 deletions(-)
create mode 100644 tests/signature.h
diff --git a/ChangeLog b/ChangeLog
index 43bf844..e24c86f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,278 @@
+2009-12-23 Eric Blake <address@hidden>
+
+ tests: add signature checks
+ * tests/signature.h (SIGNATURE_CHECK): New file.
+ * modules/atexit-tests (Files): Use it.
+ * modules/btowc-tests (Files): Likewise.
+ * modules/canonicalize-lgpl-tests (Files): Likewise.
+ * modules/ceilf-tests (Files): Likewise.
+ * modules/ceill-tests (Files): Likewise.
+ * modules/chown-tests (Files): Likewise.
+ * modules/dprintf-posix-tests (Files): Likewise.
+ * modules/dup2-tests (Files): Likewise.
+ * modules/dup3-tests (Files): Likewise.
+ * modules/duplocale-tests (Files): Likewise.
+ * modules/fchdir-tests (Files): Likewise.
+ * modules/fcntl-tests (Files): Likewise.
+ * modules/fdopendir-tests (Files): Likewise.
+ * modules/fflush-tests (Files): Likewise.
+ * modules/flock-tests (Files): Likewise.
+ * modules/floorf-tests (Files): Likewise.
+ * modules/floorl-tests (Files): Likewise.
+ * modules/fnmatch-tests (Files): Likewise.
+ * modules/fopen-tests (Files): Likewise.
+ * modules/fprintf-posix-tests (Files): Likewise.
+ * modules/freopen-tests (Files): Likewise.
+ * modules/frexp-nolibm-tests (Files): Likewise.
+ * modules/frexp-tests (Files): Likewise.
+ * modules/frexpl-nolibm-tests (Files): Likewise.
+ * modules/frexpl-tests (Files): Likewise.
+ * modules/fseek-tests (Files): Likewise.
+ * modules/fseeko-tests (Files): Likewise.
+ * modules/fsync-tests (Files): Likewise.
+ * modules/ftell-tests (Files): Likewise.
+ * modules/ftello-tests (Files): Likewise.
+ * modules/futimens-tests (Files): Likewise.
+ * modules/getaddrinfo-tests (Files): Likewise.
+ * modules/getcwd-tests (Files): Likewise.
+ * modules/getdelim-tests (Files): Likewise.
+ * modules/getdtablesize-tests (Files): Likewise.
+ * modules/getgroups-tests (Files): Likewise.
+ * modules/gethostname-tests (Files): Likewise.
+ * modules/getline-tests (Files): Likewise.
+ * modules/getopt-posix-tests (Files): Likewise.
+ * modules/gettimeofday-tests (Files): Likewise.
+ * modules/glob-tests (Files): Likewise.
+ * modules/iconv-tests (Files): Likewise.
+ * modules/inet_ntop-tests (Files): Likewise.
+ * modules/inet_pton-tests (Files): Likewise.
+ * modules/isblank-tests (Files): Likewise.
+ * modules/lchown-tests (Files): Likewise.
+ * modules/ldexpl-tests (Files): Likewise.
+ * modules/link-tests (Files): Likewise.
+ * modules/linkat-tests (Files): Likewise.
+ * modules/lseek-tests (Files): Likewise.
+ * modules/lstat-tests (Files): Likewise.
+ * modules/mbrtowc-tests (Files): Likewise.
+ * modules/mbsinit-tests (Files): Likewise.
+ * modules/mbsnrtowcs-tests (Files): Likewise.
+ * modules/mbsrtowcs-tests (Files): Likewise.
+ * modules/memchr-tests (Files): Likewise.
+ * modules/memcmp-tests (Files): Likewise.
+ * modules/memmem-tests (Files): Likewise.
+ * modules/memrchr-tests (Files): Likewise.
+ * modules/mkdir-tests (Files): Likewise.
+ * modules/mkfifo-tests (Files): Likewise.
+ * modules/mkfifoat-tests (Files): Likewise.
+ * modules/mknod-tests (Files): Likewise.
+ * modules/nanosleep-tests (Files): Likewise.
+ * modules/nl_langinfo-tests (Files): Likewise.
+ * modules/obstack-printf-tests (Files): Likewise.
+ * modules/open-tests (Files): Likewise.
+ * modules/openat-tests (Files): Likewise.
+ * modules/perror-tests (Files): Likewise.
+ * modules/pipe2-tests (Files): Likewise.
+ * modules/poll-tests (Files): Likewise.
+ * modules/popen-tests (Files): Likewise.
+ * modules/posix_spawn-tests (Files): Likewise.
+ * modules/posix_spawnp-tests (Files): Likewise.
+ * modules/pread-tests (Files): Likewise.
+ * modules/printf-posix-tests (Files): Likewise.
+ * modules/pty-tests (Files): Likewise.
+ * modules/random_r-tests (Files): Likewise.
+ * modules/rawmemchr-tests (Files): Likewise.
+ * modules/readlink-tests (Files): Likewise.
+ * modules/remove-tests (Files): Likewise.
+ * modules/rename-tests (Files): Likewise.
+ * modules/renameat-tests (Files): Likewise.
+ * modules/rmdir-tests (Files): Likewise.
+ * modules/round-tests (Files): Likewise.
+ * modules/roundf-tests (Files): Likewise.
+ * modules/roundl-tests (Files): Likewise.
+ * modules/select-tests (Files): Likewise.
+ * modules/setenv-tests (Files): Likewise.
+ * modules/sigaction-tests (Files): Likewise.
+ * modules/sleep-tests (Files): Likewise.
+ * modules/snprintf-posix-tests (Files): Likewise.
+ * modules/snprintf-tests (Files): Likewise.
+ * modules/sprintf-posix-tests (Files): Likewise.
+ * modules/stat-tests (Files): Likewise.
+ * modules/strcasestr-tests (Files): Likewise.
+ * modules/strchrnul-tests (Files): Likewise.
+ * modules/strerror-tests (Files): Likewise.
+ * modules/strsignal-tests (Files): Likewise.
+ * modules/strstr-tests (Files): Likewise.
+ * modules/strtod-tests (Files): Likewise.
+ * modules/strverscmp-tests (Files): Likewise.
+ * modules/symlink-tests (Files): Likewise.
+ * modules/symlinkat-tests (Files): Likewise.
+ * modules/times-tests (Files): Likewise.
+ * modules/trunc-tests (Files): Likewise.
+ * modules/truncf-tests (Files): Likewise.
+ * modules/truncl-tests (Files): Likewise.
+ * modules/tsearch-tests (Files): Likewise.
+ * modules/uname-tests (Files): Likewise.
+ * modules/unlink-tests (Files): Likewise.
+ * modules/unsetenv-tests (Files): Likewise.
+ * modules/usleep-tests (Files): Likewise.
+ * modules/utimensat-tests (Files): Likewise.
+ * modules/vasprintf-tests (Files): Likewise.
+ * modules/vdprintf-posix-tests (Files): Likewise.
+ * modules/vfprintf-posix-tests (Files): Likewise.
+ * modules/vprintf-posix-tests (Files): Likewise.
+ * modules/vsnprintf-posix-tests (Files): Likewise.
+ * modules/vsnprintf-tests (Files): Likewise.
+ * modules/vsprintf-posix-tests (Files): Likewise.
+ * modules/wcrtomb-tests (Files): Likewise.
+ * modules/wcsnrtombs-tests (Files): Likewise.
+ * modules/wcsrtombs-tests (Files): Likewise.
+ * modules/wcwidth-tests (Files): Likewise.
+ * tests/test-isfinite.c (isfinite): Ensure macro declaration.
+ * tests/test-isinf.c (isinf): Likewise.
+ * tests/test-isnan.c (isnan): Likewise.
+ * tests/test-signbit.c (signbit): Likewise.
+ * tests/test-select.c (FD_CLR, FD_ISSET, FD_SET, FD_ZERO): Ensure
+ declaration, either as macro or with correct signature.
+ (select): Ensure function under test is declared with correct
+ signature in correct header.
+ * tests/test-atexit.c (atexit): Likewise.
+ * tests/test-btowc.c (btowc): Likewise.
+ * tests/test-canonicalize-lgpl.c (realpath)
+ (canonicalize_file_name): Likewise.
+ * tests/test-ceilf1.c (ceilf): Likewise.
+ * tests/test-ceill.c (ceill): Likewise.
+ * tests/test-chown.c (chown): Likewise.
+ * tests/test-dprintf-posix.c (dprintf): Likewise.
+ * tests/test-dup2.c (dup2): Likewise.
+ * tests/test-dup3.c (dup3): Likewise.
+ * tests/test-duplocale.c (duplocale): Likewise.
+ * tests/test-fchdir.c (fchdir): Likewise.
+ * tests/test-fchownat.c (fchownat): Likewise.
+ * tests/test-fcntl.c (fcntl): Likewise.
+ * tests/test-fdopendir.c (fdopendir): Likewise.
+ * tests/test-fflush.c (fflush): Likewise.
+ * tests/test-flock.c (flock): Likewise.
+ * tests/test-floorf1.c (floorf): Likewise.
+ * tests/test-floorl.c (floorl): Likewise.
+ * tests/test-fnmatch.c (fnmatch): Likewise.
+ * tests/test-fopen.c (fopen): Likewise.
+ * tests/test-fprintf-posix.c (fprintf): Likewise.
+ * tests/test-freopen.c (freopen): Likewise.
+ * tests/test-frexp.c (frexp): Likewise.
+ * tests/test-frexpl.c (frexpl): Likewise.
+ * tests/test-fseek.c (fseek): Likewise.
+ * tests/test-fseeko.c (fseeko): Likewise.
+ * tests/test-fstatat.c (fstatat): Likewise.
+ * tests/test-fsync.c (fsync): Likewise.
+ * tests/test-ftell.c (ftell): Likewise.
+ * tests/test-ftello.c (ftello): Likewise.
+ * tests/test-futimens.c (futimens): Likewise.
+ * tests/test-getaddrinfo.c (getaddrinfo, freeaddrinfo)
+ (gai_strerror): Likewise.
+ * tests/test-getcwd.c (getcwd): Likewise.
+ * tests/test-getdelim.c (getdelim): Likewise.
+ * tests/test-getdtablesize.c (getdtablesize): Likewise.
+ * tests/test-getgroups.c (getgroups): Likewise.
+ * tests/test-gethostname.c (gethostname): Likewise.
+ * tests/test-getline.c (getline): Likewise.
+ * tests/test-getopt.c (getopt, getopt_long, getopt_long_only):
+ Likewise.
+ * tests/test-gettimeofday.c (gettimeofday): Likewise.
+ * tests/test-glob.c (glob, globfree): Likewise.
+ * tests/test-iconv.c (iconv, iconv_open, iconv_close): Likewise.
+ * tests/test-inet_ntop.c (inet_ntop): Likewise.
+ * tests/test-inet_pton.c (inet_pton): Likewise.
+ * tests/test-isblank.c (isblank): Likewise.
+ * tests/test-lchown.c (lchown): Likewise.
+ * tests/test-ldexpl.c (ldexpl): Likewise.
+ * tests/test-link.c (link): Likewise.
+ * tests/test-linkat.c (linkat): Likewise.
+ * tests/test-lseek.c (lseek): Likewise.
+ * tests/test-lstat.c (lstat): Likewise.
+ * tests/test-mbrtowc.c (mbrtowc): Likewise.
+ * tests/test-mbsinit.c (mbsinit): Likewise.
+ * tests/test-mbsnrtowcs.c (mbsnrtowcs): Likewise.
+ * tests/test-mbsrtowcs.c (mbsrtowcs): Likewise.
+ * tests/test-memchr.c (memchr): Likewise.
+ * tests/test-memcmp.c (memcmp): Likewise.
+ * tests/test-memmem.c (memmem): Likewise.
+ * tests/test-memrchr.c (memrchr): Likewise.
+ * tests/test-mkdir.c (mkdir): Likewise.
+ * tests/test-mkdirat.c (mkdirat): Likewise.
+ * tests/test-mkfifo.c (mkfifo): Likewise.
+ * tests/test-mkfifoat.c (mkfifoat, mknodat): Likewise.
+ * tests/test-mknod.c (mknod): Likewise.
+ * tests/test-nanosleep.c (nanosleep): Likewise.
+ * tests/test-nl_langinfo.c (nl_langinfo): Likewise.
+ * tests/test-obstack-printf.c (obstack_printf, obstack_vprintf):
+ Likewise.
+ * tests/test-open.c (open): Likewise.
+ * tests/test-openat.c (openat): Likewise.
+ * tests/test-perror.c (perror): Likewise.
+ * tests/test-pipe2.c (pipe2): Likewise.
+ * tests/test-poll.c (poll): Likewise.
+ * tests/test-popen.c (popen, pclose): Likewise.
+ * tests/test-posix_spawn1.c (posix_spawnp, posix_spawnattr_init)
+ (posix_spawnattr_destroy, posix_spawnattr_setsigmask)
+ (posix_spawnattr_setflags, posix_spawn_file_actions_init)
+ (posix_spawn_file_actions_destroy)
+ (posix_spawn_file_actions_addclose)
+ (posix_spawn_file_actions_addopen)
+ (posix_spawn_file_actions_adddup2): Likewise.
+ * tests/test-posix_spawn3.c (posix_spawn): Likewise.
+ * tests/test-pread.c (pread): Likewise.
+ * tests/test-printf-posix.c (printf): Likewise.
+ * tests/test-pty.c (openpty, forkpty): Likewise.
+ * tests/test-random_r.c (srandom_r, initstate_r, setstate_r)
+ (random_r): Likewise.
+ * tests/test-rawmemchr.c (rawmemchr): Likewise.
+ * tests/test-readlink.c (readlink): Likewise.
+ * tests/test-remove.c (remove): Likewise.
+ * tests/test-rename.c (rename): Likewise.
+ * tests/test-renameat.c (renameat): Likewise.
+ * tests/test-rmdir.c (rmdir): Likewise.
+ * tests/test-round1.c (round): Likewise.
+ * tests/test-roundf1.c (roundf): Likewise.
+ * tests/test-roundl.c (roundl): Likewise.
+ * tests/test-setenv.c (setenv): Likewise.
+ * tests/test-sigaction.c (sigaction): Likewise.
+ * tests/test-sleep.c (sleep): Likewise.
+ * tests/test-snprintf.c (snprintf): Likewise.
+ * tests/test-sprintf-posix.c (sprintf): Likewise.
+ * tests/test-stat.c (stat): Likewise.
+ * tests/test-stpncpy.c (stpncpy): Likewise.
+ * tests/test-strcasestr.c (strcasestr): Likewise.
+ * tests/test-strchrnul.c (strchrnul): Likewise.
+ * tests/test-strerror.c (strerror): Likewise.
+ * tests/test-strsignal.c (strsignal): Likewise.
+ * tests/test-strstr.c (strstr): Likewise.
+ * tests/test-strtod.c (strtod): Likewise.
+ * tests/test-strverscmp.c (strverscmp): Likewise.
+ * tests/test-symlink.c (symlink): Likewise.
+ * tests/test-symlinkat.c (symlinkat, readlinkat): Likewise.
+ * tests/test-times.c (times): Likewise.
+ * tests/test-trunc1.c (trunc): Likewise.
+ * tests/test-truncf1.c (truncf): Likewise.
+ * tests/test-truncl.c (truncl): Likewise.
+ * tests/test-tsearch.c (tdelete, tfind, tsearch, twalk):
+ Likewise.
+ * tests/test-uname.c (uname): Likewise.
+ * tests/test-unlink.c (unlink): Likewise.
+ * tests/test-unlinkat.c (unlinkat): Likewise.
+ * tests/test-unsetenv.c (unsetenv): Likewise.
+ * tests/test-usleep.c (usleep): Likewise.
+ * tests/test-utimensat.c (utimensat): Likewise.
+ * tests/test-vasprintf.c (asprintf, vasprintf): Likewise.
+ * tests/test-vdprintf-posix.c (vdprintf): Likewise.
+ * tests/test-vfprintf-posix.c (vfprintf): Likewise.
+ * tests/test-vprintf-posix.c (vprintf): Likewise.
+ * tests/test-vsnprintf.c (vsnprintf): Likewise.
+ * tests/test-vsprintf-posix.c (vsprintf): Likewise.
+ * tests/test-wcrtomb.c (wcrtomb): Likewise.
+ * tests/test-wcsnrtombs.c (wcsnrtombs): Likewise.
+ * tests/test-wcsrtombs.c (wcsrtombs): Likewise.
+ * tests/test-wcwidth.c (wcwidth): Likewise.
+
2009-12-24 Eric Blake <address@hidden>
build: pull in conditional headers during GNULIB_POSIXCHECK
diff --git a/modules/atexit-tests b/modules/atexit-tests
index 8ad8189..15de834 100644
--- a/modules/atexit-tests
+++ b/modules/atexit-tests
@@ -1,4 +1,5 @@
Files:
+tests/signature.h
tests/test-atexit.sh
tests/test-atexit.c
diff --git a/modules/getopt-posix-tests b/modules/getopt-posix-tests
index b2e3727..438b6e4 100644
--- a/modules/getopt-posix-tests
+++ b/modules/getopt-posix-tests
@@ -1,4 +1,5 @@
Files:
+tests/signature.h
tests/test-getopt.c
tests/test-getopt.h
tests/test-getopt_long.h
diff --git a/tests/signature.h b/tests/signature.h
new file mode 100644
index 0000000..3e03a4b
--- /dev/null
+++ b/tests/signature.h
@@ -0,0 +1,48 @@
+/* Macro for checking that a function declaration is compliant.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef SIGNATURE_CHECK
+
+/* Check that the function FN takes the specified arguments ARGS with
+ a return type of RET. This header is designed to be included after
+ <config.h> and the one system header that is supposed to contain
+ the function being checked, but prior to any other system headers
+ that are necessary for the unit test. Therefore, this file does
+ not include any system headers, nor reference anything outside of
+ the macro arguments. For an example, if foo.h should provide:
+
+ extern int foo (char, float);
+
+ then the unit test named test-foo.c would start out with:
+
+ #include <config.h>
+ #include <foo.h>
+ #include "signature.h"
+ SIGNATURE_CHECK (foo, int, (char, float));
+ #include <other.h>
+ ...
+*/
+# define SIGNATURE_CHECK(fn, ret, args) \
+ SIGNATURE_CHECK1 (fn, ret, args, __LINE__)
+
+/* Necessary to allow multiple SIGNATURE_CHECK lines in a unit test.
+ Note that the checks must not occupy the same line. */
+# define SIGNATURE_CHECK1(fn, ret, args, id) \
+ SIGNATURE_CHECK2 (fn, ret, args, id) /* macroexpand line */
+# define SIGNATURE_CHECK2(fn, ret, args, id) \
+ static ret (* _GL_UNUSED signature_check ## id) args = fn
+
+#endif
diff --git a/tests/test-atexit.c b/tests/test-atexit.c
index 97afff5..c815b2d 100644
--- a/tests/test-atexit.c
+++ b/tests/test-atexit.c
@@ -1,5 +1,5 @@
/* Test of execution of program termination handlers.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,6 +19,10 @@
#include <config.h>
#include <stdlib.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (atexit, int, (void (*) (void)));
+
#include <unistd.h>
#define TEMPFILE "t-atexit.tmp"
diff --git a/tests/test-getopt.c b/tests/test-getopt.c
index 6811a02..9502a44 100644
--- a/tests/test-getopt.c
+++ b/tests/test-getopt.c
@@ -27,9 +27,25 @@
#if GNULIB_GETOPT_GNU
# include <getopt.h>
+
+# ifndef __getopt_argv_const
+# define __getopt_argv_const const
+# endif
+# include "signature.h"
+SIGNATURE_CHECK (getopt_long, int, (int, char *__getopt_argv_const *,
+ char const *, struct option const *,
+ int *));
+SIGNATURE_CHECK (getopt_long_only, int, (int, char *__getopt_argv_const *,
+ char const *, struct option const *,
+ int *));
+
#endif
+
#include <unistd.h>
+#include "signature.h"
+SIGNATURE_CHECK (getopt, int, (int, char * const[], char const *));
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
--
1.6.4.2
- Re: new module 'unused-parameter', (continued)
- Re: stdlib tweak, Jim Meyering, 2009/12/23
- Re: stdlib tweak, Bruno Haible, 2009/12/23
- Re: stdlib tweak, Eric Blake, 2009/12/23
- Re: stdlib tweak, Eric Blake, 2009/12/23
- Re: ASSERT and SIGNATURE_CHECK macros, Bruno Haible, 2009/12/23
- Re: ASSERT and SIGNATURE_CHECK macros, Eric Blake, 2009/12/23
- Re: ASSERT and SIGNATURE_CHECK macros,
Eric Blake <=
- Re: ASSERT and SIGNATURE_CHECK macros, Jim Meyering, 2009/12/24
- Re: SIGNATURE_CHECK, Bruno Haible, 2009/12/24
- Re: SIGNATURE_CHECK, Eric Blake, 2009/12/24
- Re: SIGNATURE_CHECK, Bruno Haible, 2009/12/24
- Re: SIGNATURE_CHECK, Eric Blake, 2009/12/24
- Re: ASSERT macro, Bruno Haible, 2009/12/24
- SIZEOF macro (was: ASSERT macro), Eric Blake, 2009/12/24
- Re: SIZEOF macro, Eric Blake, 2009/12/24
- Re: SIZEOF macro, Jim Meyering, 2009/12/25
- Re: SIZEOF macro, Jim Meyering, 2009/12/25