+2009-12-10 Bruno Haible <bruno@clisp.org>
+
+ Declare which arguments expect non-NULL values, for GCC and clang.
+ * build-aux/arg-nonnull.h: New file.
+ * modules/arg-nonnull: New file.
+ * lib/arpa_inet.in.h (_GL_ARG_NONNULL): New placeholder.
+ (inet_ntop, inet_pton): Use it.
+ * lib/dirent.in.h (_GL_ARG_NONNULL): New placeholder.
+ (closedir, dirfd, opendir, scandir, alphasort): Use it.
+ * lib/fcntl.in.h (_GL_ARG_NONNULL): New placeholder.
+ (open, openat): Use it.
+ * lib/fnmatch.in.h (_GL_ARG_NONNULL): New placeholder.
+ (fnmatch): Use it.
+ * lib/getopt.in.h (_GL_ARG_NONNULL): New placeholder.
+ (getopt, getopt_long, getopt_long_only): Use it.
+ * lib/glob.in.h (_GL_ARG_NONNULL): New placeholder.
+ * lib/glob-libc.h (glob, globfree, glob64, globfree64, glob_pattern_p):
+ Use it.
+ * lib/iconv.in.h (_GL_ARG_NONNULL): New placeholder.
+ (iconv_open): Use it.
+ * lib/inttypes.in.h (_GL_ARG_NONNULL): New placeholder.
+ (strtoimax, strtoumax): Use it.
+ * lib/locale.in.h (_GL_ARG_NONNULL): New placeholder.
+ (duplocale): Use it.
+ * lib/math.in.h (_GL_ARG_NONNULL): New placeholder.
+ (frexp, frexpl): Use it.
+ * lib/netdb.in.h (_GL_ARG_NONNULL): New placeholder.
+ (getaddrinfo, freeaddrinfo, getnameinfo): Use it.
+ * lib/search.in.h (_GL_ARG_NONNULL): New placeholder.
+ (tsearch, tfind, tdelete, twalk): Use it.
+ * lib/signal.in.h (_GL_ARG_NONNULL): New placeholder.
+ (sigismember, sigemptyset, sigaddset, sigdelset, sigfillset,
+ sigpending): Use it.
+ * lib/spawn.in.h (_GL_ARG_NONNULL): New placeholder.
+ (posix_spawn, posix_spawnp, posix_spawnattr_init,
+ posix_spawnattr_destroy, posix_spawnattr_getsigdefault,
+ posix_spawnattr_setsigdefault, posix_spawnattr_getsigmask,
+ posix_spawnattr_setsigmask, posix_spawnattr_getflags,
+ posix_spawnattr_setflags, posix_spawnattr_getpgroup,
+ posix_spawnattr_setpgroup, posix_spawnattr_getschedpolicy,
+ posix_spawnattr_setschedpolicy, posix_spawnattr_getschedparam,
+ posix_spawnattr_setschedparam, posix_spawn_file_actions_init,
+ posix_spawn_file_actions_destroy, posix_spawn_file_actions_addopen,
+ posix_spawn_file_actions_addclose, posix_spawn_file_actions_adddup2):
+ Use it.
+ * lib/stdio.in.h (_GL_ARG_NONNULL): New placeholder.
+ (dprintf, fclose, fopen, fprintf, fpurge, fputc, fputs, freopen,
+ rpl_fseek, fseeko, rpl_ftell, ftello, fwrite, getdelim, getline,
+ obstack_printf, obstack_vprintf, popen, printf, putc, puts, remove,
+ rename, renameat, snprintf, sprintf, asprintf, vasprintf, vdprintf,
+ vfprintf, vprintf, vsnprintf, vsprintf): Use it.
+ * lib/stdlib.in.h (_GL_ARG_NONNULL): New placeholder.
+ (atoll, canonicalize_file_name, getloadavg, getsubopt, mkdtemp,
+ mkostemp, mkostemps, mkstemp, mkstemps, putenv, srandom_r, initstate_r,
+ setstate_r, random_r, realpath, rpmatch, setenv, strtod, strtoll,
+ strtoull, unsetenv): Use it.
+ * lib/string.in.h (_GL_ARG_NONNULL): New placeholder.
+ (memchr, memmem, mempcpy, memrchr, rawmemchr, stpcpy, stpncpy,
+ strchrnul, strdup, strndup, strnlen, strpbrk, strsep, strstr,
+ strcasestr, strtok_r, mbslen, mbsnlen, mbschr, mbsrchr, mbsstr,
+ mbscasecmp, mbsncasecmp, mbspcasecmp, mbscasestr, mbscspn, mbspbrk,
+ mbsspn, mbssep, mbstok_r, strverscmp): Use it.
+ * lib/strings.in.h (_GL_ARG_NONNULL): New placeholder.
+ (strcasecmp, strncasecmp): Use it.
+ * lib/sys_socket.in.h (_GL_ARG_NONNULL): New placeholder.
+ (rpl_connect, rpl_bind, rpl_getpeername, rpl_getsockname,
+ rpl_getsockopt, rpl_recv, rpl_send, rpl_recvfrom, rpl_sendto,
+ rpl_setsockopt): Use it.
+ * lib/sys_stat.in.h (_GL_ARG_NONNULL): New placeholder.
+ (fchmodat, fstat, fstatat, lchmod, rpl_lstat, mkdir, mkdirat, mkfifo,
+ mkfifoat, mknod, mknodat, stat, utimensat): Use it.
+ * lib/sys_time.in.h (_GL_ARG_NONNULL): New placeholder.
+ (gettimeofday): Use it.
+ * lib/sys_times.in.h (_GL_ARG_NONNULL): New placeholder.
+ (times): Use it.
+ * lib/sys_utsname.in.h (_GL_ARG_NONNULL): New placeholder.
+ (uname): Use it.
+ * lib/time.in.h (_GL_ARG_NONNULL): New placeholder.
+ (nanosleep, mktime, localtime_r, gmtime_r, strptime, timegm): Use it.
+ * lib/unistd.in.h (_GL_ARG_NONNULL): New placeholder.
+ (chown, euidaccess, faccessat, _gl_register_fd, fchownat,
+ getdomainname, gethostname, getlogin_r, lchown, link, linkat, pipe2,
+ pread, readlink, readlinkat, rmdir, symlink, symlinkat, unlink,
+ unlinkat, write): Use it.
+ * lib/wchar.in.h (_GL_ARG_NONNULL): New placeholder.
+ (mbsrtowcs, mbsnrtowcs, wcsrtombs, wcsnrtombs): Use it.
+ * lib/argv-iter.h: Include arg-nonnull.h.
+ (_ATTRIBUTE_NONNULL_): Remove macro.
+ (argv_iter_init_argv, argv_iter_init_stream, argv_iter,
+ argv_iter_n_args, argv_iter_free): Use _GL_ARG_NONNULL.
+ * lib/canonicalize-lgpl.c (_GL_ARG_NONNULL): Define, to defeat gcc
+ optimization.
+ * lib/getaddrinfo.c (_GL_ARG_NONNULL): Likewise.
+ * lib/getdelim.c (_GL_ARG_NONNULL): Likewise.
+ * lib/glob.c (_GL_ARG_NONNULL): Likewise.
+ * lib/random_r.c (_GL_ARG_NONNULL): Likewise.
+ * lib/setenv.c (_GL_ARG_NONNULL): Likewise.
+ * lib/strtod.c (_GL_ARG_NONNULL): Likewise.
+ * lib/tsearch.c (_GL_ARG_NONNULL): Likewise.
+ * lib/unsetenv.c (_GL_ARG_NONNULL): Likewise.
+ * modules/arpa_inet (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into arpa/inet.h.
+ * modules/dirent (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into dirent.h.
+ * modules/fcntl-h (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into fcntl.h.
+ * modules/fnmatch (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into fnmatch.h.
+ * modules/getopt-posix (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into getopt.h.
+ * modules/glob (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into glob.h.
+ * modules/iconv_open (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into iconv.h.
+ * modules/inttypes (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into inttypes.h.
+ * modules/locale (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into locale.h.
+ * modules/math (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into math.h.
+ * modules/netdb (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into netdb.h.
+ * modules/search (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into search.h.
+ * modules/signal (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into signal.h.
+ * modules/spawn (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into spawn.h.
+ * modules/stdio (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into stdio.h.
+ * modules/stdlib (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into stdlib.h.
+ * modules/string (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into string.h.
+ * modules/strings (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into strings.h.
+ * modules/sys_socket (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into sys/socket.h.
+ * modules/sys_stat (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into sys/stat.h.
+ * modules/sys_time (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into sys/time.h.
+ * modules/sys_times (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into sys/times.h.
+ * modules/sys_utsname (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into sys/utsname.h.
+ * modules/time (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into time.h.
+ * modules/unistd (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into unistd.h.
+ * modules/wchar (Depends-on): Add arg-nonnull.
+ (Makefile.am): Insert arg-nonnull.h into wchar.h.
+ * modules/argv-iter (Depends-on): Add arg-nonnull.
+ * tests/test-canonicalize.c (null_ptr): New function.
+ (main): Use it.
+ * tests/test-canonicalize-lgpl.c (null_ptr): New function.
+ (main): Use it.
+ * tests/test-memmem.c (null_ptr): New function.
+ (main): Use it.
+ Reported by Jim Meyering.
+
2009-12-10 Bruno Haible <bruno@clisp.org>
Use spaces for indentation, not tabs.
--- /dev/null
+/* A C macro for declaring that specific arguments must not be NULL.
+ 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 Lesser General Public License as published
+ by the Free Software Foundation; either version 2 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
+ that the values passed as arguments n, ..., m must be non-NULL pointers.
+ n = 1 stands for the first argument, n = 2 for the second argument etc. */
+#ifndef _GL_ARG_NONNULL
+# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
+# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
+# else
+# define _GL_ARG_NONNULL(params)
+# endif
+#endif
#include <stdio.h>
#include <stdbool.h>
+/* Definition of _GL_ARG_NONNULL. */
+#include "arg-nonnull.h"
+
struct argv_iterator;
enum argv_iter_err;
-#undef _ATTRIBUTE_NONNULL_
-#if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || 3 < __GNUC__
-# define _ATTRIBUTE_NONNULL_(m) __attribute__ ((__nonnull__ (m)))
-#else
-# define _ATTRIBUTE_NONNULL_(m)
-#endif
-
enum argv_iter_err
{
AI_ERR_OK = 1,
};
struct argv_iterator *argv_iter_init_argv (char **argv)
- _ATTRIBUTE_NONNULL_ (1);
+ _GL_ARG_NONNULL ((1));
struct argv_iterator *argv_iter_init_stream (FILE *fp)
- _ATTRIBUTE_NONNULL_ (1);
+ _GL_ARG_NONNULL ((1));
char *argv_iter (struct argv_iterator *, enum argv_iter_err *)
- _ATTRIBUTE_NONNULL_ (1) _ATTRIBUTE_NONNULL_ (2);
+ _GL_ARG_NONNULL ((1, 2));
size_t argv_iter_n_args (struct argv_iterator const *)
- _ATTRIBUTE_NONNULL_ (1);
+ _GL_ARG_NONNULL ((1));
void argv_iter_free (struct argv_iterator *)
- _ATTRIBUTE_NONNULL_ (1);
+ _GL_ARG_NONNULL ((1));
/* A GNU-like <arpa/inet.h>.
- Copyright (C) 2005-2006, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 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
/* The definition of GL_LINK_WARNING is copied here. */
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
#ifdef __cplusplus
extern "C" {
#endif
For more details, see the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/inet_ntop.html>. */
extern const char *inet_ntop (int af, const void *restrict src,
- char *restrict dst, socklen_t cnt);
+ char *restrict dst, socklen_t cnt)
+ _GL_ARG_NONNULL ((2, 3));
# endif
#elif defined GNULIB_POSIXCHECK
# undef inet_ntop
#if @GNULIB_INET_PTON@
# if !@HAVE_DECL_INET_PTON@
-extern int inet_pton (int af, const char *restrict src, void *restrict dst);
+extern int inet_pton (int af, const char *restrict src, void *restrict dst)
+ _GL_ARG_NONNULL ((2, 3));
# endif
#elif defined GNULIB_POSIXCHECK
# undef inet_pton
#if !HAVE_CANONICALIZE_FILE_NAME || !FUNC_REALPATH_WORKS || defined _LIBC
+/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
+ optimizes away the name == NULL test below. */
+#define _GL_ARG_NONNULL(params)
+
/* Specification. */
#include <stdlib.h>
/* The definition of GL_LINK_WARNING is copied here. */
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
#ifdef __cplusplus
extern "C" {
#if @REPLACE_CLOSEDIR@
# define closedir rpl_closedir
-extern int closedir (DIR *);
+extern int closedir (DIR *) _GL_ARG_NONNULL ((1));
#endif
#if @GNULIB_DIRFD@
# if !@HAVE_DECL_DIRFD@ && !defined dirfd
/* Return the file descriptor associated with the given directory stream,
or -1 if none exists. */
-extern int dirfd (DIR const *dir);
+extern int dirfd (DIR const *dir) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef dirfd
#if @REPLACE_OPENDIR@
# define opendir rpl_opendir
-extern DIR * opendir (const char *);
+extern DIR * opendir (const char *) _GL_ARG_NONNULL ((1));
#endif
#if @GNULIB_SCANDIR@
# if !@HAVE_SCANDIR@
extern int scandir (const char *dir, struct dirent ***namelist,
int (*filter) (const struct dirent *),
- int (*cmp) (const struct dirent **, const struct dirent **));
+ int (*cmp) (const struct dirent **, const struct dirent **))
+ _GL_ARG_NONNULL ((1, 2, 4));
# endif
#elif defined GNULIB_POSIXCHECK
# undef scandir
#if @GNULIB_ALPHASORT@
/* Compare two 'struct dirent' entries alphabetically. */
# if !@HAVE_ALPHASORT@
-extern int alphasort (const struct dirent **, const struct dirent **);
+extern int alphasort (const struct dirent **, const struct dirent **)
+ _GL_ARG_NONNULL ((1, 2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef alphasort
/* The definition of GL_LINK_WARNING is copied here. */
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
/* Declare overridden functions. */
# if @REPLACE_OPEN@
# undef open
# define open rpl_open
-extern int open (const char *filename, int flags, ...);
+extern int open (const char *filename, int flags, ...) _GL_ARG_NONNULL ((1));
# endif
#endif
# define openat rpl_openat
# endif
# if !@HAVE_OPENAT@ || @REPLACE_OPENAT@
-int openat (int fd, char const *file, int flags, /* mode_t mode */ ...);
+int openat (int fd, char const *file, int flags, /* mode_t mode */ ...)
+ _GL_ARG_NONNULL ((2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef openat
/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2001, 2002, 2003,
- 2005, 2007 Free Software Foundation, Inc.
+ 2005, 2007, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
#ifndef _FNMATCH_H
#define _FNMATCH_H 1
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
#ifdef __cplusplus
extern "C" {
#endif
/* Match NAME against the file name pattern PATTERN,
returning zero if it matches, FNM_NOMATCH if not. */
extern int fnmatch (const char *__pattern, const char *__name,
- int __flags);
+ int __flags)
+ _GL_ARG_NONNULL ((1, 2));
#ifdef __cplusplus
}
/* Get address information (partial implementation).
- Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software
- Foundation, Inc.
+ Copyright (C) 1997, 2001-2002, 2004-2009 Free Software Foundation, Inc.
Contributed by Simon Josefsson <simon@josefsson.org>.
This program is free software; you can redistribute it and/or modify
#include <config.h>
+/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
+ optimizes away the sa == NULL test below. */
+#define _GL_ARG_NONNULL(params)
+
#include <netdb.h>
#if HAVE_NETINET_IN_H
#include <config.h>
+/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
+ optimizes away the lineptr == NULL || n == NULL || fp == NULL tests below. */
+#define _GL_ARG_NONNULL(params)
+
#include <stdio.h>
#include <limits.h>
# endif
#endif
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
#ifdef __cplusplus
extern "C" {
#endif
the environment, then do not permute arguments. */
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
- __THROW;
+ __THROW _GL_ARG_NONNULL ((2, 3));
#ifndef __need_getopt
extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
const char *__shortopts,
const struct option *__longopts, int *__longind)
- __THROW;
+ __THROW _GL_ARG_NONNULL ((2, 3));
extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
const char *__shortopts,
const struct option *__longopts, int *__longind)
- __THROW;
+ __THROW _GL_ARG_NONNULL ((2, 3));
#endif
-/* Copyright (C) 1991,92,95-98,2000,2001,2004-2007 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,95-98,2000,2001,2004-2007, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
#if !defined __USE_FILE_OFFSET64 || __GNUC__ < 2 || defined __GLOB_GNULIB
extern int glob (const char *_Restrict_ __pattern, int __flags,
int (*__errfunc) (const char *, int),
- glob_t *_Restrict_ __pglob) __THROW;
+ glob_t *_Restrict_ __pglob) __THROW _GL_ARG_NONNULL ((1, 4));
/* Free storage allocated in PGLOB by a previous `glob' call. */
-extern void globfree (glob_t *__pglob) __THROW;
+extern void globfree (glob_t *__pglob) __THROW _GL_ARG_NONNULL ((1));
#else
extern int __REDIRECT_NTH (glob, (const char *_Restrict_ __pattern,
int __flags,
#if defined __USE_LARGEFILE64 && !defined __GLOB_GNULIB
extern int glob64 (const char *_Restrict_ __pattern, int __flags,
int (*__errfunc) (const char *, int),
- glob64_t *_Restrict_ __pglob) __THROW;
+ glob64_t *_Restrict_ __pglob)
+ __THROW _GL_ARG_NONNULL ((1, 4));
-extern void globfree64 (glob64_t *__pglob) __THROW;
+extern void globfree64 (glob64_t *__pglob) __THROW _GL_ARG_NONNULL ((1));
#endif
This function is not part of the interface specified by POSIX.2
but several programs want to use it. */
-extern int glob_pattern_p (const char *__pattern, int __quote) __THROW;
+extern int glob_pattern_p (const char *__pattern, int __quote)
+ __THROW _GL_ARG_NONNULL ((1));
#endif
__END_DECLS
# include <config.h>
#endif
+/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
+ optimizes away the pattern == NULL || pglob == NULL tests below. */
+#define _GL_ARG_NONNULL(params)
+
#include <glob.h>
#include <errno.h>
/* glob.h -- Find a path matching a pattern.
- Copyright (C) 2005-2007 Free Software Foundation, Inc.
+ Copyright (C) 2005-2007, 2009 Free Software Foundation, Inc.
Written by Derek Price <derek@ximbiot.com> & Paul Eggert <eggert@CS.UCLA.EDU>
# define __THROW
#endif
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
#ifndef __size_t
# define __size_t size_t
#endif
/* A GNU-like <iconv.h>.
- 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
#ifndef _GL_ICONV_H
#define _GL_ICONV_H
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
#ifdef __cplusplus
extern "C" {
#endif
/* An iconv_open wrapper that supports the IANA standardized encoding names
("ISO-8859-1" etc.) as far as possible. */
# define iconv_open rpl_iconv_open
-extern iconv_t iconv_open (const char *tocode, const char *fromcode);
+extern iconv_t iconv_open (const char *tocode, const char *fromcode)
+ _GL_ARG_NONNULL ((1, 2));
#endif
#if @REPLACE_ICONV_UTF@
/* The definition of GL_LINK_WARNING is copied here. */
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
/* 7.8.1 Macros for format specifiers */
#if ! defined __cplusplus || defined __STDC_FORMAT_MACROS
#if @GNULIB_STRTOIMAX@
# if !@HAVE_DECL_STRTOIMAX@
-extern intmax_t strtoimax (const char *, char **, int);
+extern intmax_t strtoimax (const char *, char **, int) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef strtoimax
#if @GNULIB_STRTOUMAX@
# if !@HAVE_DECL_STRTOUMAX@
-extern uintmax_t strtoumax (const char *, char **, int);
+extern uintmax_t strtoumax (const char *, char **, int) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef strtoumax
# include <xlocale.h>
#endif
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
/* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C.
On systems that don't define it, use the same value as GNU libintl. */
#if !defined LC_MESSAGES
# if @REPLACE_DUPLOCALE@
# undef duplocale
# define duplocale rpl_duplocale
-extern locale_t duplocale (locale_t locale);
+extern locale_t duplocale (locale_t locale) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef duplocale
/* The definition of GL_LINK_WARNING is copied here. */
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
#ifdef __cplusplus
extern "C" {
#if @GNULIB_FREXP@
# if @REPLACE_FREXP@
# define frexp rpl_frexp
-extern double frexp (double x, int *expptr);
+extern double frexp (double x, int *expptr) _GL_ARG_NONNULL ((2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef frexp
# define frexpl rpl_frexpl
#endif
#if (@GNULIB_FREXPL@ && @REPLACE_FREXPL@) || !@HAVE_DECL_FREXPL@
-extern long double frexpl (long double x, int *expptr);
+extern long double frexpl (long double x, int *expptr) _GL_ARG_NONNULL ((2));
#endif
#if !@GNULIB_FREXPL@ && defined GNULIB_POSIXCHECK
# undef frexpl
/* Provide a netdb.h header file for systems lacking it (read: MinGW).
- Copyright (C) 2008 Free Software Foundation, Inc.
+ Copyright (C) 2008-2009 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify
/* Get netdb.h definitions such as struct hostent for MinGW. */
#include <sys/socket.h>
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
/* Declarations for a platform that lacks <netdb.h>, or where it is
incomplete. */
extern int getaddrinfo (const char *restrict nodename,
const char *restrict servname,
const struct addrinfo *restrict hints,
- struct addrinfo **restrict res);
+ struct addrinfo **restrict res)
+ _GL_ARG_NONNULL ((4));
# endif
# if !@HAVE_DECL_FREEADDRINFO@
/* Free `addrinfo' structure AI including associated storage.
For more details, see the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
-extern void freeaddrinfo (struct addrinfo *ai);
+extern void freeaddrinfo (struct addrinfo *ai) _GL_ARG_NONNULL ((1));
# endif
# if !@HAVE_DECL_GAI_STRERROR@
extern int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
char *restrict node, socklen_t nodelen,
char *restrict service, socklen_t servicelen,
- int flags);
+ int flags)
+ _GL_ARG_NONNULL ((1));
# endif
/* Possible flags for getnameinfo. */
/*
- Copyright (C) 1995, 2005, 2008 Free Software Foundation, Inc.
+ Copyright (C) 1995, 2005, 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
#include <config.h>
+/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
+ optimizes away the buf == NULL, arg_state == NULL, result == NULL tests
+ below. */
+#define _GL_ARG_NONNULL(params)
+
#include <errno.h>
#include <limits.h>
#include <stddef.h>
/* A GNU-like <search.h>.
- 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
/* The definition of GL_LINK_WARNING is copied here. */
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
#ifdef __cplusplus
extern "C" {
If one is found, it is returned. Otherwise, a new element equal to KEY
is inserted in the tree and is returned. */
extern void * tsearch (const void *key, void **vrootp,
- int (*compar) (const void *, const void *));
+ int (*compar) (const void *, const void *))
+ _GL_ARG_NONNULL ((1, 2, 3));
/* Searches an element in the tree *VROOTP that compares equal to KEY.
If one is found, it is returned. Otherwise, NULL is returned. */
extern void * tfind (const void *key, void *const *vrootp,
- int (*compar) (const void *, const void *));
+ int (*compar) (const void *, const void *))
+ _GL_ARG_NONNULL ((1, 2, 3));
/* Searches an element in the tree *VROOTP that compares equal to KEY.
If one is found, it is removed from the tree, and its parent node is
returned. Otherwise, NULL is returned. */
extern void * tdelete (const void *key, void **vrootp,
- int (*compar) (const void *, const void *));
+ int (*compar) (const void *, const void *))
+ _GL_ARG_NONNULL ((1, 2, 3));
/* Perform a depth-first, left-to-right traversal of the tree VROOT.
The ACTION function is called:
2. an indicator which visit of the node this is,
3. the level of the node in the tree (0 for the root). */
extern void twalk (const void *vroot,
- void (*action) (const void *, VISIT, int));
+ void (*action) (const void *, VISIT, int))
+ _GL_ARG_NONNULL ((2));
# endif
#elif defined GNULIB_POSIXCHECK
#if !_LIBC
# include <config.h>
#endif
+
+/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
+ optimizes away the name == NULL test below. */
+#define _GL_ARG_NONNULL(params)
+
#include <alloca.h>
/* Specification. */
/* The definition of GL_LINK_WARNING is copied here. */
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
/* Define pid_t, uid_t.
Also, mingw defines sigset_t not in <signal.h>, but in <sys/types.h>. */
#include <sys/types.h>
# endif
/* Test whether a given signal is contained in a signal set. */
-extern int sigismember (const sigset_t *set, int sig);
+extern int sigismember (const sigset_t *set, int sig) _GL_ARG_NONNULL ((1));
/* Initialize a signal set to the empty set. */
-extern int sigemptyset (sigset_t *set);
+extern int sigemptyset (sigset_t *set) _GL_ARG_NONNULL ((1));
/* Add a signal to a signal set. */
-extern int sigaddset (sigset_t *set, int sig);
+extern int sigaddset (sigset_t *set, int sig) _GL_ARG_NONNULL ((1));
/* Remove a signal from a signal set. */
-extern int sigdelset (sigset_t *set, int sig);
+extern int sigdelset (sigset_t *set, int sig) _GL_ARG_NONNULL ((1));
/* Fill a signal set with all possible signals. */
-extern int sigfillset (sigset_t *set);
+extern int sigfillset (sigset_t *set) _GL_ARG_NONNULL ((1));
/* Return the set of those blocked signals that are pending. */
-extern int sigpending (sigset_t *set);
+extern int sigpending (sigset_t *set) _GL_ARG_NONNULL ((1));
/* If OLD_SET is not NULL, put the current set of blocked signals in *OLD_SET.
Then, if SET is not NULL, affect the current set of blocked signals by
/* Definitions for POSIX spawn interface.
- Copyright (C) 2000, 2003, 2004, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2003, 2004, 2008-2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
/* The definition of GL_LINK_WARNING is copied here. */
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
/* Data structure to contain attributes for thread creation. */
#if @REPLACE_POSIX_SPAWN@
const posix_spawn_file_actions_t *_Restrict_ __file_actions,
const posix_spawnattr_t *_Restrict_ __attrp,
char *const argv[_Restrict_arr_],
- char *const envp[_Restrict_arr_]);
+ char *const envp[_Restrict_arr_])
+ _GL_ARG_NONNULL ((2, 5, 6));
# endif
#endif
extern int posix_spawnp (pid_t *__pid, const char *__file,
const posix_spawn_file_actions_t *__file_actions,
const posix_spawnattr_t *__attrp,
- char *const argv[], char *const envp[]);
+ char *const argv[], char *const envp[])
+ _GL_ARG_NONNULL ((2, 5, 6));
# endif
#endif
# define posix_spawnattr_init rpl_posix_spawnattr_init
# endif
# if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
-extern int posix_spawnattr_init (posix_spawnattr_t *__attr) __THROW;
+extern int posix_spawnattr_init (posix_spawnattr_t *__attr)
+ __THROW _GL_ARG_NONNULL ((1));
# endif
#endif
# define posix_spawnattr_destroy rpl_posix_spawnattr_destroy
# endif
# if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
-extern int posix_spawnattr_destroy (posix_spawnattr_t *__attr) __THROW;
+extern int posix_spawnattr_destroy (posix_spawnattr_t *__attr)
+ __THROW _GL_ARG_NONNULL ((1));
# endif
#endif
# if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
extern int posix_spawnattr_getsigdefault (const posix_spawnattr_t *_Restrict_ __attr,
sigset_t *_Restrict_ __sigdefault)
- __THROW;
+ __THROW _GL_ARG_NONNULL ((1, 2));
# endif
#endif
# if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
extern int posix_spawnattr_setsigdefault (posix_spawnattr_t *_Restrict_ __attr,
const sigset_t *_Restrict_ __sigdefault)
- __THROW;
+ __THROW _GL_ARG_NONNULL ((1, 2));
# endif
#endif
# endif
# if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
extern int posix_spawnattr_getsigmask (const posix_spawnattr_t *_Restrict_ __attr,
- sigset_t *_Restrict_ __sigmask) __THROW;
+ sigset_t *_Restrict_ __sigmask)
+ __THROW _GL_ARG_NONNULL ((1, 2));
# endif
#endif
# if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
extern int posix_spawnattr_setsigmask (posix_spawnattr_t *_Restrict_ __attr,
const sigset_t *_Restrict_ __sigmask)
- __THROW;
+ __THROW _GL_ARG_NONNULL ((1, 2));
# endif
#endif
# endif
# if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
extern int posix_spawnattr_getflags (const posix_spawnattr_t *_Restrict_ __attr,
- short int *_Restrict_ __flags) __THROW;
+ short int *_Restrict_ __flags)
+ __THROW _GL_ARG_NONNULL ((1, 2));
# endif
#endif
# endif
# if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
extern int posix_spawnattr_setflags (posix_spawnattr_t *__attr,
- short int __flags) __THROW;
+ short int __flags)
+ __THROW _GL_ARG_NONNULL ((1));
# endif
#endif
# if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
extern int posix_spawnattr_getpgroup (const posix_spawnattr_t *_Restrict_ __attr,
pid_t *_Restrict_ __pgroup)
- __THROW;
+ __THROW _GL_ARG_NONNULL ((1, 2));
# endif
#endif
# endif
# if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
extern int posix_spawnattr_setpgroup (posix_spawnattr_t *__attr,
- pid_t __pgroup) __THROW;
+ pid_t __pgroup)
+ __THROW _GL_ARG_NONNULL ((1));
# endif
#endif
# if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
extern int posix_spawnattr_getschedpolicy (const posix_spawnattr_t *_Restrict_ __attr,
int *_Restrict_ __schedpolicy)
- __THROW;
+ __THROW _GL_ARG_NONNULL ((1, 2));
# endif
#endif
# endif
# if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
extern int posix_spawnattr_setschedpolicy (posix_spawnattr_t *__attr,
- int __schedpolicy) __THROW;
+ int __schedpolicy)
+ __THROW _GL_ARG_NONNULL ((1));
# endif
#endif
# endif
# if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
extern int posix_spawnattr_getschedparam (const posix_spawnattr_t *_Restrict_ __attr,
- struct sched_param *_Restrict_ __schedparam) __THROW;
+ struct sched_param *_Restrict_ __schedparam)
+ __THROW _GL_ARG_NONNULL ((1, 2));
# endif
#endif
# endif
# if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
extern int posix_spawnattr_setschedparam (posix_spawnattr_t *_Restrict_ __attr,
- const struct sched_param *_Restrict_ __schedparam) __THROW;
+ const struct sched_param *_Restrict_ __schedparam)
+ __THROW _GL_ARG_NONNULL ((1, 2));
# endif
#endif
# define posix_spawn_file_actions_init rpl_posix_spawn_file_actions_init
# endif
# if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
-extern int posix_spawn_file_actions_init (posix_spawn_file_actions_t *__file_actions) __THROW;
+extern int posix_spawn_file_actions_init (posix_spawn_file_actions_t *__file_actions)
+ __THROW _GL_ARG_NONNULL ((1));
# endif
#endif
# define posix_spawn_file_actions_destroy rpl_posix_spawn_file_actions_destroy
# endif
# if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
-extern int posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *__file_actions) __THROW;
+extern int posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *__file_actions)
+ __THROW _GL_ARG_NONNULL ((1));
# endif
#endif
int __fd,
const char *_Restrict_ __path,
int __oflag, mode_t __mode)
- __THROW;
+ __THROW _GL_ARG_NONNULL ((1, 3));
# endif
#endif
# if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
extern int posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *__file_actions,
int __fd)
- __THROW;
+ __THROW _GL_ARG_NONNULL ((1));
# endif
#endif
# endif
# if !@HAVE_POSIX_SPAWN@ || @REPLACE_POSIX_SPAWN@
extern int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *__file_actions,
- int __fd, int __newfd) __THROW;
+ int __fd, int __newfd)
+ __THROW _GL_ARG_NONNULL ((1));
# endif
#endif
/* The definition of GL_LINK_WARNING is copied here. */
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
#ifdef __cplusplus
extern "C" {
# endif
# if @REPLACE_DPRINTF@ || !@HAVE_DPRINTF@
extern int dprintf (int fd, const char *format, ...)
- __attribute__ ((__format__ (__printf__, 2, 3)));
+ __attribute__ ((__format__ (__printf__, 2, 3))) _GL_ARG_NONNULL ((2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef dprintf
# if @REPLACE_FCLOSE@
# define fclose rpl_fclose
/* Close STREAM and its underlying file descriptor. */
-extern int fclose (FILE *stream);
+extern int fclose (FILE *stream) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef fclose
# if @REPLACE_FOPEN@
# undef fopen
# define fopen rpl_fopen
-extern FILE * fopen (const char *filename, const char *mode);
+extern FILE * fopen (const char *filename, const char *mode)
+ _GL_ARG_NONNULL ((1, 2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef fopen
# if @REPLACE_FPRINTF@
# define fprintf rpl_fprintf
extern int fprintf (FILE *fp, const char *format, ...)
- __attribute__ ((__format__ (__printf__, 2, 3)));
+ __attribute__ ((__format__ (__printf__, 2, 3)))
+ _GL_ARG_NONNULL ((1, 2));
# endif
#elif @GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
# define fprintf rpl_fprintf
extern int fprintf (FILE *fp, const char *format, ...)
- __attribute__ ((__format__ (__printf__, 2, 3)));
+ __attribute__ ((__format__ (__printf__, 2, 3)))
+ _GL_ARG_NONNULL ((1, 2));
#elif defined GNULIB_POSIXCHECK
# undef fprintf
# define fprintf \
was before the write calls. When discarding pending input, the file
position is advanced to match the end of the previously read input.
Return 0 if successful. Upon error, return -1 and set errno. */
- extern int fpurge (FILE *gl_stream);
+ extern int fpurge (FILE *gl_stream) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef fpurge
#if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
# undef fputc
# define fputc rpl_fputc
-extern int fputc (int c, FILE *stream);
+extern int fputc (int c, FILE *stream) _GL_ARG_NONNULL ((2));
#endif
#if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
# undef fputs
# define fputs rpl_fputs
-extern int fputs (const char *string, FILE *stream);
+extern int fputs (const char *string, FILE *stream) _GL_ARG_NONNULL ((1, 2));
#endif
#if @GNULIB_FREOPEN@
# if @REPLACE_FREOPEN@
# undef freopen
# define freopen rpl_freopen
-extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
+extern FILE * freopen (const char *filename, const char *mode, FILE *stream)
+ _GL_ARG_NONNULL ((2, 3));
# endif
#elif defined GNULIB_POSIXCHECK
# undef freopen
#endif
#if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
-extern int rpl_fseek (FILE *fp, long offset, int whence);
+extern int rpl_fseek (FILE *fp, long offset, int whence) _GL_ARG_NONNULL ((1));
# undef fseek
# if defined GNULIB_POSIXCHECK
# define fseek(f,o,w) \
/* Provide fseek, fseeko functions that are aware of a preceding
fflush(), and which detect pipes. */
# define fseeko rpl_fseeko
-extern int fseeko (FILE *fp, off_t offset, int whence);
+extern int fseeko (FILE *fp, off_t offset, int whence) _GL_ARG_NONNULL ((1));
# if !@GNULIB_FSEEK@
# undef fseek
# define fseek(f,o,w) \
#endif
#if @GNULIB_FTELL@ && @REPLACE_FTELL@
-extern long rpl_ftell (FILE *fp);
+extern long rpl_ftell (FILE *fp) _GL_ARG_NONNULL ((1));
# undef ftell
# if GNULIB_POSIXCHECK
# define ftell(f) \
#if @GNULIB_FTELLO@
# if @REPLACE_FTELLO@
# define ftello rpl_ftello
-extern off_t ftello (FILE *fp);
+extern off_t ftello (FILE *fp) _GL_ARG_NONNULL ((1));
# if !@GNULIB_FTELL@
# undef ftell
# define ftell(f) \
#if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
# undef fwrite
# define fwrite rpl_fwrite
-extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream);
+extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
+ _GL_ARG_NONNULL ((1, 4));
#endif
#if @GNULIB_GETDELIM@
Return the number of bytes read and stored at *LINEPTR (not including the
NUL terminator), or -1 on error or EOF. */
extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
- FILE *stream);
+ FILE *stream)
+ _GL_ARG_NONNULL ((1, 2, 4));
# endif
#elif defined GNULIB_POSIXCHECK
# undef getdelim
bytes of space. It is realloc'd as necessary.
Return the number of bytes read and stored at *LINEPTR (not including the
NUL terminator), or -1 on error or EOF. */
-extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
+extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream)
+ _GL_ARG_NONNULL ((1, 2, 3));
# endif
#elif defined GNULIB_POSIXCHECK
# undef getline
memory allocation error, call obstack_alloc_failed_handler. Upon
other error, return -1. */
extern int obstack_printf (struct obstack *obs, const char *format, ...)
- __attribute__ ((__format__ (__printf__, 2, 3)));
+ __attribute__ ((__format__ (__printf__, 2, 3))) _GL_ARG_NONNULL ((1, 2));
extern int obstack_vprintf (struct obstack *obs, const char *format,
va_list args)
- __attribute__ ((__format__ (__printf__, 2, 0)));
+ __attribute__ ((__format__ (__printf__, 2, 0))) _GL_ARG_NONNULL ((1, 2));
# endif
#endif
# if @REPLACE_POPEN@
# undef popen
# define popen rpl_popen
-extern FILE *popen (const char *cmd, const char *mode);
+extern FILE *popen (const char *cmd, const char *mode)
+ _GL_ARG_NONNULL ((1, 2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef popen
/* Don't break __attribute__((format(printf,M,N))). */
# define printf __printf__
extern int printf (const char *format, ...)
- __attribute__ ((__format__ (__printf__, 1, 2)));
+ __attribute__ ((__format__ (__printf__, 1, 2))) _GL_ARG_NONNULL ((1));
# endif
#elif @GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
/* Don't break __attribute__((format(printf,M,N))). */
# define printf __printf__
extern int printf (const char *format, ...)
- __attribute__ ((__format__ (__printf__, 1, 2)));
+ __attribute__ ((__format__ (__printf__, 1, 2))) _GL_ARG_NONNULL ((1));
#elif defined GNULIB_POSIXCHECK
# undef printf
# define printf \
#if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
# undef putc
# define putc rpl_fputc
-extern int putc (int c, FILE *stream);
+extern int putc (int c, FILE *stream) _GL_ARG_NONNULL ((2));
#endif
#if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
#if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
# undef puts
# define puts rpl_puts
-extern int puts (const char *string);
+extern int puts (const char *string) _GL_ARG_NONNULL ((1));
#endif
#if @GNULIB_REMOVE@
# if @REPLACE_REMOVE@
# undef remove
# define remove rpl_remove
-extern int remove (const char *name);
+extern int remove (const char *name) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef remove
# if @REPLACE_RENAME@
# undef rename
# define rename rpl_rename
-extern int rename (const char *old_filename, const char *new_filename);
+extern int rename (const char *old_filename, const char *new_filename)
+ _GL_ARG_NONNULL ((1, 2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef rename
# define renameat rpl_renameat
# endif
# if !@HAVE_RENAMEAT@ || @REPLACE_RENAMEAT@
-extern int renameat (int fd1, char const *file1, int fd2, char const *file2);
+extern int renameat (int fd1, char const *file1, int fd2, char const *file2)
+ _GL_ARG_NONNULL ((2, 4));
# endif
#elif defined GNULIB_POSIXCHECK
# undef renameat
# endif
# if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
extern int snprintf (char *str, size_t size, const char *format, ...)
- __attribute__ ((__format__ (__printf__, 3, 4)));
+ __attribute__ ((__format__ (__printf__, 3, 4)))
+ _GL_ARG_NONNULL ((3));
# endif
#elif defined GNULIB_POSIXCHECK
# undef snprintf
# if @REPLACE_SPRINTF@
# define sprintf rpl_sprintf
extern int sprintf (char *str, const char *format, ...)
- __attribute__ ((__format__ (__printf__, 2, 3)));
+ __attribute__ ((__format__ (__printf__, 2, 3)))
+ _GL_ARG_NONNULL ((1, 2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef sprintf
*RESULT and return the number of resulting bytes, excluding the trailing
NUL. Upon memory allocation error, or some other error, return -1. */
extern int asprintf (char **result, const char *format, ...)
- __attribute__ ((__format__ (__printf__, 2, 3)));
+ __attribute__ ((__format__ (__printf__, 2, 3))) _GL_ARG_NONNULL ((1, 2));
extern int vasprintf (char **result, const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 2, 0)));
+ __attribute__ ((__format__ (__printf__, 2, 0))) _GL_ARG_NONNULL ((1, 2));
# endif
#endif
# endif
# if @REPLACE_VDPRINTF@ || !@HAVE_VDPRINTF@
extern int vdprintf (int fd, const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 2, 0)));
+ __attribute__ ((__format__ (__printf__, 2, 0))) _GL_ARG_NONNULL ((2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef vdprintf
# if @REPLACE_VFPRINTF@
# define vfprintf rpl_vfprintf
extern int vfprintf (FILE *fp, const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 2, 0)));
+ __attribute__ ((__format__ (__printf__, 2, 0)))
+ _GL_ARG_NONNULL ((1, 2));
# endif
#elif @GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
# define vfprintf rpl_vfprintf
extern int vfprintf (FILE *fp, const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 2, 0)));
+ __attribute__ ((__format__ (__printf__, 2, 0)))
+ _GL_ARG_NONNULL ((1, 2));
#elif defined GNULIB_POSIXCHECK
# undef vfprintf
# define vfprintf(s,f,a) \
# if @REPLACE_VPRINTF@
# define vprintf rpl_vprintf
extern int vprintf (const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 1, 0)));
+ __attribute__ ((__format__ (__printf__, 1, 0))) _GL_ARG_NONNULL ((1));
# endif
#elif @GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
# define vprintf rpl_vprintf
extern int vprintf (const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 1, 0)));
+ __attribute__ ((__format__ (__printf__, 1, 0))) _GL_ARG_NONNULL ((1));
#elif defined GNULIB_POSIXCHECK
# undef vprintf
# define vprintf(f,a) \
# endif
# if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 3, 0)));
+ __attribute__ ((__format__ (__printf__, 3, 0)))
+ _GL_ARG_NONNULL ((3));
# endif
#elif defined GNULIB_POSIXCHECK
# undef vsnprintf
# if @REPLACE_VSPRINTF@
# define vsprintf rpl_vsprintf
extern int vsprintf (char *str, const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 2, 0)));
+ __attribute__ ((__format__ (__printf__, 2, 0)))
+ _GL_ARG_NONNULL ((1, 2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef vsprintf
/* The definition of GL_LINK_WARNING is copied here. */
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
/* Some systems do not define EXIT_*, despite otherwise supporting C89. */
#ifndef EXIT_SUCCESS
# if !@HAVE_ATOLL@
/* Parse a signed decimal integer.
Returns the value of the integer. Errors are not detected. */
-extern long long atoll (const char *string);
+extern long long atoll (const char *string) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef atoll
# define canonicalize_file_name rpl_canonicalize_file_name
# endif
# if !@HAVE_CANONICALIZE_FILE_NAME@ || @REPLACE_CANONICALIZE_FILE_NAME@
-extern char *canonicalize_file_name (const char *name);
+extern char *canonicalize_file_name (const char *name) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef canonicalize_file_name
The three numbers are the load average of the last 1 minute, the last 5
minutes, and the last 15 minutes, respectively.
LOADAVG is an array of NELEM numbers. */
-extern int getloadavg (double loadavg[], int nelem);
+extern int getloadavg (double loadavg[], int nelem) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef getloadavg
For more details see the POSIX:2001 specification.
http://www.opengroup.org/susv3xsh/getsubopt.html */
# if !@HAVE_GETSUBOPT@
-extern int getsubopt (char **optionp, char *const *tokens, char **valuep);
+extern int getsubopt (char **optionp, char *const *tokens, char **valuep)
+ _GL_ARG_NONNULL ((1, 2, 3));
# endif
#elif defined GNULIB_POSIXCHECK
# undef getsubopt
they are replaced with a string that makes the directory name unique.
Returns TEMPLATE, or a null pointer if it cannot get a unique name.
The directory is created mode 700. */
-extern char * mkdtemp (char * /*template*/);
+extern char * mkdtemp (char * /*template*/) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef mkdtemp
implementation.
Returns the open file descriptor if successful, otherwise -1 and errno
set. */
-extern int mkostemp (char * /*template*/, int /*flags*/);
+extern int mkostemp (char * /*template*/, int /*flags*/) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef mkostemp
implementation.
Returns the open file descriptor if successful, otherwise -1 and errno
set. */
-extern int mkostemps (char * /*template*/, int /*suffixlen*/, int /*flags*/);
+extern int mkostemps (char * /*template*/, int /*suffixlen*/, int /*flags*/)
+ _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef mkostemps
Returns the open file descriptor if successful, otherwise -1 and errno
set. */
# define mkstemp rpl_mkstemp
-extern int mkstemp (char * /*template*/);
+extern int mkstemp (char * /*template*/) _GL_ARG_NONNULL ((1));
# else
/* On MacOS X 10.3, only <unistd.h> declares mkstemp. */
# include <unistd.h>
implementation.
Returns the open file descriptor if successful, otherwise -1 and errno
set. */
-extern int mkstemps (char * /*template*/, int /*suffixlen*/);
+extern int mkstemps (char * /*template*/, int /*suffixlen*/)
+ _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef mkstemps
# if @REPLACE_PUTENV@
# undef putenv
# define putenv rpl_putenv
-extern int putenv (char *string);
+extern int putenv (char *string) _GL_ARG_NONNULL ((1));
# endif
#endif
# define RAND_MAX 2147483647
# endif
-int srandom_r (unsigned int seed, struct random_data *rand_state);
+int srandom_r (unsigned int seed, struct random_data *rand_state)
+ _GL_ARG_NONNULL ((2));
int initstate_r (unsigned int seed, char *buf, size_t buf_size,
- struct random_data *rand_state);
-int setstate_r (char *arg_state, struct random_data *rand_state);
-int random_r (struct random_data *buf, int32_t *result);
+ struct random_data *rand_state)
+ _GL_ARG_NONNULL ((2, 4));
+int setstate_r (char *arg_state, struct random_data *rand_state)
+ _GL_ARG_NONNULL ((1, 2));
+int random_r (struct random_data *buf, int32_t *result)
+ _GL_ARG_NONNULL ((1, 2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef random_r
# define realpath rpl_realpath
# endif
# if !@HAVE_REALPATH@ || @REPLACE_REALPATH@
-extern char *realpath (const char *name, char *resolved);
+extern char *realpath (const char *name, char *resolved) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef realpath
# if !@HAVE_RPMATCH@
/* Test a user response to a question.
Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
-extern int rpmatch (const char *response);
+extern int rpmatch (const char *response) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef rpmatch
# if !@HAVE_SETENV@ || @REPLACE_SETENV@
/* Set NAME to VALUE in the environment.
If REPLACE is nonzero, overwrite an existing value. */
-extern int setenv (const char *name, const char *value, int replace);
+extern int setenv (const char *name, const char *value, int replace)
+ _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef setenv
# endif
# if !@HAVE_STRTOD@ || @REPLACE_STRTOD@
/* Parse a double from STRING, updating ENDP if appropriate. */
-extern double strtod (const char *str, char **endp);
+extern double strtod (const char *str, char **endp) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef strtod
stored in *ENDPTR.
Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
to ERANGE. */
-extern long long strtoll (const char *string, char **endptr, int base);
+extern long long strtoll (const char *string, char **endptr, int base)
+ _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef strtoll
stored in *ENDPTR.
Upon overflow, the return value is ULLONG_MAX, and errno is set to
ERANGE. */
-extern unsigned long long strtoull (const char *string, char **endptr, int base);
+extern unsigned long long strtoull (const char *string, char **endptr, int base)
+ _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef strtoull
# endif
# if !@HAVE_UNSETENV@ || @REPLACE_UNSETENV@
/* Remove the variable NAME from the environment. */
-extern int unsetenv (const char *name);
+extern int unsetenv (const char *name) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef unsetenv
/* The definition of GL_LINK_WARNING is copied here. */
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
#ifdef __cplusplus
extern "C" {
# if @REPLACE_MEMCHR@
# define memchr rpl_memchr
extern void *memchr (void const *__s, int __c, size_t __n)
- __attribute__ ((__pure__));
+ __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef memchr
# if ! @HAVE_DECL_MEMMEM@ || @REPLACE_MEMMEM@
extern void *memmem (void const *__haystack, size_t __haystack_len,
void const *__needle, size_t __needle_len)
- __attribute__ ((__pure__));
+ __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 3));
# endif
#elif defined GNULIB_POSIXCHECK
# undef memmem
#if @GNULIB_MEMPCPY@
# if ! @HAVE_MEMPCPY@
extern void *mempcpy (void *restrict __dest, void const *restrict __src,
- size_t __n);
+ size_t __n)
+ _GL_ARG_NONNULL ((1, 2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef mempcpy
#if @GNULIB_MEMRCHR@
# if ! @HAVE_DECL_MEMRCHR@
extern void *memrchr (void const *, int, size_t)
- __attribute__ ((__pure__));
+ __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef memrchr
#if @GNULIB_RAWMEMCHR@
# if ! @HAVE_RAWMEMCHR@
extern void *rawmemchr (void const *__s, int __c_in)
- __attribute__ ((__pure__));
+ __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef rawmemchr
/* Copy SRC to DST, returning the address of the terminating '\0' in DST. */
#if @GNULIB_STPCPY@
# if ! @HAVE_STPCPY@
-extern char *stpcpy (char *restrict __dst, char const *restrict __src);
+extern char *stpcpy (char *restrict __dst, char const *restrict __src)
+ _GL_ARG_NONNULL ((1, 2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef stpcpy
# if ! @HAVE_STPNCPY@
# define stpncpy gnu_stpncpy
extern char *stpncpy (char *restrict __dst, char const *restrict __src,
- size_t __n);
+ size_t __n)
+ _GL_ARG_NONNULL ((1, 2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef stpncpy
#if @GNULIB_STRCHRNUL@
# if ! @HAVE_STRCHRNUL@
extern char *strchrnul (char const *__s, int __c_in)
- __attribute__ ((__pure__));
+ __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef strchrnul
# define strdup rpl_strdup
# endif
# if !(@HAVE_DECL_STRDUP@ || defined strdup) || @REPLACE_STRDUP@
-extern char *strdup (char const *__s);
+extern char *strdup (char const *__s) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef strdup
# define strndup rpl_strndup
# endif
# if @REPLACE_STRNDUP@ || ! @HAVE_DECL_STRNDUP@
-extern char *strndup (char const *__string, size_t __n);
+extern char *strndup (char const *__string, size_t __n) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef strndup
#if @GNULIB_STRNLEN@
# if ! @HAVE_DECL_STRNLEN@
extern size_t strnlen (char const *__string, size_t __maxlen)
- __attribute__ ((__pure__));
+ __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef strnlen
#if @GNULIB_STRPBRK@
# if ! @HAVE_STRPBRK@
extern char *strpbrk (char const *__s, char const *__accept)
- __attribute__ ((__pure__));
+ __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2));
# endif
# if defined GNULIB_POSIXCHECK
/* strpbrk() assumes the second argument is a list of single-byte characters.
See also strtok_r(). */
#if @GNULIB_STRSEP@
# if ! @HAVE_STRSEP@
-extern char *strsep (char **restrict __stringp, char const *restrict __delim);
+extern char *strsep (char **restrict __stringp, char const *restrict __delim)
+ _GL_ARG_NONNULL ((1, 2));
# endif
# if defined GNULIB_POSIXCHECK
# undef strsep
#if @GNULIB_STRSTR@
# if @REPLACE_STRSTR@
# define strstr rpl_strstr
-char *strstr (const char *haystack, const char *needle)
- __attribute__ ((__pure__));
+extern char *strstr (const char *haystack, const char *needle)
+ __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2));
# endif
#elif defined GNULIB_POSIXCHECK
/* strstr() does not work with multibyte strings if the locale encoding is
# endif
# if ! @HAVE_STRCASESTR@ || @REPLACE_STRCASESTR@
extern char *strcasestr (const char *haystack, const char *needle)
- __attribute__ ((__pure__));
+ __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2));
# endif
#elif defined GNULIB_POSIXCHECK
/* strcasestr() does not work with multibyte strings:
# endif
# if ! @HAVE_DECL_STRTOK_R@ || @REPLACE_STRTOK_R@
extern char *strtok_r (char *restrict s, char const *restrict delim,
- char **restrict save_ptr);
+ char **restrict save_ptr)
+ _GL_ARG_NONNULL ((2, 3));
# endif
# if defined GNULIB_POSIXCHECK
# undef strtok_r
#if @GNULIB_MBSLEN@
/* Return the number of multibyte characters in the character string STRING.
This considers multibyte characters, unlike strlen, which counts bytes. */
-extern size_t mbslen (const char *string);
+extern size_t mbslen (const char *string) _GL_ARG_NONNULL ((1));
#endif
#if @GNULIB_MBSNLEN@
/* Return the number of multibyte characters in the character string starting
at STRING and ending at STRING + LEN. */
-extern size_t mbsnlen (const char *string, size_t len);
+extern size_t mbsnlen (const char *string, size_t len) _GL_ARG_NONNULL ((1));
#endif
#if @GNULIB_MBSCHR@
Unlike strchr(), this function works correctly in multibyte locales with
encodings such as GB18030. */
# define mbschr rpl_mbschr /* avoid collision with HP-UX function */
-extern char * mbschr (const char *string, int c);
+extern char * mbschr (const char *string, int c) _GL_ARG_NONNULL ((1));
#endif
#if @GNULIB_MBSRCHR@
Unlike strrchr(), this function works correctly in multibyte locales with
encodings such as GB18030. */
# define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */
-extern char * mbsrchr (const char *string, int c);
+extern char * mbsrchr (const char *string, int c) _GL_ARG_NONNULL ((1));
#endif
#if @GNULIB_MBSSTR@
string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK.
Unlike strstr(), this function works correctly in multibyte locales with
encodings different from UTF-8. */
-extern char * mbsstr (const char *haystack, const char *needle);
+extern char * mbsstr (const char *haystack, const char *needle)
+ _GL_ARG_NONNULL ((1, 2));
#endif
#if @GNULIB_MBSCASECMP@
Note: This function may, in multibyte locales, return 0 for strings of
different lengths!
Unlike strcasecmp(), this function works correctly in multibyte locales. */
-extern int mbscasecmp (const char *s1, const char *s2);
+extern int mbscasecmp (const char *s1, const char *s2)
+ _GL_ARG_NONNULL ((1, 2));
#endif
#if @GNULIB_MBSNCASECMP@
of different lengths!
Unlike strncasecmp(), this function works correctly in multibyte locales.
But beware that N is not a byte count but a character count! */
-extern int mbsncasecmp (const char *s1, const char *s2, size_t n);
+extern int mbsncasecmp (const char *s1, const char *s2, size_t n)
+ _GL_ARG_NONNULL ((1, 2));
#endif
#if @GNULIB_MBSPCASECMP@
smaller length than PREFIX!
Unlike strncasecmp(), this function works correctly in multibyte
locales. */
-extern char * mbspcasecmp (const char *string, const char *prefix);
+extern char * mbspcasecmp (const char *string, const char *prefix)
+ _GL_ARG_NONNULL ((1, 2));
#endif
#if @GNULIB_MBSCASESTR@
Note: This function may, in multibyte locales, return success even if
strlen (haystack) < strlen (needle) !
Unlike strcasestr(), this function works correctly in multibyte locales. */
-extern char * mbscasestr (const char *haystack, const char *needle);
+extern char * mbscasestr (const char *haystack, const char *needle)
+ _GL_ARG_NONNULL ((1, 2));
#endif
#if @GNULIB_MBSCSPN@
beginning of the string to this occurrence, or to the end of the string
if none exists.
Unlike strcspn(), this function works correctly in multibyte locales. */
-extern size_t mbscspn (const char *string, const char *accept);
+extern size_t mbscspn (const char *string, const char *accept)
+ _GL_ARG_NONNULL ((1, 2));
#endif
#if @GNULIB_MBSPBRK@
exists.
Unlike strpbrk(), this function works correctly in multibyte locales. */
# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
-extern char * mbspbrk (const char *string, const char *accept);
+extern char * mbspbrk (const char *string, const char *accept)
+ _GL_ARG_NONNULL ((1, 2));
#endif
#if @GNULIB_MBSSPN@
beginning of the string to this occurrence, or to the end of the string
if none exists.
Unlike strspn(), this function works correctly in multibyte locales. */
-extern size_t mbsspn (const char *string, const char *reject);
+extern size_t mbsspn (const char *string, const char *reject)
+ _GL_ARG_NONNULL ((1, 2));
#endif
#if @GNULIB_MBSSEP@
Caveat: The identity of the delimiting character is lost.
See also mbstok_r(). */
-extern char * mbssep (char **stringp, const char *delim);
+extern char * mbssep (char **stringp, const char *delim)
+ _GL_ARG_NONNULL ((1, 2));
#endif
#if @GNULIB_MBSTOK_R@
Caveat: The identity of the delimiting character is lost.
See also mbssep(). */
-extern char * mbstok_r (char *string, const char *delim, char **save_ptr);
+extern char * mbstok_r (char *string, const char *delim, char **save_ptr)
+ _GL_ARG_NONNULL ((2, 3));
#endif
/* Map any int, typically from errno, into an error message. */
#if @GNULIB_STRVERSCMP@
# if !@HAVE_STRVERSCMP@
-extern int strverscmp (const char *, const char *);
+extern int strverscmp (const char *, const char *) _GL_ARG_NONNULL ((1, 2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef strverscmp
/* A substitute <strings.h>.
- 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
/* The definition of GL_LINK_WARNING is copied here. */
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
#ifdef __cplusplus
extern "C" {
than S2.
Note: This function does not work in multibyte locales. */
#if ! @HAVE_STRCASECMP@
-extern int strcasecmp (char const *s1, char const *s2);
+extern int strcasecmp (char const *s1, char const *s2)
+ _GL_ARG_NONNULL ((1, 2));
#endif
#if defined GNULIB_POSIXCHECK
/* strcasecmp() does not work with multibyte strings:
lexicographically less than, equal to or greater than S2.
Note: This function cannot work correctly in multibyte locales. */
#if ! @HAVE_DECL_STRNCASECMP@
-extern int strncasecmp (char const *s1, char const *s2, size_t n);
+extern int strncasecmp (char const *s1, char const *s2, size_t n)
+ _GL_ARG_NONNULL ((1, 2));
#endif
#if defined GNULIB_POSIXCHECK
/* strncasecmp() does not work with multibyte strings:
-/* Copyright (C) 1991, 1992, 1997, 1999, 2003, 2006, 2008 Free
+/* Copyright (C) 1991-1992, 1997, 1999, 2003, 2006, 2008-2009 Free
Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
#include <config.h>
+/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
+ optimizes away the nptr == NULL test below. */
+#define _GL_ARG_NONNULL(params)
+
#include <stdlib.h>
#include <ctype.h>
#ifndef _GL_SYS_SOCKET_H
#define _GL_SYS_SOCKET_H
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
#if !@HAVE_SA_FAMILY_T@
typedef unsigned short sa_family_t;
#endif
# if @HAVE_WINSOCK2_H@
# undef connect
# define connect rpl_connect
-extern int rpl_connect (int, struct sockaddr *, int);
+extern int rpl_connect (int, struct sockaddr *, int) _GL_ARG_NONNULL ((2));
# endif
# elif @HAVE_WINSOCK2_H@
# undef connect
# if @HAVE_WINSOCK2_H@
# undef bind
# define bind rpl_bind
-extern int rpl_bind (int, struct sockaddr *, int);
+extern int rpl_bind (int, struct sockaddr *, int) _GL_ARG_NONNULL ((2));
# endif
# elif @HAVE_WINSOCK2_H@
# undef bind
# if @HAVE_WINSOCK2_H@
# undef getpeername
# define getpeername rpl_getpeername
-extern int rpl_getpeername (int, struct sockaddr *, int *);
+extern int rpl_getpeername (int, struct sockaddr *, int *)
+ _GL_ARG_NONNULL ((2, 3));
# endif
# elif @HAVE_WINSOCK2_H@
# undef getpeername
# if @HAVE_WINSOCK2_H@
# undef getsockname
# define getsockname rpl_getsockname
-extern int rpl_getsockname (int, struct sockaddr *, int *);
+extern int rpl_getsockname (int, struct sockaddr *, int *)
+ _GL_ARG_NONNULL ((2, 3));
# endif
# elif @HAVE_WINSOCK2_H@
# undef getsockname
# if @HAVE_WINSOCK2_H@
# undef getsockopt
# define getsockopt rpl_getsockopt
-extern int rpl_getsockopt (int, int, int, void *, socklen_t *);
+extern int rpl_getsockopt (int, int, int, void *, socklen_t *)
+ _GL_ARG_NONNULL ((4, 5));
# endif
# elif @HAVE_WINSOCK2_H@
# undef getsockopt
# if @HAVE_WINSOCK2_H@
# undef recv
# define recv rpl_recv
-extern int rpl_recv (int, void *, int, int);
+extern int rpl_recv (int, void *, int, int) _GL_ARG_NONNULL ((2));
# endif
# elif @HAVE_WINSOCK2_H@
# undef recv
# if @HAVE_WINSOCK2_H@
# undef send
# define send rpl_send
-extern int rpl_send (int, const void *, int, int);
+extern int rpl_send (int, const void *, int, int) _GL_ARG_NONNULL ((2));
# endif
# elif @HAVE_WINSOCK2_H@
# undef send
# if @HAVE_WINSOCK2_H@
# undef recvfrom
# define recvfrom rpl_recvfrom
-extern int rpl_recvfrom (int, void *, int, int, struct sockaddr *, int *);
+extern int rpl_recvfrom (int, void *, int, int, struct sockaddr *, int *)
+ _GL_ARG_NONNULL ((2));
# endif
# elif @HAVE_WINSOCK2_H@
# undef recvfrom
# if @HAVE_WINSOCK2_H@
# undef sendto
# define sendto rpl_sendto
-extern int rpl_sendto (int, const void *, int, int, struct sockaddr *, int);
+extern int rpl_sendto (int, const void *, int, int, struct sockaddr *, int)
+ _GL_ARG_NONNULL ((2));
# endif
# elif @HAVE_WINSOCK2_H@
# undef sendto
# if @HAVE_WINSOCK2_H@
# undef setsockopt
# define setsockopt rpl_setsockopt
-extern int rpl_setsockopt (int, int, int, const void *, socklen_t);
+extern int rpl_setsockopt (int, int, int, const void *, socklen_t)
+ _GL_ARG_NONNULL ((4));
# endif
# elif @HAVE_WINSOCK2_H@
# undef setsockopt
/* The definition of GL_LINK_WARNING is copied here. */
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
/* Before doing "#define mkdir rpl_mkdir" below, we need to include all
headers that may declare mkdir(). */
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
#if @GNULIB_FCHMODAT@
# if !@HAVE_FCHMODAT@
-extern int fchmodat (int fd, char const *file, mode_t mode, int flag);
+extern int fchmodat (int fd, char const *file, mode_t mode, int flag)
+ _GL_ARG_NONNULL ((2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef fchmodat
#if @REPLACE_FSTAT@
# define fstat rpl_fstat
-extern int fstat (int fd, struct stat *buf);
+extern int fstat (int fd, struct stat *buf) _GL_ARG_NONNULL ((2));
#endif
# define fstatat rpl_fstatat
# endif
# if !@HAVE_FSTATAT@ || @REPLACE_FSTATAT@
-extern int fstatat (int fd, char const *name, struct stat *st, int flags);
+extern int fstatat (int fd, char const *name, struct stat *st, int flags)
+ _GL_ARG_NONNULL ((2, 3));
# endif
#elif defined GNULIB_POSIXCHECK
# undef fstatat
# define lchmod chmod
# endif
# if 0 /* assume already declared */
-extern int lchmod (const char *filename, mode_t mode);
+extern int lchmod (const char *filename, mode_t mode) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef lchmod
# elif @REPLACE_LSTAT@
# undef lstat
# define lstat rpl_lstat
-extern int rpl_lstat (const char *name, struct stat *buf);
+extern int rpl_lstat (const char *name, struct stat *buf)
+ _GL_ARG_NONNULL ((1, 2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef lstat
#if @REPLACE_MKDIR@
# undef mkdir
# define mkdir rpl_mkdir
-extern int mkdir (char const *name, mode_t mode);
+extern int mkdir (char const *name, mode_t mode) _GL_ARG_NONNULL ((1));
#else
/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
Additionally, it declares _mkdir (and depending on compile flags, an
#if @GNULIB_MKDIRAT@
# if !@HAVE_MKDIRAT@
-extern int mkdirat (int fd, char const *file, mode_t mode);
+extern int mkdirat (int fd, char const *file, mode_t mode)
+ _GL_ARG_NONNULL ((2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef mkdirat
# define mkfifo rpl_mkfifo
# endif
# if !@HAVE_MKFIFO@ || @REPLACE_MKFIFO@
-int mkfifo (char const *file, mode_t mode);
+extern int mkfifo (char const *file, mode_t mode) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef mkfifo
#if @GNULIB_MKFIFOAT@
# if !@HAVE_MKFIFOAT@
-int mkfifoat (int fd, char const *file, mode_t mode);
+extern int mkfifoat (int fd, char const *file, mode_t mode)
+ _GL_ARG_NONNULL ((2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef mkfifoat
# define mknod rpl_mknod
# endif
# if !@HAVE_MKNOD@ || @REPLACE_MKNOD@
-int mknod (char const *file, mode_t mode, dev_t dev);
+extern int mknod (char const *file, mode_t mode, dev_t dev)
+ _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef mknod
#if @GNULIB_MKNODAT@
# if !@HAVE_MKNODAT@
-int mknodat (int fd, char const *file, mode_t mode, dev_t dev);
+extern int mknodat (int fd, char const *file, mode_t mode, dev_t dev)
+ _GL_ARG_NONNULL ((2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef mknodat
# else /* !_LARGE_FILES */
# define stat(name, st) rpl_stat (name, st)
# endif /* !_LARGE_FILES */
-extern int stat (const char *name, struct stat *buf);
+extern int stat (const char *name, struct stat *buf) _GL_ARG_NONNULL ((1, 2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef stat
# endif
# if !@HAVE_UTIMENSAT@ || @REPLACE_UTIMENSAT@
extern int utimensat (int fd, char const *name,
- struct timespec const times[2], int flag);
+ struct timespec const times[2], int flag)
+ _GL_ARG_NONNULL ((2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef utimensat
/* Provide a more complete sys/time.h.
- 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
# include <time.h>
# endif
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
#ifdef __cplusplus
extern "C" {
#endif
# if @REPLACE_GETTIMEOFDAY@
# undef gettimeofday
# define gettimeofday rpl_gettimeofday
-int gettimeofday (struct timeval *restrict, void *restrict);
+extern int gettimeofday (struct timeval *restrict, void *restrict)
+ _GL_ARG_NONNULL ((1));
# endif
#ifdef __cplusplus
/* Provide a sys/times.h header file.
- 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
/* The definition of GL_LINK_WARNING is copied here. */
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
# ifdef __cplusplus
extern "C" {
# endif
};
# if @GNULIB_TIMES@
- extern clock_t times (struct tms *buffer);
+ extern clock_t times (struct tms *buffer) _GL_ARG_NONNULL ((1));
# elif defined GNULIB_POSIXCHECK
# undef times
# define times(s) \
/* The definition of GL_LINK_WARNING is copied here. */
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
#ifdef __cplusplus
extern "C" {
#if @GNULIB_UNAME@
# if !@HAVE_UNAME@
-extern int uname (struct utsname *buf);
+extern int uname (struct utsname *buf) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef uname
/* NetBSD 5.0 mis-defines NULL. */
#include <stddef.h>
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
# ifdef __cplusplus
extern "C" {
# endif
<http://www.opengroup.org/susv3xsh/nanosleep.html>. */
# if @REPLACE_NANOSLEEP@
# define nanosleep rpl_nanosleep
-int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp);
+extern int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp)
+ _GL_ARG_NONNULL ((1));
# endif
/* Return the 'time_t' representation of TP and normalize TP. */
# if @REPLACE_MKTIME@
# define mktime rpl_mktime
-extern time_t mktime (struct tm *__tp);
+extern time_t mktime (struct tm *__tp) _GL_ARG_NONNULL ((1));
# endif
/* Convert TIMER to RESULT, assuming local time and UTC respectively. See
# define localtime_r rpl_localtime_r
# undef gmtime_r
# define gmtime_r rpl_gmtime_r
-struct tm *localtime_r (time_t const *restrict __timer,
- struct tm *restrict __result);
-struct tm *gmtime_r (time_t const *restrict __timer,
- struct tm *restrict __result);
+extern struct tm *localtime_r (time_t const *restrict __timer,
+ struct tm *restrict __result)
+ _GL_ARG_NONNULL ((1, 2));
+extern struct tm *gmtime_r (time_t const *restrict __timer,
+ struct tm *restrict __result)
+ _GL_ARG_NONNULL ((1, 2));
# endif
/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
# if @REPLACE_STRPTIME@
# undef strptime
# define strptime rpl_strptime
-char *strptime (char const *restrict __buf, char const *restrict __format,
- struct tm *restrict __tm);
+extern char *strptime (char const *restrict __buf,
+ char const *restrict __format,
+ struct tm *restrict __tm)
+ _GL_ARG_NONNULL ((1, 2, 3));
# endif
/* Convert TM to a time_t value, assuming UTC. */
# if @REPLACE_TIMEGM@
# undef timegm
# define timegm rpl_timegm
-time_t timegm (struct tm *__tm);
+extern time_t timegm (struct tm *__tm) _GL_ARG_NONNULL ((1));
# endif
/* Encourage applications to avoid unsafe functions that can overrun
-/* Copyright (C) 1995-1997, 2000, 2006-2007 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1997, 2000, 2006-2007, 2009 Free Software Foundation, Inc.
Contributed by Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>, 1997.
NOTE: The canonical source of this file is maintained with the GNU C
#include <config.h>
+/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
+ optimizes away the rootp == NULL tests below. */
+#define _GL_ARG_NONNULL(params)
+
/* Specification. */
#ifdef IN_LIBINTL
# include "tsearch.h"
/* The definition of GL_LINK_WARNING is copied here. */
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
/* OS/2 EMX lacks these macros. */
#ifndef STDIN_FILENO
Return 0 if successful, otherwise -1 and errno set.
See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/chown.html>. */
-extern int chown (const char *file, uid_t uid, gid_t gid);
+extern int chown (const char *file, uid_t uid, gid_t gid)
+ _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef chown
# if !@HAVE_EUIDACCESS@
/* Like access(), except that it uses the effective user id and group id of
the current process. */
-extern int euidaccess (const char *filename, int mode);
+extern int euidaccess (const char *filename, int mode) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef euidaccess
#if @GNULIB_FACCESSAT@
# if !@HAVE_FACCESSAT@
-int faccessat (int fd, char const *file, int mode, int flag);
+extern int faccessat (int fd, char const *file, int mode, int flag)
+ _GL_ARG_NONNULL ((2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef faccessat
extern int fchdir (int /*fd*/);
/* Gnulib internal hooks needed to maintain the fchdir metadata. */
-extern int _gl_register_fd (int fd, const char *filename);
+extern int _gl_register_fd (int fd, const char *filename)
+ _GL_ARG_NONNULL ((2));
extern void _gl_unregister_fd (int fd);
extern int _gl_register_dup (int oldfd, int newfd);
extern const char *_gl_directory_name (int fd);
# define fchownat rpl_fchownat
# endif
# if !@HAVE_FCHOWNAT@ || @REPLACE_FCHOWNAT@
-extern int fchownat (int fd, char const *file, uid_t owner, gid_t group, int flag);
+extern int fchownat (int fd, char const *file, uid_t owner, gid_t group, int flag)
+ _GL_ARG_NONNULL ((2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef fchownat
If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
Return 0 if successful, otherwise set errno and return -1. */
# if !@HAVE_GETDOMAINNAME@
-extern int getdomainname(char *name, size_t len);
+extern int getdomainname(char *name, size_t len) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef getdomainname
# define gethostname rpl_gethostname
# endif
# if @UNISTD_H_HAVE_WINSOCK2_H@ || !@HAVE_GETHOSTNAME@
-extern int gethostname(char *name, size_t len);
+extern int gethostname(char *name, size_t len) _GL_ARG_NONNULL ((1));
# endif
#elif @UNISTD_H_HAVE_WINSOCK2_H@
# undef gethostname
See <http://www.opengroup.org/susv3xsh/getlogin.html>.
*/
# if !@HAVE_DECL_GETLOGIN_R@
-extern int getlogin_r (char *name, size_t size);
+extern int getlogin_r (char *name, size_t size) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef getlogin_r
Return 0 if successful, otherwise -1 and errno set.
See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/lchown.html>. */
-extern int lchown (char const *file, uid_t owner, gid_t group);
+extern int lchown (char const *file, uid_t owner, gid_t group)
+ _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef lchown
See POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/link.html>. */
# if !@HAVE_LINK@ || @REPLACE_LINK@
-extern int link (const char *path1, const char *path2);
+extern int link (const char *path1, const char *path2)
+ _GL_ARG_NONNULL ((1, 2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef link
Return 0 if successful, otherwise -1 and errno set. */
# if !@HAVE_LINKAT@ || @REPLACE_LINKAT@
extern int linkat (int fd1, const char *path1, int fd2, const char *path2,
- int flag);
+ int flag)
+ _GL_ARG_NONNULL ((2, 4));
# endif
#elif defined GNULIB_POSIXCHECK
# undef linkat
# if @HAVE_PIPE2@
# define pipe2 rpl_pipe2
# endif
-extern int pipe2 (int fd[2], int flags);
+extern int pipe2 (int fd[2], int flags) _GL_ARG_NONNULL ((1));
#elif defined GNULIB_POSIXCHECK
# undef pipe2
# define pipe2(f,o) \
set errno and return -1. 0 indicates EOF. See the POSIX:2001
specification <http://www.opengroup.org/susv3xsh/pread.html>. */
# if !@HAVE_PREAD@ || @REPLACE_PREAD@
- extern ssize_t pread (int fd, void *buf, size_t bufsize, off_t offset);
+ extern ssize_t pread (int fd, void *buf, size_t bufsize, off_t offset)
+ _GL_ARG_NONNULL ((2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef pread
See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/readlink.html>. */
# if !@HAVE_READLINK@ || @REPLACE_READLINK@
-extern ssize_t readlink (const char *file, char *buf, size_t bufsize);
+extern ssize_t readlink (const char *file, char *buf, size_t bufsize)
+ _GL_ARG_NONNULL ((1, 2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef readlink
#if @GNULIB_READLINKAT@
# if !@HAVE_READLINKAT@
-ssize_t readlinkat (int fd, char const *file, char *buf, size_t len);
+extern ssize_t readlinkat (int fd, char const *file, char *buf, size_t len)
+ _GL_ARG_NONNULL ((2, 3));
# endif
#elif defined GNULIB_POSIXCHECK
# undef readlinkat
# if @REPLACE_RMDIR@
# define rmdir rpl_rmdir
/* Remove the directory DIR. */
-extern int rmdir (char const *name);
+extern int rmdir (char const *name) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef rmdir
# define symlink rpl_symlink
# endif
# if !@HAVE_SYMLINK@ || @REPLACE_SYMLINK@
-int symlink (char const *contents, char const *file);
+extern int symlink (char const *contents, char const *file)
+ _GL_ARG_NONNULL ((1, 2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef symlink
#if @GNULIB_SYMLINKAT@
# if !@HAVE_SYMLINKAT@
-int symlinkat (char const *contents, int fd, char const *file);
+extern int symlinkat (char const *contents, int fd, char const *file)
+ _GL_ARG_NONNULL ((1, 3));
# endif
#elif defined GNULIB_POSIXCHECK
# undef symlinkat
# if @REPLACE_UNLINK@
# undef unlink
# define unlink rpl_unlink
-extern int unlink (char const *file);
+extern int unlink (char const *file) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
# undef unlink
# define unlinkat rpl_unlinkat
# endif
# if !@HAVE_UNLINKAT@ || @REPLACE_UNLINKAT@
-extern int unlinkat (int fd, char const *file, int flag);
+extern int unlinkat (int fd, char const *file, int flag) _GL_ARG_NONNULL ((2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef unlinkat
<http://www.opengroup.org/susv3xsh/write.html>. */
# undef write
# define write rpl_write
-extern ssize_t write (int fd, const void *buf, size_t count);
+extern ssize_t write (int fd, const void *buf, size_t count)
+ _GL_ARG_NONNULL ((2));
#endif
#include <config.h>
+/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
+ optimizes away the name == NULL test below. */
+#define _GL_ARG_NONNULL(params)
+
/* Specification. */
#include <stdlib.h>
/* The definition of GL_LINK_WARNING is copied here. */
+/* The definition of _GL_ARG_NONNULL is copied here. */
+
#ifdef __cplusplus
extern "C" {
#endif
# define mbsrtowcs rpl_mbsrtowcs
# endif
# if !@HAVE_MBSRTOWCS@ || @REPLACE_MBSRTOWCS@
-extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps);
+extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
+ _GL_ARG_NONNULL ((2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef mbsrtowcs
# define mbsnrtowcs rpl_mbsnrtowcs
# endif
# if !@HAVE_MBSNRTOWCS@ || @REPLACE_MBSNRTOWCS@
-extern size_t mbsnrtowcs (wchar_t *dest, const char **srcp, size_t srclen, size_t len, mbstate_t *ps);
+extern size_t mbsnrtowcs (wchar_t *dest, const char **srcp, size_t srclen, size_t len, mbstate_t *ps)
+ _GL_ARG_NONNULL ((2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef mbsnrtowcs
# define wcsrtombs rpl_wcsrtombs
# endif
# if !@HAVE_WCSRTOMBS@ || @REPLACE_WCSRTOMBS@
-extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps);
+extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
+ _GL_ARG_NONNULL ((2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef wcsrtombs
# define wcsnrtombs rpl_wcsnrtombs
# endif
# if !@HAVE_WCSNRTOMBS@ || @REPLACE_WCSNRTOMBS@
-extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps);
+extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps)
+ _GL_ARG_NONNULL ((2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef wcsnrtombs
--- /dev/null
+Description:
+A C macro for declaring that specific arguments must not be NULL.
+
+Files:
+build-aux/arg-nonnull.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+BUILT_SOURCES += arg-nonnull.h
+# The arg-nonnull.h that gets inserted into generated .h files is the same as
+# build-aux/arg-nonnull.h, except that it has the copyright header cut off.
+arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ sed -n -e '/GL_ARG_NONNULL/,$$p' \
+ < $(top_srcdir)/build-aux/arg-nonnull.h \
+ > $@-t && \
+ mv $@-t $@
+MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
+
+ARG_NONNULL_H=arg-nonnull.h
+
+Include:
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible
lib/argv-iter.h
Depends-on:
+arg-nonnull
getdelim
stdbool
Depends-on:
include_next
link-warning
+arg-nonnull
sys_socket
configure.ac:
# We need the following in order to create <arpa/inet.h> when the system
# doesn't have one.
-arpa/inet.h: arpa_inet.in.h $(LINK_WARNING_H)
+arpa/inet.h: arpa_inet.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
$(AM_V_at)$(MKDIR_P) arpa
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \
-e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/arpa_inet.in.h; \
} > $@-t && \
mv $@-t $@
Depends-on:
include_next
link-warning
+arg-nonnull
configure.ac:
gl_DIRENT_H
# We need the following in order to create <dirent.h> when the system
# doesn't have one that works with the given compiler.
-dirent.h: dirent.in.h $(LINK_WARNING_H)
+dirent.h: dirent.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''REPLACE_FDOPENDIR''@|$(REPLACE_FDOPENDIR)|g' \
-e 's|@''REPLACE_OPENDIR''@|$(REPLACE_OPENDIR)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/dirent.in.h; \
} > $@-t && \
mv $@-t $@
Depends-on:
include_next
link-warning
+arg-nonnull
unistd
extensions
# We need the following in order to create <fcntl.h> when the system
# doesn't have one that works with the given compiler.
-fcntl.h: fcntl.in.h $(LINK_WARNING_H)
+fcntl.h: fcntl.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''REPLACE_OPENAT''@|$(REPLACE_OPENAT)|g' \
-e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/fcntl.in.h; \
} > $@-t && \
mv $@-t $@
m4/fnmatch.m4
Depends-on:
+arg-nonnull
extensions
alloca
stdbool
# We need the following in order to create <fnmatch.h> when the system
# doesn't have one that supports the required API.
-fnmatch.h: fnmatch.in.h
+fnmatch.h: fnmatch.in.h $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- cat $(srcdir)/fnmatch.in.h; \
+ sed -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+ < $(srcdir)/fnmatch.in.h; \
} > $@-t && \
mv -f $@-t $@
MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
unistd
extensions
include_next
+arg-nonnull
configure.ac:
gl_FUNC_GETOPT_POSIX
# We need the following in order to create <getopt.h> when the system
# doesn't have one that works with the given compiler.
-getopt.h: getopt.in.h $(LINK_WARNING_H)
+getopt.h: getopt.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/getopt.in.h; \
} > $@-t && \
mv -f $@-t $@
Depends-on:
alloca
+arg-nonnull
d-type
dirfd
extensions
# We need the following in order to create <glob.h> when the system
# doesn't have one that works with the given compiler.
-glob.h: glob.in.h
+glob.h: glob.in.h $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/glob.in.h; \
} > $@-t && \
mv -f $@-t $@
Depends-on:
gperf
include_next
+arg-nonnull
iconv
c-ctype
c-strcase
# We need the following in order to create <iconv.h> when the system
# doesn't have one that works with the given compiler.
-iconv.h: iconv.in.h
+iconv.h: iconv.in.h $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''REPLACE_ICONV''@|$(REPLACE_ICONV)|g' \
-e 's|@''REPLACE_ICONV_OPEN''@|$(REPLACE_ICONV_OPEN)|g' \
-e 's|@''REPLACE_ICONV_UTF''@|$(REPLACE_ICONV_UTF)|g' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/iconv.in.h; \
} > $@-t && \
mv $@-t $@
Depends-on:
include_next
link-warning
+arg-nonnull
multiarch
stdint
# We need the following in order to create <inttypes.h> when the system
# doesn't have one that works with the given compiler.
-inttypes.h: inttypes.in.h $(LINK_WARNING_H)
+inttypes.h: inttypes.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
-e 's/@''UINT32_MAX_LT_UINTMAX_MAX''@/$(UINT32_MAX_LT_UINTMAX_MAX)/g' \
-e 's/@''UINT64_MAX_EQ_ULONG_MAX''@/$(UINT64_MAX_EQ_ULONG_MAX)/g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/inttypes.in.h; \
} > $@-t && \
mv $@-t $@
Depends-on:
include_next
+arg-nonnull
extensions
stddef
# We need the following in order to create <locale.h> when the system
# doesn't have one that provides all definitions.
-locale.h: locale.in.h
+locale.h: locale.in.h $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''GNULIB_DUPLOCALE''@|$(GNULIB_DUPLOCALE)|g' \
-e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \
-e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/locale.in.h; \
} > $@-t && \
mv $@-t $@
Depends-on:
include_next
link-warning
+arg-nonnull
configure.ac:
gl_MATH_H
# We need the following in order to create <math.h> when the system
# doesn't have one that works with the given compiler.
-math.h: math.in.h $(LINK_WARNING_H)
+math.h: math.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \
-e 's|@''REPLACE_SIGNBIT_USING_GCC''@|$(REPLACE_SIGNBIT_USING_GCC)|g' \
-e 's|@''REPLACE_TRUNCL''@|$(REPLACE_TRUNCL)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/math.in.h; \
} > $@-t && \
mv $@-t $@
Depends-on:
include_next
+arg-nonnull
sys_socket
configure.ac:
# We need the following in order to create <netdb.h> when the system
# doesn't have one that works with the given compiler.
-netdb.h: netdb.in.h
+netdb.h: netdb.in.h $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''HAVE_DECL_GAI_STRERROR''@|$(HAVE_DECL_GAI_STRERROR)|g' \
-e 's|@''HAVE_DECL_GETADDRINFO''@|$(HAVE_DECL_GETADDRINFO)|g' \
-e 's|@''HAVE_DECL_GETNAMEINFO''@|$(HAVE_DECL_GETNAMEINFO)|g' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/netdb.in.h; \
} > $@-t && \
mv $@-t $@
Depends-on:
include_next
link-warning
+arg-nonnull
configure.ac:
gl_SEARCH_H
# We need the following in order to create <search.h> when the system
# doesn't have one that works with the given compiler.
-search.h: search.in.h $(LINK_WARNING_H)
+search.h: search.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''HAVE_SEARCH_H''@|$(HAVE_SEARCH_H)|g' \
-e 's|@''HAVE_TSEARCH''@|$(HAVE_TSEARCH)|g' \
-e 's|@''REPLACE_TSEARCH''@|$(REPLACE_TSEARCH)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/search.in.h; \
} > $@-t && \
mv $@-t $@
Depends-on:
include_next
link-warning
+arg-nonnull
configure.ac:
gl_SIGNAL_H
# We need the following in order to create <signal.h> when the system
# doesn't have a complete one.
-signal.h: signal.in.h $(LINK_WARNING_H)
+signal.h: signal.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''HAVE_STRUCT_SIGACTION_SA_SIGACTION''@|$(HAVE_STRUCT_SIGACTION_SA_SIGACTION)|g' \
-e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/signal.in.h; \
} > $@-t && \
mv $@-t $@
Depends-on:
include_next
link-warning
+arg-nonnull
sched
configure.ac:
# We need the following in order to create a replacement for <spawn.h> when
# the system doesn't have one.
-spawn.h: spawn.in.h $(LINK_WARNING_H)
+spawn.h: spawn.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''HAVE_SPAWN_H''@|$(HAVE_SPAWN_H)|g' \
-e 's|@''HAVE_POSIX_SPAWN''@|$(HAVE_POSIX_SPAWN)|g' \
-e 's|@''REPLACE_POSIX_SPAWN''@|$(REPLACE_POSIX_SPAWN)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/spawn.in.h; \
} > $@-t && \
mv $@-t $@
Depends-on:
include_next
link-warning
+arg-nonnull
raise
stddef
# We need the following in order to create <stdio.h> when the system
# doesn't have one that works with the given compiler.
-stdio.h: stdio.in.h $(LINK_WARNING_H)
+stdio.h: stdio.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \
-e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/stdio.in.h; \
} > $@-t && \
mv $@-t $@
Depends-on:
include_next
link-warning
+arg-nonnull
unistd
stddef
stdint
# We need the following in order to create <stdlib.h> when the system
# doesn't have one that works with the given compiler.
-stdlib.h: stdlib.in.h $(LINK_WARNING_H)
+stdlib.h: stdlib.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
-e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/stdlib.in.h; \
} > $@-t && \
mv $@-t $@
extensions
include_next
link-warning
+arg-nonnull
stddef
configure.ac:
# We need the following in order to create <string.h> when the system
# doesn't have one that works with the given compiler.
-string.h: string.in.h $(LINK_WARNING_H)
+string.h: string.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
-e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/string.in.h; \
} > $@-t && \
mv $@-t $@
Depends-on:
include_next
link-warning
+arg-nonnull
configure.ac:
gl_HEADER_STRINGS_H
# We need the following in order to create <strings.h> when the system
# doesn't have one that works with the given compiler.
-strings.h: strings.in.h $(LINK_WARNING_H)
+strings.h: strings.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
-e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/strings.in.h; \
} > $@-t && \
mv $@-t $@
Depends-on:
include_next
link-warning
+arg-nonnull
errno
alignof
# We need the following in order to create <sys/socket.h> when the system
# doesn't have one that works with the given compiler.
-sys/socket.h: sys_socket.in.h $(LINK_WARNING_H)
+sys/socket.h: sys_socket.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
$(AM_V_at)$(MKDIR_P) sys
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-e 's|@''HAVE_SA_FAMILY_T''@|$(HAVE_SA_FAMILY_T)|g' \
-e 's|@''HAVE_ACCEPT4''@|$(HAVE_ACCEPT4)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/sys_socket.in.h; \
} > $@-t && \
mv -f $@-t $@
Depends-on:
include_next
link-warning
+arg-nonnull
time
configure.ac:
# We need the following in order to create <sys/stat.h> when the system
# has one that is incomplete.
-sys/stat.h: sys_stat.in.h $(LINK_WARNING_H)
+sys/stat.h: sys_stat.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
$(AM_V_at)$(MKDIR_P) sys
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \
-e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/sys_stat.in.h; \
} > $@-t && \
mv $@-t $@
Depends-on:
include_next
+arg-nonnull
configure.ac:
gl_HEADER_SYS_TIME_H
# We need the following in order to create <sys/time.h> when the system
# doesn't have one that works with the given compiler.
-sys/time.h: sys_time.in.h
+sys/time.h: sys_time.in.h $(ARG_NONNULL_H)
$(AM_V_at)$(MKDIR_P) sys
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
-e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
-e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/sys_time.in.h; \
} > $@-t && \
mv $@-t $@
Depends-on:
link-warning
+arg-nonnull
configure.ac:
gl_SYS_TIMES_H
# We need the following in order to create <sys/times.h> when the system
# doesn't have one that works with the given compiler.
-sys/times.h: sys_times.in.h $(LINK_WARNING_H)
+sys/times.h: sys_times.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
$(AM_V_at)$(MKDIR_P) sys
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''GNULIB_TIMES''@|$(GNULIB_TIMES)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/sys_times.in.h; \
} > $@-t && \
mv $@-t $@
Depends-on:
link-warning
+arg-nonnull
configure.ac:
gl_SYS_UTSNAME_H
# We need the following in order to create <sys/utsname.h> when the system
# does not have one.
-sys/utsname.h: sys_utsname.in.h $(LINK_WARNING_H)
+sys/utsname.h: sys_utsname.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
$(AM_V_at)$(MKDIR_P) sys
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''GNULIB_UNAME''@|$(GNULIB_UNAME)|g' \
-e 's|@''HAVE_UNAME''@|$(HAVE_UNAME)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/sys_utsname.in.h; \
} > $@-t && \
mv $@-t $@
Depends-on:
extensions
include_next
+arg-nonnull
stddef
configure.ac:
# We need the following in order to create <time.h> when the system
# doesn't have one that works with the given compiler.
-time.h: time.in.h
+time.h: time.in.h $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \
-e 's|@SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
-e 's|@TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/time.in.h; \
} > $@-t && \
mv $@-t $@
Depends-on:
include_next
link-warning
+arg-nonnull
stddef
configure.ac:
# We need the following in order to create an empty placeholder for
# <unistd.h> when the system doesn't have one.
-unistd.h: unistd.in.h $(LINK_WARNING_H)
+unistd.h: unistd.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
-e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \
-e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/unistd.in.h; \
} > $@-t && \
mv $@-t $@
Depends-on:
include_next
link-warning
+arg-nonnull
stddef
configure.ac:
# We need the following in order to create <wchar.h> when the system
# version does not work standalone.
-wchar.h: wchar.in.h $(LINK_WARNING_H)
+wchar.h: wchar.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \
-e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/wchar.in.h; \
} > $@-t && \
mv $@-t $@
#define BASE "t-can-lgpl.tmp"
+static void *
+null_ptr (void)
+{
+ return NULL;
+}
+
int
main (void)
{
ASSERT (result == NULL);
ASSERT (errno == ENOENT);
errno = 0;
- result = canonicalize_file_name (NULL);
+ result = canonicalize_file_name (null_ptr ());
ASSERT (result == NULL);
ASSERT (errno == EINVAL);
}
#define BASE "t-can.tmp"
+static void *
+null_ptr (void)
+{
+ return NULL;
+}
+
int
main (void)
{
ASSERT (result2 == NULL);
ASSERT (errno == ENOENT);
errno = 0;
- result1 = canonicalize_file_name (NULL);
+ result1 = canonicalize_file_name (null_ptr ());
ASSERT (result1 == NULL);
ASSERT (errno == EINVAL);
errno = 0;
} \
while (0)
+static void *
+null_ptr (void)
+{
+ return NULL;
+}
+
int
main (int argc, char *argv[])
{
{
const char input[] = "foo";
- const char *result = memmem (input, strlen (input), NULL, 0);
+ const char *result = memmem (input, strlen (input), null_ptr (), 0);
ASSERT (result == input);
}