diff options
Diffstat (limited to 'tests')
131 files changed, 600 insertions, 39 deletions
diff --git a/tests/signature.h b/tests/signature.h new file mode 100644 index 0000000000..bf1bb86e27 --- /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 /* SIGNATURE_CHECK */ diff --git a/tests/test-atexit.c b/tests/test-atexit.c index 97afff5f8b..c815b2db09 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-btowc.c b/tests/test-btowc.c index b447d05a1e..4a19553310 100644 --- a/tests/test-btowc.c +++ b/tests/test-btowc.c @@ -1,5 +1,5 @@ /* Test of conversion of unibyte character to wide character. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 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 @@ -20,6 +20,9 @@ #include <wchar.h> +#include "signature.h" +SIGNATURE_CHECK (btowc, wint_t, (int)); + #include <locale.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-canonicalize-lgpl.c b/tests/test-canonicalize-lgpl.c index 7667983da5..4f4fca18b4 100644 --- a/tests/test-canonicalize-lgpl.c +++ b/tests/test-canonicalize-lgpl.c @@ -20,6 +20,10 @@ #include <stdlib.h> +#include "signature.h" +SIGNATURE_CHECK (realpath, char *, (const char *, char *)); +SIGNATURE_CHECK (canonicalize_file_name, char *, (const char *)); + #include <errno.h> #include <fcntl.h> #include <stdio.h> diff --git a/tests/test-ceilf1.c b/tests/test-ceilf1.c index 32419366bc..e180e95f8a 100644 --- a/tests/test-ceilf1.c +++ b/tests/test-ceilf1.c @@ -1,5 +1,5 @@ /* Test of rounding towards positive infinity. - Copyright (C) 2007-2008 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 @@ -20,6 +20,9 @@ #include <math.h> +#include "signature.h" +SIGNATURE_CHECK (ceilf, float, (float)); + #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-ceill.c b/tests/test-ceill.c index 764d2beafe..2ed0053311 100644 --- a/tests/test-ceill.c +++ b/tests/test-ceill.c @@ -20,6 +20,9 @@ #include <math.h> +#include "signature.h" +SIGNATURE_CHECK (ceill, long double, (long double)); + #include <float.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-chown.c b/tests/test-chown.c index 4265970808..e7660707ea 100644 --- a/tests/test-chown.c +++ b/tests/test-chown.c @@ -20,6 +20,9 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (chown, int, (char const *, uid_t, gid_t)); + #include <fcntl.h> #include <errno.h> #include <stdbool.h> diff --git a/tests/test-dprintf-posix.c b/tests/test-dprintf-posix.c index 384d1efafc..9cedc1c62a 100644 --- a/tests/test-dprintf-posix.c +++ b/tests/test-dprintf-posix.c @@ -20,6 +20,9 @@ #include <stdio.h> +#include "signature.h" +SIGNATURE_CHECK (dprintf, int, (int, const char *, ...)); + #include <stddef.h> #include <stdint.h> #include <stdlib.h> diff --git a/tests/test-dup2.c b/tests/test-dup2.c index b22d1e6a58..a4aca82dfb 100644 --- a/tests/test-dup2.c +++ b/tests/test-dup2.c @@ -20,6 +20,9 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (dup2, int, (int, int)); + #include <errno.h> #include <fcntl.h> #include <stdio.h> diff --git a/tests/test-dup3.c b/tests/test-dup3.c index 41fc16ded6..9133b7bf4b 100644 --- a/tests/test-dup3.c +++ b/tests/test-dup3.c @@ -21,6 +21,9 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (dup3, int, (int, int, int)); + #include <errno.h> #include <fcntl.h> #include <stdbool.h> diff --git a/tests/test-duplocale.c b/tests/test-duplocale.c index 354e13e8fb..a368c07428 100644 --- a/tests/test-duplocale.c +++ b/tests/test-duplocale.c @@ -22,6 +22,9 @@ #if HAVE_DUPLOCALE +#include "signature.h" +SIGNATURE_CHECK (duplocale, locale_t, (locale_t)); + #include <langinfo.h> #include <monetary.h> #include <stdio.h> diff --git a/tests/test-fchdir.c b/tests/test-fchdir.c index 75819ebe6d..7ec675e7da 100644 --- a/tests/test-fchdir.c +++ b/tests/test-fchdir.c @@ -20,6 +20,9 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (fchdir, int, (int)); + #include <errno.h> #include <fcntl.h> #include <stdio.h> diff --git a/tests/test-fchownat.c b/tests/test-fchownat.c index 2dbc857ec4..c084ddf83c 100644 --- a/tests/test-fchownat.c +++ b/tests/test-fchownat.c @@ -20,6 +20,9 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (fchownat, int, (int, char const *, uid_t, gid_t, int)); + #include <fcntl.h> #include <errno.h> #include <stdbool.h> diff --git a/tests/test-fcntl.c b/tests/test-fcntl.c index c06b41e618..77ac87006e 100644 --- a/tests/test-fcntl.c +++ b/tests/test-fcntl.c @@ -21,6 +21,9 @@ /* Specification. */ #include <fcntl.h> +#include "signature.h" +SIGNATURE_CHECK (fcntl, int, (int, int, ...)); + /* Helpers. */ #include <errno.h> #include <stdarg.h> diff --git a/tests/test-fdopendir.c b/tests/test-fdopendir.c index 7e0b3ee9bc..f6006d0b8e 100644 --- a/tests/test-fdopendir.c +++ b/tests/test-fdopendir.c @@ -20,6 +20,9 @@ #include <dirent.h> +#include "signature.h" +SIGNATURE_CHECK (fdopendir, DIR *, (int)); + #include <errno.h> #include <fcntl.h> #include <stdio.h> diff --git a/tests/test-fflush.c b/tests/test-fflush.c index 8e33c9f0f6..9962d1d182 100644 --- a/tests/test-fflush.c +++ b/tests/test-fflush.c @@ -19,6 +19,10 @@ #include <config.h> #include <stdio.h> + +#include "signature.h" +SIGNATURE_CHECK (fflush, int, (FILE *)); + #include <unistd.h> int diff --git a/tests/test-flock.c b/tests/test-flock.c index babf6efea3..a8a615e9a6 100644 --- a/tests/test-flock.c +++ b/tests/test-flock.c @@ -18,6 +18,9 @@ #include <sys/file.h> +#include "signature.h" +SIGNATURE_CHECK (flock, int, (int, int)); + #include <fcntl.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-floorf1.c b/tests/test-floorf1.c index 373724a468..e156732392 100644 --- a/tests/test-floorf1.c +++ b/tests/test-floorf1.c @@ -1,5 +1,5 @@ /* Test of rounding towards negative infinity. - Copyright (C) 2007-2008 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 @@ -20,6 +20,9 @@ #include <math.h> +#include "signature.h" +SIGNATURE_CHECK (floorf, float, (float)); + #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-floorl.c b/tests/test-floorl.c index 7afea04f2a..a8080e58b0 100644 --- a/tests/test-floorl.c +++ b/tests/test-floorl.c @@ -20,6 +20,9 @@ #include <math.h> +#include "signature.h" +SIGNATURE_CHECK (floorl, long double, (long double)); + #include <float.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-fnmatch.c b/tests/test-fnmatch.c index 3e21d9d44b..f9485afcf1 100644 --- a/tests/test-fnmatch.c +++ b/tests/test-fnmatch.c @@ -20,6 +20,9 @@ #include <fnmatch.h> +#include "signature.h" +SIGNATURE_CHECK (fnmatch, int, (char const *, char const *, int)); + #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-fopen.c b/tests/test-fopen.c index 29d7839463..e7e7770137 100644 --- a/tests/test-fopen.c +++ b/tests/test-fopen.c @@ -20,6 +20,9 @@ #include <stdio.h> +#include "signature.h" +SIGNATURE_CHECK (fopen, FILE *, (char const *, char const *)); + #define BASE "test-fopen.t" #include "test-fopen.h" diff --git a/tests/test-fprintf-posix.c b/tests/test-fprintf-posix.c index 4133e40bd2..21c626ee09 100644 --- a/tests/test-fprintf-posix.c +++ b/tests/test-fprintf-posix.c @@ -1,5 +1,5 @@ /* Test of POSIX compatible fprintf() function. - Copyright (C) 2007-2008 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 @@ -20,6 +20,9 @@ #include <stdio.h> +#include "signature.h" +SIGNATURE_CHECK (fprintf, int, (FILE *, char const *, ...)); + #include <stdarg.h> #include <stddef.h> #include <stdint.h> diff --git a/tests/test-freopen.c b/tests/test-freopen.c index 23f2af5123..bdb5de0fe9 100644 --- a/tests/test-freopen.c +++ b/tests/test-freopen.c @@ -1,5 +1,5 @@ /* Test of opening a file stream. - Copyright (C) 2007-2008 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 <stdio.h> + +#include "signature.h" +SIGNATURE_CHECK (freopen, FILE *, (char const *, char const *, FILE *)); + #include <stdlib.h> #define ASSERT(expr) \ diff --git a/tests/test-frexp.c b/tests/test-frexp.c index 47ddab2970..6b285c9a94 100644 --- a/tests/test-frexp.c +++ b/tests/test-frexp.c @@ -1,5 +1,5 @@ /* Test of splitting a double into fraction and mantissa. - Copyright (C) 2007-2008 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 @@ -20,6 +20,9 @@ #include <math.h> +#include "signature.h" +SIGNATURE_CHECK (frexp, double, (double, int *)); + #include <float.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-frexpl.c b/tests/test-frexpl.c index e4367f6eae..7b7ec53941 100644 --- a/tests/test-frexpl.c +++ b/tests/test-frexpl.c @@ -20,6 +20,9 @@ #include <math.h> +#include "signature.h" +SIGNATURE_CHECK (frexpl, long double, (long double, int *)); + #include <float.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-fseek.c b/tests/test-fseek.c index 04fc966752..4447a9b6f7 100644 --- a/tests/test-fseek.c +++ b/tests/test-fseek.c @@ -19,6 +19,10 @@ #include <config.h> #include <stdio.h> + +#include "signature.h" +SIGNATURE_CHECK (fseek, int, (FILE *, long, int)); + #include <stdlib.h> #define ASSERT(expr) \ diff --git a/tests/test-fseeko.c b/tests/test-fseeko.c index bdf025f5bf..0d2f32199f 100644 --- a/tests/test-fseeko.c +++ b/tests/test-fseeko.c @@ -26,6 +26,10 @@ #endif #include <stdio.h> + +#include "signature.h" +SIGNATURE_CHECK (fseeko, int, (FILE *, off_t, int)); + #include <stdlib.h> #define ASSERT(expr) \ diff --git a/tests/test-fstatat.c b/tests/test-fstatat.c index e965997b29..552bf45f31 100644 --- a/tests/test-fstatat.c +++ b/tests/test-fstatat.c @@ -20,6 +20,9 @@ #include <sys/stat.h> +#include "signature.h" +SIGNATURE_CHECK (fstatat, int, (int, char const *, struct stat *, int)); + #include <fcntl.h> #include <errno.h> #include <stdbool.h> diff --git a/tests/test-fsync.c b/tests/test-fsync.c index 4766eb06ac..bf789a2aa6 100644 --- a/tests/test-fsync.c +++ b/tests/test-fsync.c @@ -18,6 +18,9 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (fsync, int, (int)); + #include <errno.h> #include <stdio.h> #include <fcntl.h> diff --git a/tests/test-ftell.c b/tests/test-ftell.c index 06628657a8..d9723f593b 100644 --- a/tests/test-ftell.c +++ b/tests/test-ftell.c @@ -19,6 +19,10 @@ #include <config.h> #include <stdio.h> + +#include "signature.h" +SIGNATURE_CHECK (ftell, long, (FILE *)); + #include <stdlib.h> #include "binary-io.h" diff --git a/tests/test-ftello.c b/tests/test-ftello.c index dfe5be02fc..2af43f2bc9 100644 --- a/tests/test-ftello.c +++ b/tests/test-ftello.c @@ -19,6 +19,10 @@ #include <config.h> #include <stdio.h> + +#include "signature.h" +SIGNATURE_CHECK (ftello, off_t, (FILE *)); + #include <stdlib.h> #include "binary-io.h" diff --git a/tests/test-futimens.c b/tests/test-futimens.c index 4e049bdffe..5753c6b209 100644 --- a/tests/test-futimens.c +++ b/tests/test-futimens.c @@ -20,6 +20,9 @@ #include <sys/stat.h> +#include "signature.h" +SIGNATURE_CHECK (futimens, int, (int, struct timespec const[2])); + #include <fcntl.h> #include <errno.h> #include <stdbool.h> diff --git a/tests/test-getaddrinfo.c b/tests/test-getaddrinfo.c index 7464ec2174..a7e2381ecd 100644 --- a/tests/test-getaddrinfo.c +++ b/tests/test-getaddrinfo.c @@ -18,8 +18,16 @@ /* Written by Simon Josefsson. */ #include <config.h> + #include <netdb.h> +#include "signature.h" +SIGNATURE_CHECK (freeaddrinfo, void, (struct addrinfo *)); +SIGNATURE_CHECK (gai_strerror, char const *, (int)); +SIGNATURE_CHECK (getaddrinfo, int, (char const *, char const *, + struct addrinfo const *, + struct addrinfo **)); + #include <arpa/inet.h> #include <errno.h> #include <netinet/in.h> diff --git a/tests/test-getcwd.c b/tests/test-getcwd.c index debace7df6..7570180859 100644 --- a/tests/test-getcwd.c +++ b/tests/test-getcwd.c @@ -18,6 +18,9 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (getcwd, char *, (char *, size_t)); + #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/tests/test-getdelim.c b/tests/test-getdelim.c index 8de43dbf6e..dc40bddebd 100644 --- a/tests/test-getdelim.c +++ b/tests/test-getdelim.c @@ -20,6 +20,10 @@ #include <config.h> #include <stdio.h> + +#include "signature.h" +SIGNATURE_CHECK (getdelim, ssize_t, (char **, size_t *, int, FILE *)); + #include <stdlib.h> #include <string.h> diff --git a/tests/test-getdtablesize.c b/tests/test-getdtablesize.c index 577d329efd..e587aa13de 100644 --- a/tests/test-getdtablesize.c +++ b/tests/test-getdtablesize.c @@ -1,5 +1,5 @@ /* Test of getdtablesize() function. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 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 @@ -20,6 +20,9 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (getdtablesize, int, (void)); + #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-getgroups.c b/tests/test-getgroups.c index 6d4a5140fd..1d3ca98e3a 100644 --- a/tests/test-getgroups.c +++ b/tests/test-getgroups.c @@ -20,6 +20,9 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (getgroups, int, (int, gid_t[])); + #include <errno.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-gethostname.c b/tests/test-gethostname.c index af1293b886..a63839b2d3 100644 --- a/tests/test-gethostname.c +++ b/tests/test-gethostname.c @@ -19,6 +19,10 @@ /* Get gethostname() declaration. */ #include <unistd.h> + +#include "signature.h" +SIGNATURE_CHECK (gethostname, int, (char *, size_t)); + /* Get HOST_NAME_MAX definition. */ #include <limits.h> diff --git a/tests/test-getline.c b/tests/test-getline.c index cc40c55122..7564ece159 100644 --- a/tests/test-getline.c +++ b/tests/test-getline.c @@ -20,6 +20,10 @@ #include <config.h> #include <stdio.h> + +#include "signature.h" +SIGNATURE_CHECK (getline, ssize_t, (char **, size_t *, FILE *)); + #include <stdlib.h> #include <string.h> diff --git a/tests/test-getopt.c b/tests/test-getopt.c index 6811a02058..9502a442ef 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> diff --git a/tests/test-gettimeofday.c b/tests/test-gettimeofday.c index 3b858791a4..bd6698d1cf 100644 --- a/tests/test-gettimeofday.c +++ b/tests/test-gettimeofday.c @@ -18,6 +18,10 @@ #include <config.h> #include <sys/time.h> + +#include "signature.h" +SIGNATURE_CHECK (gettimeofday, int, (struct timeval *, void *)); + #include <time.h> #include <stdio.h> diff --git a/tests/test-glob.c b/tests/test-glob.c index 750d9d8877..d7a17dc035 100644 --- a/tests/test-glob.c +++ b/tests/test-glob.c @@ -20,6 +20,11 @@ #include <glob.h> +#include "signature.h" +SIGNATURE_CHECK (glob, int, (char const *, int, int (*) (char const *, int), + glob_t *)); +SIGNATURE_CHECK (globfree, void, (glob_t *)); + #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/tests/test-iconv.c b/tests/test-iconv.c index e7e574245f..566ddee62f 100644 --- a/tests/test-iconv.c +++ b/tests/test-iconv.c @@ -1,5 +1,5 @@ /* Test of character set conversion. - Copyright (C) 2007-2008 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 @@ -20,6 +20,17 @@ #if HAVE_ICONV # include <iconv.h> + +# ifndef ICONV_CONST +# define ICONV_CONST /* empty */ +# endif + +#include "signature.h" +SIGNATURE_CHECK (iconv, size_t, (iconv_t, ICONV_CONST char **, size_t *, + char **, size_t *)); +SIGNATURE_CHECK (iconv_close, int, (iconv_t x)); +SIGNATURE_CHECK (iconv_open, iconv_t, (char const *, char const *)); + #endif #include <errno.h> diff --git a/tests/test-inet_ntop.c b/tests/test-inet_ntop.c index 312163aab6..8495620344 100644 --- a/tests/test-inet_ntop.c +++ b/tests/test-inet_ntop.c @@ -20,6 +20,10 @@ #include <arpa/inet.h> +#include "signature.h" +SIGNATURE_CHECK (inet_ntop, char const *, (int, void const *, char *, + socklen_t)); + #include <netinet/in.h> #include <sys/socket.h> #include <stdio.h> diff --git a/tests/test-inet_pton.c b/tests/test-inet_pton.c index dc6401e1fa..b1dbb052bb 100644 --- a/tests/test-inet_pton.c +++ b/tests/test-inet_pton.c @@ -20,6 +20,9 @@ #include <arpa/inet.h> +#include "signature.h" +SIGNATURE_CHECK (inet_pton, int, (int, const char *, void *)); + #include <netinet/in.h> #include <sys/socket.h> #include <stdio.h> diff --git a/tests/test-isblank.c b/tests/test-isblank.c index f25d26d05b..d29fc63338 100644 --- a/tests/test-isblank.c +++ b/tests/test-isblank.c @@ -20,6 +20,9 @@ #include <ctype.h> +#include "signature.h" +SIGNATURE_CHECK (isblank, int, (int)); + #include <limits.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-isfinite.c b/tests/test-isfinite.c index 2d718e2ccc..fc2f23c0d9 100644 --- a/tests/test-isfinite.c +++ b/tests/test-isfinite.c @@ -21,6 +21,11 @@ #include <math.h> +/* isfinite must be a macro. */ +#ifndef isfinite +# error missing declaration +#endif + #include <float.h> #include <limits.h> #include <stdio.h> diff --git a/tests/test-isinf.c b/tests/test-isinf.c index c1a83d30e5..d81ee7afc6 100644 --- a/tests/test-isinf.c +++ b/tests/test-isinf.c @@ -21,6 +21,11 @@ #include <math.h> +/* isinf must be a macro. */ +#ifndef isinf +# error missing declaration +#endif + #include <float.h> #include <limits.h> #include <stdio.h> diff --git a/tests/test-isnan.c b/tests/test-isnan.c index e9dd5e321a..74bb9d981f 100644 --- a/tests/test-isnan.c +++ b/tests/test-isnan.c @@ -21,6 +21,11 @@ #include <math.h> +/* isnan must be a macro. */ +#ifndef isnan +# error missing declaration +#endif + #include <float.h> #include <limits.h> #include <stdio.h> diff --git a/tests/test-lchown.c b/tests/test-lchown.c index 78c2940819..b9091028d3 100644 --- a/tests/test-lchown.c +++ b/tests/test-lchown.c @@ -20,6 +20,9 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (lchown, int, (char const *, uid_t, gid_t)); + #include <fcntl.h> #include <errno.h> #include <stdbool.h> diff --git a/tests/test-ldexpl.c b/tests/test-ldexpl.c index 42faf6071b..0fe4f8619c 100644 --- a/tests/test-ldexpl.c +++ b/tests/test-ldexpl.c @@ -20,6 +20,9 @@ #include <math.h> +#include "signature.h" +SIGNATURE_CHECK (ldexpl, long double, (long double, int)); + #include <float.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-link.c b/tests/test-link.c index dd7df2e016..d2ff679d22 100644 --- a/tests/test-link.c +++ b/tests/test-link.c @@ -18,6 +18,9 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (link, int, (char const *, char const *)); + #include <errno.h> #include <fcntl.h> #include <stdbool.h> diff --git a/tests/test-linkat.c b/tests/test-linkat.c index 11233fe137..c827a27d96 100644 --- a/tests/test-linkat.c +++ b/tests/test-linkat.c @@ -20,6 +20,9 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (linkat, int, (int, char const *, int, char const *, int)); + #include <fcntl.h> #include <errno.h> #include <stdbool.h> diff --git a/tests/test-lseek.c b/tests/test-lseek.c index e474a0b011..a57443db22 100644 --- a/tests/test-lseek.c +++ b/tests/test-lseek.c @@ -1,5 +1,5 @@ /* Test of lseek() function. - Copyright (C) 2007-2008 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 @@ -18,9 +18,13 @@ #include <config.h> +#include <unistd.h> + +#include "signature.h" +SIGNATURE_CHECK (lseek, off_t, (int, off_t, int)); + #include <errno.h> #include <stdio.h> -#include <unistd.h> #define ASSERT(expr) \ do \ diff --git a/tests/test-lstat.c b/tests/test-lstat.c index 8c62bc135a..74a4fd2acf 100644 --- a/tests/test-lstat.c +++ b/tests/test-lstat.c @@ -20,6 +20,13 @@ #include <sys/stat.h> +/* Caution: lstat may be a function-like macro. Although this + signature check must pass, it may be the signature of the real (and + broken) lstat rather than rpl_lstat. Most code should not use the + address of lstat. */ +#include "signature.h" +SIGNATURE_CHECK (lstat, int, (char const *, struct stat *)); + #include <fcntl.h> #include <errno.h> #include <stdbool.h> diff --git a/tests/test-mbrtowc.c b/tests/test-mbrtowc.c index 178e2106cc..916427308f 100644 --- a/tests/test-mbrtowc.c +++ b/tests/test-mbrtowc.c @@ -1,5 +1,5 @@ /* Test of conversion of multibyte character to wide character. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 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 @@ -20,6 +20,10 @@ #include <wchar.h> +#include "signature.h" +SIGNATURE_CHECK (mbrtowc, size_t, (wchar_t *, char const *, size_t, + mbstate_t *)); + #include <locale.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-mbsinit.c b/tests/test-mbsinit.c index 392b8535fc..2732693bc2 100644 --- a/tests/test-mbsinit.c +++ b/tests/test-mbsinit.c @@ -1,5 +1,5 @@ /* Test of test for initial conversion state. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 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 @@ -20,6 +20,9 @@ #include <wchar.h> +#include "signature.h" +SIGNATURE_CHECK (mbsinit, int, (const mbstate_t *)); + #include <locale.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-mbsnrtowcs.c b/tests/test-mbsnrtowcs.c index 60a8e18829..471c17b8b6 100644 --- a/tests/test-mbsnrtowcs.c +++ b/tests/test-mbsnrtowcs.c @@ -1,5 +1,5 @@ /* Test of conversion of string to wide string. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 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 @@ -20,6 +20,10 @@ #include <wchar.h> +#include "signature.h" +SIGNATURE_CHECK (mbsnrtowcs, size_t, (wchar_t *, char const **, size_t, size_t, + mbstate_t *)); + #include <locale.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-mbsrtowcs.c b/tests/test-mbsrtowcs.c index 49cb78ae4d..4a01d4a59a 100644 --- a/tests/test-mbsrtowcs.c +++ b/tests/test-mbsrtowcs.c @@ -1,5 +1,5 @@ /* Test of conversion of string to wide string. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 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 @@ -20,6 +20,10 @@ #include <wchar.h> +#include "signature.h" +SIGNATURE_CHECK (mbsrtowcs, size_t, (wchar_t *, char const **, size_t, + mbstate_t *)); + #include <locale.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-memchr.c b/tests/test-memchr.c index 582df89fae..2ec37b65af 100644 --- a/tests/test-memchr.c +++ b/tests/test-memchr.c @@ -19,6 +19,9 @@ #include <string.h> +#include "signature.h" +SIGNATURE_CHECK (memchr, void *, (void const *, int, size_t)); + #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-memcmp.c b/tests/test-memcmp.c index 87403161e1..463ca0c988 100644 --- a/tests/test-memcmp.c +++ b/tests/test-memcmp.c @@ -19,6 +19,9 @@ #include <string.h> +#include "signature.h" +SIGNATURE_CHECK (memcmp, int, (void const *, void const *, size_t)); + #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-memmem.c b/tests/test-memmem.c index 75a2505b7a..3c71a2e269 100644 --- a/tests/test-memmem.c +++ b/tests/test-memmem.c @@ -19,6 +19,9 @@ #include <string.h> +#include "signature.h" +SIGNATURE_CHECK (memmem, void *, (void const *, size_t, void const *, size_t)); + #include <signal.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-memrchr.c b/tests/test-memrchr.c index 17bc1f6f26..d9128e76e4 100644 --- a/tests/test-memrchr.c +++ b/tests/test-memrchr.c @@ -19,6 +19,9 @@ #include <string.h> +#include "signature.h" +SIGNATURE_CHECK (memrchr, void *, (void const *, int, size_t)); + #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-mkdir.c b/tests/test-mkdir.c index 6a19c30039..1531e25c50 100644 --- a/tests/test-mkdir.c +++ b/tests/test-mkdir.c @@ -20,6 +20,9 @@ #include <sys/stat.h> +#include "signature.h" +SIGNATURE_CHECK (mkdir, int, (char const *, mode_t)); + #include <fcntl.h> #include <errno.h> #include <stdbool.h> diff --git a/tests/test-mkdirat.c b/tests/test-mkdirat.c index 9b59f17a48..c11b1654df 100644 --- a/tests/test-mkdirat.c +++ b/tests/test-mkdirat.c @@ -20,6 +20,9 @@ #include <sys/stat.h> +#include "signature.h" +SIGNATURE_CHECK (mkdirat, int, (int, char const *, mode_t)); + #include <fcntl.h> #include <errno.h> #include <stdbool.h> diff --git a/tests/test-mkfifo.c b/tests/test-mkfifo.c index 3a0336c330..df002ed74c 100644 --- a/tests/test-mkfifo.c +++ b/tests/test-mkfifo.c @@ -20,6 +20,9 @@ #include <sys/stat.h> +#include "signature.h" +SIGNATURE_CHECK (mkfifo, int, (char const *, mode_t)); + #include <fcntl.h> #include <errno.h> #include <stdbool.h> diff --git a/tests/test-mkfifoat.c b/tests/test-mkfifoat.c index fca3411b3e..1c6656e147 100644 --- a/tests/test-mkfifoat.c +++ b/tests/test-mkfifoat.c @@ -20,6 +20,10 @@ #include <sys/stat.h> +#include "signature.h" +SIGNATURE_CHECK (mkfifoat, int, (int, char const *, mode_t)); +SIGNATURE_CHECK (mknodat, int, (int, char const *, mode_t, dev_t)); + #include <fcntl.h> #include <errno.h> #include <stdbool.h> diff --git a/tests/test-mknod.c b/tests/test-mknod.c index 2e308833f5..b00cd28425 100644 --- a/tests/test-mknod.c +++ b/tests/test-mknod.c @@ -20,6 +20,9 @@ #include <sys/stat.h> +#include "signature.h" +SIGNATURE_CHECK (mknod, int, (char const *, mode_t, dev_t)); + #include <fcntl.h> #include <errno.h> #include <stdbool.h> diff --git a/tests/test-nanosleep.c b/tests/test-nanosleep.c index 426ea999f1..e4e7231640 100644 --- a/tests/test-nanosleep.c +++ b/tests/test-nanosleep.c @@ -20,6 +20,9 @@ #include <time.h> +#include "signature.h" +SIGNATURE_CHECK (nanosleep, int, (struct timespec const *, struct timepec *)); + #include <errno.h> #include <signal.h> #include <stdio.h> diff --git a/tests/test-nl_langinfo.c b/tests/test-nl_langinfo.c index 337e6ecc94..a2f5f68257 100644 --- a/tests/test-nl_langinfo.c +++ b/tests/test-nl_langinfo.c @@ -20,6 +20,9 @@ #include <langinfo.h> +#include "signature.h" +SIGNATURE_CHECK (nl_langinfo, char *, (nl_item)); + #include <locale.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-obstack-printf.c b/tests/test-obstack-printf.c index fdbdcfad3e..ca07f47524 100644 --- a/tests/test-obstack-printf.c +++ b/tests/test-obstack-printf.c @@ -20,6 +20,11 @@ #include <stdio.h> +#include "signature.h" +SIGNATURE_CHECK (obstack_printf, int, (struct obstack *, char const *, ...)); +SIGNATURE_CHECK (obstack_vprintf, int, (struct obstack *, char const *, + va_list)); + #include "obstack.h" #include "xalloc.h" diff --git a/tests/test-open.c b/tests/test-open.c index 37109a58a1..4bdf31431f 100644 --- a/tests/test-open.c +++ b/tests/test-open.c @@ -20,6 +20,9 @@ #include <fcntl.h> +#include "signature.h" +SIGNATURE_CHECK (open, int, (char const *, int, ...)); + #include <errno.h> #include <stdbool.h> #include <stdio.h> diff --git a/tests/test-openat.c b/tests/test-openat.c index 77185cc45a..5eb9deb276 100644 --- a/tests/test-openat.c +++ b/tests/test-openat.c @@ -20,6 +20,9 @@ #include <fcntl.h> +#include "signature.h" +SIGNATURE_CHECK (openat, int, (int, char const *, int, ...)); + #include <errno.h> #include <stdarg.h> #include <stdbool.h> diff --git a/tests/test-perror.c b/tests/test-perror.c index 2faa8aeaf0..a045f1911a 100644 --- a/tests/test-perror.c +++ b/tests/test-perror.c @@ -1,5 +1,5 @@ /* Test of perror() function. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 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,9 @@ #include <stdio.h> +#include "signature.h" +SIGNATURE_CHECK (perror, void, (char const *)); + #include <errno.h> int diff --git a/tests/test-pipe2.c b/tests/test-pipe2.c index 049af5d5a5..5eb5ec3287 100644 --- a/tests/test-pipe2.c +++ b/tests/test-pipe2.c @@ -19,6 +19,9 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (pipe2, int, (int[2], int)); + #include <fcntl.h> #include <stdbool.h> diff --git a/tests/test-poll.c b/tests/test-poll.c index ed9bd9e917..3f884df0c4 100644 --- a/tests/test-poll.c +++ b/tests/test-poll.c @@ -19,12 +19,16 @@ #include <config.h> +#include <poll.h> + +#include "signature.h" +SIGNATURE_CHECK (poll, int, (struct pollfd[], nfds_t, int)); + #include <stdio.h> #include <string.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> -#include <poll.h> #include <fcntl.h> #include <stdlib.h> #include <stdbool.h> diff --git a/tests/test-popen.c b/tests/test-popen.c index 342e363044..914eea85d2 100644 --- a/tests/test-popen.c +++ b/tests/test-popen.c @@ -21,4 +21,8 @@ /* Specification. */ #include <stdio.h> +#include "signature.h" +SIGNATURE_CHECK (popen, FILE *, (char const *, char const *)); +SIGNATURE_CHECK (pclose, int, (FILE *)); + #include "test-popen.h" diff --git a/tests/test-posix_spawn1.c b/tests/test-posix_spawn1.c index 896c7c9d49..27f426ef9d 100644 --- a/tests/test-posix_spawn1.c +++ b/tests/test-posix_spawn1.c @@ -20,6 +20,28 @@ #include <spawn.h> +#include "signature.h" +SIGNATURE_CHECK (posix_spawnp, int, (pid_t *, char const *, + posix_spawn_file_actions_t const *, + posix_spawnattr_t const *, + char *const[], char *const[])); +SIGNATURE_CHECK (posix_spawnattr_init, int, (posix_spawnattr_t *)); +SIGNATURE_CHECK (posix_spawnattr_destroy, int, (posix_spawnattr_t *)); +SIGNATURE_CHECK (posix_spawnattr_setsigmask, int, (posix_spawnattr_t *, + sigset_t const *)); +SIGNATURE_CHECK (posix_spawnattr_setflags, int, (posix_spawnattr_t *, short)); +SIGNATURE_CHECK (posix_spawn_file_actions_init, int, + (posix_spawn_file_actions_t *)); +SIGNATURE_CHECK (posix_spawn_file_actions_destroy, int, + (posix_spawn_file_actions_t *)); +SIGNATURE_CHECK (posix_spawn_file_actions_addclose, int, + (posix_spawn_file_actions_t *, int)); +SIGNATURE_CHECK (posix_spawn_file_actions_addopen, int, + (posix_spawn_file_actions_t *, int, char const *, int, + mode_t)); +SIGNATURE_CHECK (posix_spawn_file_actions_adddup2, int, + (posix_spawn_file_actions_t *, int, int)); + #include <errno.h> #include <fcntl.h> #include <signal.h> diff --git a/tests/test-posix_spawn3.c b/tests/test-posix_spawn3.c index af71068fe2..c8f8398f41 100644 --- a/tests/test-posix_spawn3.c +++ b/tests/test-posix_spawn3.c @@ -23,6 +23,11 @@ #include <spawn.h> +#include "signature.h" +SIGNATURE_CHECK (posix_spawn, int, (pid_t *, char const *, + posix_spawn_file_actions_t const *, + posix_spawnattr_t const *, + char *const[], char *const[])); #include <errno.h> #include <fcntl.h> #include <signal.h> diff --git a/tests/test-pread.c b/tests/test-pread.c index 0ef387d9ff..d5a86ad2a7 100644 --- a/tests/test-pread.c +++ b/tests/test-pread.c @@ -20,6 +20,9 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (pread, ssize_t, (int, void *, size_t, off_t)); + #include <stdio.h> #include <stdlib.h> #include <sys/types.h> diff --git a/tests/test-printf-posix.c b/tests/test-printf-posix.c index 51f1bf7870..c09b1883fd 100644 --- a/tests/test-printf-posix.c +++ b/tests/test-printf-posix.c @@ -1,5 +1,5 @@ /* Test of POSIX compatible printf() function. - Copyright (C) 2007-2008 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 @@ -20,6 +20,9 @@ #include <stdio.h> +#include "signature.h" +SIGNATURE_CHECK (printf, int, (char const *, ...)); + #include <stddef.h> #include <stdint.h> #include <stdlib.h> diff --git a/tests/test-pty.c b/tests/test-pty.c index cd24f0d5e3..1c77166aa9 100644 --- a/tests/test-pty.c +++ b/tests/test-pty.c @@ -20,6 +20,12 @@ #include <pty.h> +#include "signature.h" +SIGNATURE_CHECK (forkpty, int, (int *, char *, struct termios *, + struct winsize *)); +SIGNATURE_CHECK (openpty, int, (int *, int *, char *, struct termios *, + struct winsize *)); + #include <stdio.h> int diff --git a/tests/test-random_r.c b/tests/test-random_r.c index 88deda0364..391d98c6cd 100644 --- a/tests/test-random_r.c +++ b/tests/test-random_r.c @@ -18,6 +18,13 @@ #include <stdlib.h> +#include "signature.h" +SIGNATURE_CHECK (srandom_r, int, (unsigned int, struct random_data *)); +SIGNATURE_CHECK (initstate_r, int, (unsigned int, char *, size_t, + struct random_data *)); +SIGNATURE_CHECK (setstate_r, int, (char *, struct random_data *)); +SIGNATURE_CHECK (random_r, int, (struct random_data *, int32_t *)); + #include <stdio.h> #include <time.h> diff --git a/tests/test-rawmemchr.c b/tests/test-rawmemchr.c index eece65fbfb..f1eef2c278 100644 --- a/tests/test-rawmemchr.c +++ b/tests/test-rawmemchr.c @@ -19,6 +19,9 @@ #include <string.h> +#include "signature.h" +SIGNATURE_CHECK (rawmemchr, void *, (void const *, int)); + #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-readlink.c b/tests/test-readlink.c index 5e51cb6d71..61f8f6bb78 100644 --- a/tests/test-readlink.c +++ b/tests/test-readlink.c @@ -20,6 +20,9 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (readlink, ssize_t, (char const *, char *, size_t)); + #include <fcntl.h> #include <errno.h> #include <stdbool.h> diff --git a/tests/test-remove.c b/tests/test-remove.c index 7781dfc336..1a92f6c0d1 100644 --- a/tests/test-remove.c +++ b/tests/test-remove.c @@ -20,6 +20,9 @@ #include <stdio.h> +#include "signature.h" +SIGNATURE_CHECK (remove, int, (char const *)); + #include <fcntl.h> #include <errno.h> #include <stdlib.h> diff --git a/tests/test-rename.c b/tests/test-rename.c index 0d51140d80..1cd2e8fc0c 100644 --- a/tests/test-rename.c +++ b/tests/test-rename.c @@ -16,12 +16,14 @@ #include <config.h> -#include <unistd.h> +#include <stdio.h> + +#include "signature.h" +SIGNATURE_CHECK (rename, int, (char const *, char const *)); #include <errno.h> #include <fcntl.h> #include <stdbool.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> diff --git a/tests/test-renameat.c b/tests/test-renameat.c index 7cde7be10c..3293d52c34 100644 --- a/tests/test-renameat.c +++ b/tests/test-renameat.c @@ -20,6 +20,9 @@ #include <stdio.h> +#include "signature.h" +SIGNATURE_CHECK (renameat, int, (int, char const *, int, char const *)); + #include <fcntl.h> #include <errno.h> #include <stdbool.h> diff --git a/tests/test-rmdir.c b/tests/test-rmdir.c index 908b0e6661..44f5d7204f 100644 --- a/tests/test-rmdir.c +++ b/tests/test-rmdir.c @@ -20,6 +20,9 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (rmdir, int, (char const *)); + #include <fcntl.h> #include <errno.h> #include <stdbool.h> diff --git a/tests/test-round1.c b/tests/test-round1.c index 8e9e0ef9c3..6f2795ecd2 100644 --- a/tests/test-round1.c +++ b/tests/test-round1.c @@ -1,5 +1,5 @@ /* Test of rounding to nearest, breaking ties away from zero. - Copyright (C) 2007-2008 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 @@ -22,6 +22,9 @@ #include <math.h> +#include "signature.h" +SIGNATURE_CHECK (round, double, (double)); + #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-roundf1.c b/tests/test-roundf1.c index cbf3f9edb1..98edc4a7e1 100644 --- a/tests/test-roundf1.c +++ b/tests/test-roundf1.c @@ -1,5 +1,5 @@ /* Test of rounding to nearest, breaking ties away from zero. - Copyright (C) 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2007, 2008, 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 @@ -22,6 +22,9 @@ #include <math.h> +#include "signature.h" +SIGNATURE_CHECK (roundf, float, (float)); + #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-roundl.c b/tests/test-roundl.c index c4fcf0cbb6..048aa8b9f3 100644 --- a/tests/test-roundl.c +++ b/tests/test-roundl.c @@ -22,6 +22,9 @@ #include <math.h> +#include "signature.h" +SIGNATURE_CHECK (roundl, long double, (long double)); + #include <float.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-select.c b/tests/test-select.c index 5ce7c7faed..5b413d564e 100644 --- a/tests/test-select.c +++ b/tests/test-select.c @@ -20,6 +20,24 @@ #include <sys/select.h> +#include "signature.h" +SIGNATURE_CHECK (select, int, (int, fd_set *, fd_set *, fd_set *, + struct timeval *)); +/* The following may be macros without underlying functions, so only + check signature if they are not macros. */ +#ifndef FD_CLR +SIGNATURE_CHECK (FD_CLR, void, (int, fd_set *)); +#endif +#ifndef FD_ISSET +SIGNATURE_CHECK (FD_ISSET, void, (int, fd_set *)); +#endif +#ifndef FD_SET +SIGNATURE_CHECK (FD_SET, int, (int, fd_set *)); +#endif +#ifndef FD_ZERO +SIGNATURE_CHECK (FD_ZERO, void, (fd_set *)); +#endif + #include <stdio.h> #include <string.h> #include <netinet/in.h> diff --git a/tests/test-setenv.c b/tests/test-setenv.c index eb1fe3336f..b23d296e39 100644 --- a/tests/test-setenv.c +++ b/tests/test-setenv.c @@ -20,6 +20,9 @@ #include <stdlib.h> +#include "signature.h" +SIGNATURE_CHECK (setenv, int, (char const *, char const *, int)); + #include <errno.h> #include <stdio.h> #include <string.h> diff --git a/tests/test-sigaction.c b/tests/test-sigaction.c index 55da288b42..63dfd7ad41 100644 --- a/tests/test-sigaction.c +++ b/tests/test-sigaction.c @@ -20,6 +20,10 @@ #include <signal.h> +#include "signature.h" +SIGNATURE_CHECK (sigaction, int, (int, struct sigaction const *, + struct sigaction *)); + #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-signbit.c b/tests/test-signbit.c index acca7fd988..4acb045460 100644 --- a/tests/test-signbit.c +++ b/tests/test-signbit.c @@ -20,6 +20,11 @@ #include <math.h> +/* signbit must be a macro. */ +#ifndef signbit +# error missing declaration +#endif + #include <float.h> #include <limits.h> #include <stdio.h> diff --git a/tests/test-sleep.c b/tests/test-sleep.c index 8840142ac9..4abca334ce 100644 --- a/tests/test-sleep.c +++ b/tests/test-sleep.c @@ -20,6 +20,9 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (sleep, unsigned int, (unsigned int)); + #include <signal.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-snprintf.c b/tests/test-snprintf.c index 55bca339b2..6f1e34ceca 100644 --- a/tests/test-snprintf.c +++ b/tests/test-snprintf.c @@ -1,5 +1,5 @@ /* Test of snprintf() function. - Copyright (C) 2007-2008 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 @@ -20,6 +20,9 @@ #include <stdio.h> +#include "signature.h" +SIGNATURE_CHECK (snprintf, int, (char *, size_t, char const *, ...)); + #include <stdlib.h> #include <string.h> diff --git a/tests/test-sprintf-posix.c b/tests/test-sprintf-posix.c index e5dab357c6..47bbaa08cc 100644 --- a/tests/test-sprintf-posix.c +++ b/tests/test-sprintf-posix.c @@ -1,5 +1,5 @@ /* Test of POSIX compatible sprintf() function. - Copyright (C) 2007-2008 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 @@ -20,6 +20,9 @@ #include <stdio.h> +#include "signature.h" +SIGNATURE_CHECK (sprintf, int, (char *, char const *, ...)); + #include <float.h> #include <stddef.h> #include <stdint.h> diff --git a/tests/test-stat.c b/tests/test-stat.c index fc11731467..9e52a4a7ad 100644 --- a/tests/test-stat.c +++ b/tests/test-stat.c @@ -20,6 +20,13 @@ #include <sys/stat.h> +/* Caution: stat may be a function-like macro. Although this + signature check must pass, it may be the signature of the real (and + broken) stat rather than rpl_stat. Most code should not use the + address of stat. */ +#include "signature.h" +SIGNATURE_CHECK (stat, int, (char const *, struct stat *)); + #include <fcntl.h> #include <errno.h> #include <stdbool.h> diff --git a/tests/test-stpncpy.c b/tests/test-stpncpy.c index 128bee3163..d3f10b69fd 100644 --- a/tests/test-stpncpy.c +++ b/tests/test-stpncpy.c @@ -1,5 +1,5 @@ /* Test the system defined function stpncpy(). - Copyright (C) 2003, 2008 Free Software Foundation, Inc. + Copyright (C) 2003, 2008, 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 @@ -17,6 +17,10 @@ #include <config.h> #include <string.h> + +#include "signature.h" +SIGNATURE_CHECK (stpncpy, char *, (char *, char const *, size_t)); + #include <stdio.h> int diff --git a/tests/test-strcasestr.c b/tests/test-strcasestr.c index 8ecd3a9ad3..7c2832abe4 100644 --- a/tests/test-strcasestr.c +++ b/tests/test-strcasestr.c @@ -1,5 +1,5 @@ /* Test of case-insensitive searching in a string. - Copyright (C) 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2007, 2008, 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 @@ -20,6 +20,9 @@ #include <string.h> +#include "signature.h" +SIGNATURE_CHECK (strcasestr, char *, (char const *, char const *)); + #include <signal.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-strchrnul.c b/tests/test-strchrnul.c index ea882e5543..f2f341f6bd 100644 --- a/tests/test-strchrnul.c +++ b/tests/test-strchrnul.c @@ -19,6 +19,9 @@ #include <string.h> +#include "signature.h" +SIGNATURE_CHECK (strchrnul, char *, (char const *, int)); + #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-strerror.c b/tests/test-strerror.c index 22e9f5ad95..986f75aa62 100644 --- a/tests/test-strerror.c +++ b/tests/test-strerror.c @@ -21,6 +21,9 @@ #include <string.h> +#include "signature.h" +SIGNATURE_CHECK (strerror, char *, (int)); + #include <errno.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-strsignal.c b/tests/test-strsignal.c index 6f06d8eca2..bf97dc683c 100644 --- a/tests/test-strsignal.c +++ b/tests/test-strsignal.c @@ -21,6 +21,9 @@ #include <string.h> +#include "signature.h" +SIGNATURE_CHECK (strsignal, char *, (int)); + #include <signal.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-strstr.c b/tests/test-strstr.c index c89a1ace41..6bffc13242 100644 --- a/tests/test-strstr.c +++ b/tests/test-strstr.c @@ -19,6 +19,9 @@ #include <string.h> +#include "signature.h" +SIGNATURE_CHECK (strstr, char *, (char const *, char const *)); + #include <signal.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-strtod.c b/tests/test-strtod.c index 14f73b9ca4..affd52cd5e 100644 --- a/tests/test-strtod.c +++ b/tests/test-strtod.c @@ -19,6 +19,9 @@ #include <stdlib.h> +#include "signature.h" +SIGNATURE_CHECK (strtod, double, (char const *, char **)); + #include <errno.h> #include <float.h> #include <math.h> diff --git a/tests/test-strverscmp.c b/tests/test-strverscmp.c index 220f2d6f67..72b574d0fc 100644 --- a/tests/test-strverscmp.c +++ b/tests/test-strverscmp.c @@ -21,6 +21,9 @@ #include <string.h> +#include "signature.h" +SIGNATURE_CHECK (strverscmp, int, (const char *, const char *)); + #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-symlink.c b/tests/test-symlink.c index 4b593b6531..c84e0064b2 100644 --- a/tests/test-symlink.c +++ b/tests/test-symlink.c @@ -20,6 +20,9 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (symlink, int, (char const *, char const *)); + #include <fcntl.h> #include <errno.h> #include <stdbool.h> diff --git a/tests/test-symlinkat.c b/tests/test-symlinkat.c index c76244f31d..67f0adf668 100644 --- a/tests/test-symlinkat.c +++ b/tests/test-symlinkat.c @@ -20,6 +20,10 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (symlinkat, int, (char const *, int, char const *)); +SIGNATURE_CHECK (readlinkat, ssize_t, (int, char const *, char *, size_t)); + #include <fcntl.h> #include <errno.h> #include <stdbool.h> diff --git a/tests/test-times.c b/tests/test-times.c index 496b9a825b..c86916598e 100644 --- a/tests/test-times.c +++ b/tests/test-times.c @@ -1,5 +1,5 @@ /* Test of times function. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 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 <sys/times.h> + +#include "signature.h" +SIGNATURE_CHECK (times, clock_t, (struct tms *)); + #include <stdio.h> #include <stdlib.h> #include <stdint.h> diff --git a/tests/test-trunc1.c b/tests/test-trunc1.c index 671d3f5b53..0c92cc6e2c 100644 --- a/tests/test-trunc1.c +++ b/tests/test-trunc1.c @@ -1,5 +1,5 @@ /* Test of rounding towards zero. - Copyright (C) 2007-2008 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 @@ -20,6 +20,9 @@ #include <math.h> +#include "signature.h" +SIGNATURE_CHECK (trunc, double, (double)); + #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-truncf1.c b/tests/test-truncf1.c index 834899b580..44fd8c11fa 100644 --- a/tests/test-truncf1.c +++ b/tests/test-truncf1.c @@ -1,5 +1,5 @@ /* Test of rounding towards zero. - Copyright (C) 2007-2008 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 @@ -20,6 +20,9 @@ #include <math.h> +#include "signature.h" +SIGNATURE_CHECK (truncf, float, (float)); + #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-truncl.c b/tests/test-truncl.c index 7e3dd17939..3b36ea7c46 100644 --- a/tests/test-truncl.c +++ b/tests/test-truncl.c @@ -20,6 +20,9 @@ #include <math.h> +#include "signature.h" +SIGNATURE_CHECK (truncl, long double, (long double)); + #include <float.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-tsearch.c b/tests/test-tsearch.c index 273f3ab318..c799f8ff80 100644 --- a/tests/test-tsearch.c +++ b/tests/test-tsearch.c @@ -1,5 +1,5 @@ /* Test program for tsearch et al. - Copyright (C) 1997, 2000-2001, 2007-2008 Free Software Foundation, Inc. + Copyright (C) 1997, 2000-2001, 2007-2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software: you can redistribute it and/or @@ -19,6 +19,16 @@ #include <search.h> +#include "signature.h" +SIGNATURE_CHECK (tdelete, void *, (void const *, void **, + int (*) (void const *, void const *))); +SIGNATURE_CHECK (tfind, void *, (void const *, void * const *, + int (*) (void const *, void const *))); +SIGNATURE_CHECK (tsearch, void *, (void const *, void **, + int (*) (void const *, void const *))); +SIGNATURE_CHECK (twalk, void, (void const *, + void (*) (void const *, VISIT, int))); + #include <stdint.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-uname.c b/tests/test-uname.c index a458698a61..b37ae9b4d7 100644 --- a/tests/test-uname.c +++ b/tests/test-uname.c @@ -20,6 +20,9 @@ #include <sys/utsname.h> +#include "signature.h" +SIGNATURE_CHECK (uname, int, (struct utsname *)); + #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/tests/test-unlink.c b/tests/test-unlink.c index 447a01473a..ffc360da04 100644 --- a/tests/test-unlink.c +++ b/tests/test-unlink.c @@ -20,6 +20,9 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (unlink, int, (char const *)); + #include <fcntl.h> #include <errno.h> #include <stdbool.h> diff --git a/tests/test-unlinkat.c b/tests/test-unlinkat.c index a98dc8dc4a..313cf1ebf2 100644 --- a/tests/test-unlinkat.c +++ b/tests/test-unlinkat.c @@ -20,6 +20,9 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (unlinkat, int, (int, char const *, int)); + #include <fcntl.h> #include <errno.h> #include <stdbool.h> diff --git a/tests/test-unsetenv.c b/tests/test-unsetenv.c index bd312a04b5..6f80751788 100644 --- a/tests/test-unsetenv.c +++ b/tests/test-unsetenv.c @@ -20,6 +20,9 @@ #include <stdlib.h> +#include "signature.h" +SIGNATURE_CHECK (unsetenv, int, (char const *)); + #include <errno.h> #include <stdio.h> #include <string.h> diff --git a/tests/test-usleep.c b/tests/test-usleep.c index d6e62ebe4d..a792188333 100644 --- a/tests/test-usleep.c +++ b/tests/test-usleep.c @@ -20,6 +20,9 @@ #include <unistd.h> +#include "signature.h" +SIGNATURE_CHECK (usleep, int, (useconds_t)); + #include <stdio.h> #include <stdlib.h> #include <time.h> diff --git a/tests/test-utimensat.c b/tests/test-utimensat.c index 35fd1bfac6..b1dc940125 100644 --- a/tests/test-utimensat.c +++ b/tests/test-utimensat.c @@ -20,6 +20,10 @@ #include <sys/stat.h> +#include "signature.h" +SIGNATURE_CHECK (utimensat, int, (int, char const *, struct timespec const[2], + int)); + #include <fcntl.h> #include <errno.h> #include <stdbool.h> diff --git a/tests/test-vasprintf.c b/tests/test-vasprintf.c index a85ff8ec42..46483e4586 100644 --- a/tests/test-vasprintf.c +++ b/tests/test-vasprintf.c @@ -1,5 +1,5 @@ /* Test of vasprintf() and asprintf() functions. - Copyright (C) 2007-2008 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 @@ -20,6 +20,10 @@ #include <stdio.h> +#include "signature.h" +SIGNATURE_CHECK (asprintf, int, (char **, char const *, ...)); +SIGNATURE_CHECK (vasprintf, int, (char **, char const *, va_list)); + #include <stdarg.h> #include <stdlib.h> #include <string.h> diff --git a/tests/test-vdprintf-posix.c b/tests/test-vdprintf-posix.c index 949665e0c1..932d289bb7 100644 --- a/tests/test-vdprintf-posix.c +++ b/tests/test-vdprintf-posix.c @@ -20,6 +20,9 @@ #include <stdio.h> +#include "signature.h" +SIGNATURE_CHECK (vdprintf, int, (int, char const *, va_list)); + #include <stdarg.h> #include <stddef.h> #include <stdint.h> diff --git a/tests/test-vfprintf-posix.c b/tests/test-vfprintf-posix.c index ae94fa7b94..94c8ceab78 100644 --- a/tests/test-vfprintf-posix.c +++ b/tests/test-vfprintf-posix.c @@ -1,5 +1,5 @@ /* Test of POSIX compatible vfprintf() function. - Copyright (C) 2007-2008 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 @@ -20,6 +20,9 @@ #include <stdio.h> +#include "signature.h" +SIGNATURE_CHECK (vfprintf, int, (FILE *, char const *, va_list)); + #include <stdarg.h> #include <stddef.h> #include <stdint.h> diff --git a/tests/test-vprintf-posix.c b/tests/test-vprintf-posix.c index 85222831cc..ec6368481e 100644 --- a/tests/test-vprintf-posix.c +++ b/tests/test-vprintf-posix.c @@ -1,5 +1,5 @@ /* Test of POSIX compatible vfprintf() function. - Copyright (C) 2007-2008 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 @@ -20,6 +20,9 @@ #include <stdio.h> +#include "signature.h" +SIGNATURE_CHECK (vprintf, int, (char const *, va_list)); + #include <stdarg.h> #include <stddef.h> #include <stdint.h> diff --git a/tests/test-vsnprintf.c b/tests/test-vsnprintf.c index f0d08edbec..baaae6f287 100644 --- a/tests/test-vsnprintf.c +++ b/tests/test-vsnprintf.c @@ -1,5 +1,5 @@ /* Test of vsnprintf() function. - Copyright (C) 2007-2008 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 @@ -20,6 +20,9 @@ #include <stdio.h> +#include "signature.h" +SIGNATURE_CHECK (vsnprintf, int, (char *, size_t, char const *, va_list)); + #include <stdarg.h> #include <stdlib.h> #include <string.h> diff --git a/tests/test-vsprintf-posix.c b/tests/test-vsprintf-posix.c index 3bb457fb5e..49a134781b 100644 --- a/tests/test-vsprintf-posix.c +++ b/tests/test-vsprintf-posix.c @@ -1,5 +1,5 @@ /* Test of POSIX compatible vsprintf() function. - Copyright (C) 2007-2008 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 @@ -20,6 +20,9 @@ #include <stdio.h> +#include "signature.h" +SIGNATURE_CHECK (vsprintf, int, (char *, char const *, va_list)); + #include <float.h> #include <stdarg.h> #include <stddef.h> diff --git a/tests/test-wcrtomb.c b/tests/test-wcrtomb.c index 4fe972b46e..3ac33e0f4b 100644 --- a/tests/test-wcrtomb.c +++ b/tests/test-wcrtomb.c @@ -1,5 +1,5 @@ /* Test of conversion of wide character to multibyte character. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 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 @@ -20,6 +20,9 @@ #include <wchar.h> +#include "signature.h" +SIGNATURE_CHECK (wcrtomb, size_t, (char *, wchar_t, mbstate_t *)); + #include <locale.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-wcsnrtombs.c b/tests/test-wcsnrtombs.c index 38c0441b4b..f16dafe407 100644 --- a/tests/test-wcsnrtombs.c +++ b/tests/test-wcsnrtombs.c @@ -1,5 +1,5 @@ /* Test of conversion of wide string to string. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 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 @@ -20,6 +20,10 @@ #include <wchar.h> +#include "signature.h" +SIGNATURE_CHECK (wcsnrtombs, size_t, (char *, wchar_t const **, size_t, size_t, + mbstate_t *)); + #include <locale.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-wcsrtombs.c b/tests/test-wcsrtombs.c index 3ceb7c0f61..4fad01fa17 100644 --- a/tests/test-wcsrtombs.c +++ b/tests/test-wcsrtombs.c @@ -1,5 +1,5 @@ /* Test of conversion of wide string to string. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 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 @@ -20,6 +20,10 @@ #include <wchar.h> +#include "signature.h" +SIGNATURE_CHECK (wcsrtombs, size_t, (char *, wchar_t const **, size_t, + mbstate_t *)); + #include <locale.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/test-wcwidth.c b/tests/test-wcwidth.c index 5087b088dc..f1a89d1440 100644 --- a/tests/test-wcwidth.c +++ b/tests/test-wcwidth.c @@ -1,5 +1,5 @@ /* Test of wcwidth() function. - Copyright (C) 2007-2008 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 @@ -20,6 +20,9 @@ #include <wchar.h> +#include "signature.h" +SIGNATURE_CHECK (wcwidth, int, (wchar_t)); + #include <locale.h> #include <stdio.h> #include <stdlib.h> |