changeset 12766:2c14f1e449e5

warn-on-use: use instead of link-warning Each *.in.h file serves two purposes - provide enough self-contained content to serve as a replacement for the system header regardless of the user's compiler, and offer the developer the ability to detect any gnulib modules that might have been inadvertantly excluded. The former requires independence from config.h, and routes everything through a Makefile.am snippet that uses @@ substitution specific to the modules that were in use, with details learned at configure time. The latter works by poisoning anything that gnulib did not replace, but which the developer had natively available, explaining why their tests passed during development. Poisoning relies on gcc features, and requires manual triggering by adding -DGNULIB_POSIXCHECK to CFLAGS; it assumes that <config.h> is properly included. In fact, we do not want to use @@ substitution for HAVE_DECL_* during poisoning, because the warning is only relevant for the gnulib modules which were not included, and thus where the m4 macros to set proper @@ values have not been run. Furthermore, we only need to poison interfaces that already have a declaration; if something is not declared, then the developer wouldn't have been able to link, so their code won't be using the problematic interface in the first place. * modules/stdio (Depends-on, Makefile.am): Drop link-warning. * modules/unistd (Depends-on, Makefile.am): Likewise. * modules/arpa_inet (Depends-on): Replace link-warning with warn-on-use. (Makefile.am): Update rules accordingly. * modules/ctype (Depends-on, Makefile.am): Likewise. * modules/dirent (Depends-on, Makefile.am): Likewise. * modules/fcntl-h (Depends-on, Makefile.am): Likewise. * modules/inttypes (Depends-on, Makefile.am): Likewise. * modules/langinfo (Depends-on, Makefile.am): Likewise. * modules/locale (Depends-on, Makefile.am): Likewise. * modules/math (Depends-on, Makefile.am): Likewise. * modules/search (Depends-on, Makefile.am): Likewise. * modules/signal (Depends-on, Makefile.am): Likewise. * modules/spawn (Depends-on, Makefile.am): Likewise. * modules/stdlib (Depends-on, Makefile.am): Likewise. * modules/string (Depends-on, Makefile.am): Likewise. * modules/strings (Depends-on, Makefile.am): Likewise. * modules/sys_file (Depends-on, Makefile.am): Likewise. * modules/sys_ioctl (Depends-on, Makefile.am): Likewise. * modules/sys_select (Depends-on, Makefile.am): Likewise. * modules/sys_socket (Depends-on, Makefile.am): Likewise. * modules/sys_stat (Depends-on, Makefile.am): Likewise. * modules/sys_times (Depends-on, Makefile.am): Likewise. * modules/sys_utsname (Depends-on, Makefile.am): Likewise. * modules/wchar (Depends-on, Makefile.am): Likewise. * m4/arpa_inet_h.m4 (gl_HEADER_ARPA_INET): Check which functions should be poisoned. * m4/ctype.m4 (gl_CTYPE_H): Likewise. * m4/dirent_h.m4 (gl_DIRENT_H): Likewise. * m4/fcntl_h.m4 (gl_FCNTL_H): Likewise. * m4/inttypes.m4 (gl_INTTYPES_H): Likewise. * m4/langinfo_h.m4 (gl_LANGINFO_H): Likewise. * m4/locale_h.m4 (gl_LOCALE_H): Likewise. * m4/math_h.m4 (gl_MATH_H): Likewise. * m4/search_h.m4 (gl_SEARCH_H): Likewise. * m4/signal_h.m4 (gl_SIGNAL_H): Likewise. * m4/spawn_h.m4 (gl_SPAWN_H): Likewise. * m4/stdio_h.m4 (gl_STDIO_H): Likewise. * m4/stdlib_h.m4 (gl_STDLIB_H): Likewise. * m4/string_h.m4 (gl_HEADER_STRING_H_BODY): Likewise. * m4/strings_h.m4 (gl_HEADER_STRINGS_H_BODY): Likewise. * m4/sys_file_h.m4 (gl_HEADER_SYS_FILE_H_DEFAULTS): Likewise. * m4/sys_ioctl_h.m4 (gl_SYS_IOCTL_H): Likewise. * m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Likewise. * m4/sys_socket_h.m4 (gl_HEADER_SYS_SOCKET): Likewise. * m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Likewise. * m4/sys_times_h.m4 (gl_SYS_TIMES_H): Likewise. * m4/sys_utsname_h.m4 (gl_SYS_UTSNAME_H): Likewise. * m4/unistd_h.m4 (gl_UNISTD_H): Likewise. * m4/wchar.m4 (gl_WCHAR_H): Likewise. * lib/arpa_inet.in.h: Use _GL_WARN_ON_USE instead of GL_LINK_WARNING. * lib/ctype.in.h: Likewise. * lib/dirent.in.h: Likewise. * lib/fcntl.in.h: Likewise. * lib/inttypes.in.h: Likewise. * lib/langinfo.in.h: Likewise. * lib/locale.in.h: Likewise. * lib/math.in.h: Likewise. * lib/search.in.h: Likewise. * lib/signal.in.h: Likewise. * lib/spawn.in.h: Likewise. * lib/stdio.in.h: Likewise. * lib/stdlib.in.h: Likewise. * lib/string.in.h: Likewise. * lib/strings.in.h: Likewise. * lib/sys_file.in.h: Likewise. * lib/sys_ioctl.in.h: Likewise. * lib/sys_select.in.h: Likewise. * lib/sys_socket.in.h: Likewise. * lib/sys_stat.in.h: Likewise. * lib/sys_times.in.h: Likewise. * lib/sys_utsname.in.h: Likewise. * lib/unistd.in.h: Likewise. * lib/wchar.in.h: Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Wed, 16 Dec 2009 16:20:28 -0700
parents 2614b91f7908
children 941bc7981053
files ChangeLog lib/arpa_inet.in.h lib/ctype.in.h lib/dirent.in.h lib/fcntl.in.h lib/inttypes.in.h lib/langinfo.in.h lib/locale.in.h lib/math.in.h lib/search.in.h lib/signal.in.h lib/spawn.in.h lib/stdio.in.h lib/stdlib.in.h lib/string.in.h lib/strings.in.h lib/sys_file.in.h lib/sys_ioctl.in.h lib/sys_select.in.h lib/sys_socket.in.h lib/sys_stat.in.h lib/sys_times.in.h lib/sys_utsname.in.h lib/unistd.in.h lib/wchar.in.h m4/arpa_inet_h.m4 m4/ctype.m4 m4/dirent_h.m4 m4/fcntl_h.m4 m4/inttypes.m4 m4/langinfo_h.m4 m4/locale_h.m4 m4/math_h.m4 m4/search_h.m4 m4/signal_h.m4 m4/spawn_h.m4 m4/stdio_h.m4 m4/stdlib_h.m4 m4/string_h.m4 m4/strings_h.m4 m4/sys_file_h.m4 m4/sys_ioctl_h.m4 m4/sys_select_h.m4 m4/sys_socket_h.m4 m4/sys_stat_h.m4 m4/sys_times_h.m4 m4/sys_utsname_h.m4 m4/unistd_h.m4 m4/wchar.m4 modules/arpa_inet modules/ctype modules/dirent modules/fcntl-h modules/inttypes modules/langinfo modules/locale modules/math modules/search modules/signal modules/spawn modules/stdio modules/stdlib modules/string modules/strings modules/sys_file modules/sys_ioctl modules/sys_select modules/sys_socket modules/sys_stat modules/sys_times modules/sys_utsname modules/unistd modules/wchar
diffstat 73 files changed, 1300 insertions(+), 1091 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,83 @@
+2010-01-20  Eric Blake  <ebb9@byu.net>
+
+	warn-on-use: use instead of link-warning
+	* modules/stdio (Depends-on, Makefile.am): Drop link-warning.
+	* modules/unistd (Depends-on, Makefile.am): Likewise.
+	* modules/arpa_inet (Depends-on): Replace link-warning with
+	warn-on-use.
+	(Makefile.am): Update rules accordingly.
+	* modules/ctype (Depends-on, Makefile.am): Likewise.
+	* modules/dirent (Depends-on, Makefile.am): Likewise.
+	* modules/fcntl-h (Depends-on, Makefile.am): Likewise.
+	* modules/inttypes (Depends-on, Makefile.am): Likewise.
+	* modules/langinfo (Depends-on, Makefile.am): Likewise.
+	* modules/locale (Depends-on, Makefile.am): Likewise.
+	* modules/math (Depends-on, Makefile.am): Likewise.
+	* modules/search (Depends-on, Makefile.am): Likewise.
+	* modules/signal (Depends-on, Makefile.am): Likewise.
+	* modules/spawn (Depends-on, Makefile.am): Likewise.
+	* modules/stdlib (Depends-on, Makefile.am): Likewise.
+	* modules/string (Depends-on, Makefile.am): Likewise.
+	* modules/strings (Depends-on, Makefile.am): Likewise.
+	* modules/sys_file (Depends-on, Makefile.am): Likewise.
+	* modules/sys_ioctl (Depends-on, Makefile.am): Likewise.
+	* modules/sys_select (Depends-on, Makefile.am): Likewise.
+	* modules/sys_socket (Depends-on, Makefile.am): Likewise.
+	* modules/sys_stat (Depends-on, Makefile.am): Likewise.
+	* modules/sys_times (Depends-on, Makefile.am): Likewise.
+	* modules/sys_utsname (Depends-on, Makefile.am): Likewise.
+	* modules/wchar (Depends-on, Makefile.am): Likewise.
+	* m4/arpa_inet_h.m4 (gl_HEADER_ARPA_INET): Check which functions
+	should be poisoned.
+	* m4/ctype.m4 (gl_CTYPE_H): Likewise.
+	* m4/dirent_h.m4 (gl_DIRENT_H): Likewise.
+	* m4/fcntl_h.m4 (gl_FCNTL_H): Likewise.
+	* m4/inttypes.m4 (gl_INTTYPES_H): Likewise.
+	* m4/langinfo_h.m4 (gl_LANGINFO_H): Likewise.
+	* m4/locale_h.m4 (gl_LOCALE_H): Likewise.
+	* m4/math_h.m4 (gl_MATH_H): Likewise.
+	* m4/search_h.m4 (gl_SEARCH_H): Likewise.
+	* m4/signal_h.m4 (gl_SIGNAL_H): Likewise.
+	* m4/spawn_h.m4 (gl_SPAWN_H): Likewise.
+	* m4/stdio_h.m4 (gl_STDIO_H): Likewise.
+	* m4/stdlib_h.m4 (gl_STDLIB_H): Likewise.
+	* m4/string_h.m4 (gl_HEADER_STRING_H_BODY): Likewise.
+	* m4/strings_h.m4 (gl_HEADER_STRINGS_H_BODY): Likewise.
+	* m4/sys_file_h.m4 (gl_HEADER_SYS_FILE_H_DEFAULTS): Likewise.
+	* m4/sys_ioctl_h.m4 (gl_SYS_IOCTL_H): Likewise.
+	* m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Likewise.
+	* m4/sys_socket_h.m4 (gl_HEADER_SYS_SOCKET): Likewise.
+	* m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Likewise.
+	* m4/sys_times_h.m4 (gl_SYS_TIMES_H): Likewise.
+	* m4/sys_utsname_h.m4 (gl_SYS_UTSNAME_H): Likewise.
+	* m4/unistd_h.m4 (gl_UNISTD_H): Likewise.
+	* m4/wchar.m4 (gl_WCHAR_H): Likewise.
+	* lib/arpa_inet.in.h: Use _GL_WARN_ON_USE instead of
+	GL_LINK_WARNING.
+	* lib/ctype.in.h: Likewise.
+	* lib/dirent.in.h: Likewise.
+	* lib/fcntl.in.h: Likewise.
+	* lib/inttypes.in.h: Likewise.
+	* lib/langinfo.in.h: Likewise.
+	* lib/locale.in.h: Likewise.
+	* lib/math.in.h: Likewise.
+	* lib/search.in.h: Likewise.
+	* lib/signal.in.h: Likewise.
+	* lib/spawn.in.h: Likewise.
+	* lib/stdio.in.h: Likewise.
+	* lib/stdlib.in.h: Likewise.
+	* lib/string.in.h: Likewise.
+	* lib/strings.in.h: Likewise.
+	* lib/sys_file.in.h: Likewise.
+	* lib/sys_ioctl.in.h: Likewise.
+	* lib/sys_select.in.h: Likewise.
+	* lib/sys_socket.in.h: Likewise.
+	* lib/sys_stat.in.h: Likewise.
+	* lib/sys_times.in.h: Likewise.
+	* lib/sys_utsname.in.h: Likewise.
+	* lib/unistd.in.h: Likewise.
+	* lib/wchar.in.h: Likewise.
+
 2010-01-20  Bruno Haible  <bruno@clisp.org>
 
 	Avoid duplicate -lm.
--- a/lib/arpa_inet.in.h
+++ b/lib/arpa_inet.in.h
@@ -39,9 +39,9 @@
 #ifndef _GL_ARPA_INET_H
 #define _GL_ARPA_INET_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
 
-/* The definition of _GL_ARG_NONNULL is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 #ifdef __cplusplus
 extern "C" {
@@ -70,10 +70,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef inet_ntop
-# define inet_ntop(af,src,dst,cnt) \
-    (GL_LINK_WARNING ("inet_ntop is unportable - " \
-                      "use gnulib module inet_ntop for portability"), \
-     inet_ntop (af, src, dst, cnt))
+# if HAVE_RAW_DECL_INET_NTOP
+_GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - "
+                 "use gnulib module inet_ntop for portability");
+# endif
 #endif
 
 #if @GNULIB_INET_PTON@
@@ -83,10 +83,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef inet_pton
-# define inet_pton(af,src,dst) \
-  (GL_LINK_WARNING ("inet_pton is unportable - " \
-                    "use gnulib module inet_pton for portability"), \
-   inet_pton (af, src, dst))
+# if HAVE_RAW_DECL_INET_PTON
+_GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - "
+                 "use gnulib module inet_pton for portability");
+# endif
 #endif
 
 #ifdef __cplusplus
--- a/lib/ctype.in.h
+++ b/lib/ctype.in.h
@@ -36,7 +36,7 @@
 #ifndef _GL_CTYPE_H
 #define _GL_CTYPE_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 /* Return non-zero if c is a blank, i.e. a space or tab character.  */
 #if @GNULIB_ISBLANK@
@@ -45,10 +45,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef isblank
-# define isblank(c) \
-    (GL_LINK_WARNING ("isblank is unportable - " \
-                      "use gnulib module isblank for portability"), \
-     isblank (c))
+# if HAVE_RAW_DECL_ISBLANK
+_GL_WARN_ON_USE (isblank, "isblank is unportable - "
+                 "use gnulib module isblank for portability");
+# endif
 #endif
 
 #endif /* _GL_CTYPE_H */
--- a/lib/dirent.in.h
+++ b/lib/dirent.in.h
@@ -29,10 +29,9 @@
 /* Get ino_t.  Needed on some systems, including glibc 2.8.  */
 #include <sys/types.h>
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 #ifdef __cplusplus
 extern "C" {
@@ -53,10 +52,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef dirfd
-# define dirfd(d) \
-    (GL_LINK_WARNING ("dirfd is unportable - " \
-                      "use gnulib module dirfd for portability"), \
-     dirfd (d))
+# if HAVE_RAW_DECL_DIRFD
+_GL_WARN_ON_USE (dirfd, "dirfd is unportable - "
+                 "use gnulib module dirfd for portability");
+# endif
 #endif
 
 #if @GNULIB_FDOPENDIR@
@@ -74,10 +73,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fdopendir
-# define fdopendir(f) \
-    (GL_LINK_WARNING ("fdopendir is unportable - " \
-                      "use gnulib module fdopendir for portability"), \
-     fdopendir (f))
+# if HAVE_RAW_DECL_FDOPENDIR
+_GL_WARN_ON_USE (fdopendir, "fdopendir is unportable - "
+                 "use gnulib module fdopendir for portability");
+# endif
 #endif
 
 #if @REPLACE_OPENDIR@
@@ -98,10 +97,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef scandir
-# define scandir(d,n,f,c) \
-    (GL_LINK_WARNING ("scandir is unportable - " \
-                      "use gnulib module scandir for portability"), \
-     scandir (d, n, f, c))
+# if HAVE_RAW_DECL_SCANDIR
+_GL_WARN_ON_USE (scandir, "scandir is unportable - "
+                 "use gnulib module scandir for portability");
+# endif
 #endif
 
 #if @GNULIB_ALPHASORT@
@@ -112,10 +111,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef alphasort
-# define alphasort(a,b) \
-    (GL_LINK_WARNING ("alphasort is unportable - " \
-                      "use gnulib module alphasort for portability"), \
-     alphasort (a, b))
+# if HAVE_RAW_DECL_ALPHASORT
+_GL_WARN_ON_USE (alphasort, "alphasort is unportable - "
+                 "use gnulib module alphasort for portability");
+# endif
 #endif
 
 #ifdef __cplusplus
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -50,9 +50,9 @@
 #endif
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
 
-/* The definition of _GL_ARG_NONNULL is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 /* Declare overridden functions.  */
@@ -71,10 +71,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fcntl
-# define fcntl \
-    (GL_LINK_WARNING ("fcntl is not always POSIX compliant - " \
-                      "use gnulib module fcntl for portability"), \
-     fcntl)
+# if HAVE_RAW_DECL_FCNTL
+_GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
+                 "use gnulib module fcntl for portability");
+# endif
 #endif
 
 #if @GNULIB_OPEN@
@@ -85,10 +85,9 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef open
-# define open \
-    (GL_LINK_WARNING ("open is not always POSIX compliant - " \
-                      "use gnulib module open for portability"), \
-     open)
+/* Assume open is always declared.  */
+_GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
+                 "use gnulib module open for portability");
 #endif
 
 #if @GNULIB_OPENAT@
@@ -102,10 +101,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef openat
-# define openat \
-    (GL_LINK_WARNING ("openat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     openat)
+# if HAVE_RAW_DECL_OPENAT
+_GL_WARN_ON_USE (openat, "openat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 #ifdef __cplusplus
--- a/lib/inttypes.in.h
+++ b/lib/inttypes.in.h
@@ -48,9 +48,9 @@
 # error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
 
-/* The definition of _GL_ARG_NONNULL is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 /* 7.8.1 Macros for format specifiers */
 
@@ -1050,10 +1050,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef imaxabs
-# define imaxabs(a) \
-    (GL_LINK_WARNING ("imaxabs is unportable - " \
-                      "use gnulib module imaxabs for portability"), \
-     imaxabs (a))
+# if HAVE_RAW_DECL_IMAXABS
+_GL_WARN_ON_USE (imaxabs, "imaxabs is unportable - "
+                 "use gnulib module imaxabs for portability");
+# endif
 #endif
 
 #if @GNULIB_IMAXDIV@
@@ -1063,10 +1063,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef imaxdiv
-# define imaxdiv(a,b) \
-    (GL_LINK_WARNING ("imaxdiv is unportable - " \
-                      "use gnulib module imaxdiv for portability"), \
-     imaxdiv (a, b))
+# if HAVE_RAW_DECL_IMAXDIV
+_GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - "
+                 "use gnulib module imaxdiv for portability");
+# endif
 #endif
 
 #if @GNULIB_STRTOIMAX@
@@ -1075,10 +1075,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtoimax
-# define strtoimax(p,e,b) \
-    (GL_LINK_WARNING ("strtoimax is unportable - " \
-                      "use gnulib module strtoimax for portability"), \
-     strtoimax (p, e, b))
+# if HAVE_RAW_DECL_STRTOIMAX
+_GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - "
+                 "use gnulib module strtoimax for portability");
+# endif
 #endif
 
 #if @GNULIB_STRTOUMAX@
@@ -1087,10 +1087,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtoumax
-# define strtoumax(p,e,b) \
-    (GL_LINK_WARNING ("strtoumax is unportable - " \
-                      "use gnulib module strtoumax for portability"), \
-     strtoumax (p, e, b))
+# if HAVE_RAW_DECL_STRTOUMAX
+_GL_WARN_ON_USE (strtoumax, "strtoumax is unportable - "
+                 "use gnulib module strtoumax for portability");
+# endif
 #endif
 
 /* Don't bother defining or declaring wcstoimax and wcstoumax, since
--- a/lib/langinfo.in.h
+++ b/lib/langinfo.in.h
@@ -123,7 +123,7 @@
 
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 /* Declare overridden functions.  */
 
@@ -146,10 +146,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef nl_langinfo
-# define nl_langinfo(i)                      \
-    (GL_LINK_WARNING ("nl_langinfo is not portable - " \
-                      "use gnulib module nl_langinfo for portability"), \
-     nl_langinfo (i))
+# if HAVE_RAW_DECL_NL_LANGINFO
+_GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - "
+                 "use gnulib module nl_langinfo for portability");
+# endif
 #endif
 
 
--- a/lib/locale.in.h
+++ b/lib/locale.in.h
@@ -34,9 +34,9 @@
 # include <xlocale.h>
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
 
-/* The definition of _GL_ARG_NONNULL is copied here.  */
+/* The definition of _GL_WARN_ON_USE 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.  */
@@ -52,10 +52,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef duplocale
-# define duplocale(l) \
-   (GL_LINK_WARNING ("duplocale is buggy on some glibc systems - " \
-                     "use gnulib module duplocale for portability"), \
-    duplocale (l))
+# if HAVE_RAW_DECL_DUPLOCALE
+_GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - "
+                 "use gnulib module duplocale for portability");
+# endif
 #endif
 
 #endif /* _GL_LOCALE_H */
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -28,9 +28,9 @@
 #define _GL_MATH_H
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
 
-/* The definition of _GL_ARG_NONNULL is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 /* Helper macros to define a portability warning for the
    classification macro FUNC called with VALUE.  POSIX declares the
@@ -111,10 +111,9 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef frexp
-# define frexp(x,e) \
-    (GL_LINK_WARNING ("frexp is unportable - " \
-                      "use gnulib module frexp for portability"), \
-     frexp (x, e))
+/* Assume frexp is always declared.  */
+_GL_WARN_ON_USE (frexp, "frexp is unportable - "
+                 "use gnulib module frexp for portability");
 #endif
 
 
@@ -124,10 +123,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef acosl
-# define acosl(x) \
-    (GL_LINK_WARNING ("acosl is unportable - " \
-                      "use gnulib module mathl for portability"), \
-     acosl (x))
+# if HAVE_RAW_DECL_ACOSL
+_GL_WARN_ON_USE (acosl, "acosl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
 #endif
 
 
@@ -137,10 +136,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef asinl
-# define asinl(x) \
-    (GL_LINK_WARNING ("asinl is unportable - " \
-                      "use gnulib module mathl for portability"), \
-     asinl (x))
+# if HAVE_RAW_DECL_ASINL
+_GL_WARN_ON_USE (asinl, "asinl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
 #endif
 
 
@@ -150,10 +149,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef atanl
-# define atanl(x) \
-    (GL_LINK_WARNING ("atanl is unportable - " \
-                      "use gnulib module mathl for portability"), \
-     atanl (x))
+# if HAVE_RAW_DECL_ATANL
+_GL_WARN_ON_USE (atanl, "atanl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
 #endif
 
 
@@ -164,10 +163,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef ceilf
-# define ceilf(x) \
-    (GL_LINK_WARNING ("ceilf is unportable - " \
-                      "use gnulib module ceilf for portability"), \
-     ceilf (x))
+# if HAVE_RAW_DECL_CEILF
+_GL_WARN_ON_USE (ceilf, "ceilf is unportable - "
+                 "use gnulib module ceilf for portability");
+# endif
 #endif
 
 #if @GNULIB_CEILL@
@@ -177,10 +176,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef ceill
-# define ceill(x) \
-    (GL_LINK_WARNING ("ceill is unportable - " \
-                      "use gnulib module ceill for portability"), \
-     ceill (x))
+# if HAVE_RAW_DECL_CEILL
+_GL_WARN_ON_USE (ceill, "ceill is unportable - "
+                 "use gnulib module ceill for portability");
+# endif
 #endif
 
 
@@ -194,10 +193,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef cosl
-# define cosl(x) \
-    (GL_LINK_WARNING ("cosl is unportable - " \
-                      "use gnulib module mathl for portability"), \
-     cosl (x))
+# if HAVE_RAW_DECL_COSL
+_GL_WARN_ON_USE (cosl, "cosl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
 #endif
 
 
@@ -207,10 +206,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef expl
-# define expl(x) \
-    (GL_LINK_WARNING ("expl is unportable - " \
-                      "use gnulib module mathl for portability"), \
-     expl (x))
+# if HAVE_RAW_DECL_EXPL
+_GL_WARN_ON_USE (expl, "expl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
 #endif
 
 
@@ -221,10 +220,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef floorf
-# define floorf(x) \
-    (GL_LINK_WARNING ("floorf is unportable - " \
-                      "use gnulib module floorf for portability"), \
-     floorf (x))
+# if HAVE_RAW_DECL_FLOORF
+_GL_WARN_ON_USE (floorf, "floorf is unportable - "
+                 "use gnulib module floorf for portability");
+# endif
 #endif
 
 #if @GNULIB_FLOORL@
@@ -234,10 +233,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef floorl
-# define floorl(x) \
-    (GL_LINK_WARNING ("floorl is unportable - " \
-                      "use gnulib module floorl for portability"), \
-     floorl (x))
+# if HAVE_RAW_DECL_FLOORL
+_GL_WARN_ON_USE (floorl, "floorl is unportable - "
+                 "use gnulib module floorl for portability");
+# endif
 #endif
 
 
@@ -256,10 +255,10 @@
 #endif
 #if !@GNULIB_FREXPL@ && defined GNULIB_POSIXCHECK
 # undef frexpl
-# define frexpl(x,e) \
-    (GL_LINK_WARNING ("frexpl is unportable - " \
-                      "use gnulib module frexpl for portability"), \
-     frexpl (x, e))
+# if HAVE_RAW_DECL_FREXPL
+_GL_WARN_ON_USE (frexpl, "frexpl is unportable - "
+                 "use gnulib module frexpl for portability");
+# endif
 #endif
 
 
@@ -272,10 +271,10 @@
 #endif
 #if !@GNULIB_LDEXPL@ && defined GNULIB_POSIXCHECK
 # undef ldexpl
-# define ldexpl(x,e) \
-    (GL_LINK_WARNING ("ldexpl is unportable - " \
-                      "use gnulib module ldexpl for portability"), \
-     ldexpl (x, e))
+# if HAVE_RAW_DECL_LDEXPL
+_GL_WARN_ON_USE (ldexpl, "ldexpl is unportable - "
+                 "use gnulib module ldexpl for portability");
+# endif
 #endif
 
 
@@ -289,10 +288,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef logl
-# define logl(x) \
-    (GL_LINK_WARNING ("logl is unportable - " \
-                      "use gnulib module mathl for portability"), \
-     logl (x))
+# if HAVE_RAW_DECL_LOGL
+_GL_WARN_ON_USE (logl, "logl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
 #endif
 
 
@@ -304,10 +303,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef roundf
-# define roundf(x) \
-    (GL_LINK_WARNING ("roundf is unportable - " \
-                      "use gnulib module roundf for portability"), \
-     roundf (x))
+# if HAVE_RAW_DECL_ROUNDF
+_GL_WARN_ON_USE (roundf, "roundf is unportable - "
+                 "use gnulib module roundf for portability");
+# endif
 #endif
 
 #if @GNULIB_ROUND@
@@ -318,10 +317,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef round
-# define round(x) \
-    (GL_LINK_WARNING ("round is unportable - " \
-                      "use gnulib module round for portability"), \
-     round (x))
+# if HAVE_RAW_DECL_ROUND
+_GL_WARN_ON_USE (round, "round is unportable - "
+                 "use gnulib module round for portability");
+# endif
 #endif
 
 #if @GNULIB_ROUNDL@
@@ -332,10 +331,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef roundl
-# define roundl(x) \
-    (GL_LINK_WARNING ("roundl is unportable - " \
-                      "use gnulib module roundl for portability"), \
-     roundl (x))
+# if HAVE_RAW_DECL_ROUNDL
+_GL_WARN_ON_USE (roundl, "roundl is unportable - "
+                 "use gnulib module roundl for portability");
+# endif
 #endif
 
 
@@ -349,10 +348,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef sinl
-# define sinl(x) \
-    (GL_LINK_WARNING ("sinl is unportable - " \
-                      "use gnulib module mathl for portability"), \
-     sinl (x))
+# if HAVE_RAW_DECL_SINL
+_GL_WARN_ON_USE (sinl, "sinl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
 #endif
 
 
@@ -362,10 +361,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef sqrtl
-# define sqrtl(x) \
-    (GL_LINK_WARNING ("sqrtl is unportable - " \
-                      "use gnulib module mathl for portability"), \
-     sqrtl (x))
+# if HAVE_RAW_DECL_SQRTL
+_GL_WARN_ON_USE (sqrtl, "sqrtl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
 #endif
 
 
@@ -375,10 +374,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef tanl
-# define tanl(x) \
-    (GL_LINK_WARNING ("tanl is unportable - " \
-                      "use gnulib module mathl for portability"), \
-     tanl (x))
+# if HAVE_RAW_DECL_TANL
+_GL_WARN_ON_USE (tanl, "tanl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
 #endif
 
 
@@ -389,10 +388,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef truncf
-# define truncf(x) \
-    (GL_LINK_WARNING ("truncf is unportable - " \
-                      "use gnulib module truncf for portability"), \
-     truncf (x))
+# if HAVE_RAW_DECL_TRUNCF
+_GL_WARN_ON_USE (truncf, "truncf is unportable - "
+                 "use gnulib module truncf for portability");
+# endif
 #endif
 
 #if @GNULIB_TRUNC@
@@ -402,10 +401,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef trunc
-# define trunc(x) \
-    (GL_LINK_WARNING ("trunc is unportable - " \
-                      "use gnulib module trunc for portability"), \
-     trunc (x))
+# if HAVE_RAW_DECL_TRUNC
+_GL_WARN_ON_USE (trunc, "trunc is unportable - "
+                 "use gnulib module trunc for portability");
+# endif
 #endif
 
 #if @GNULIB_TRUNCL@
@@ -416,10 +415,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef truncl
-# define truncl(x) \
-    (GL_LINK_WARNING ("truncl is unportable - " \
-                      "use gnulib module truncl for portability"), \
-     truncl (x))
+# if HAVE_RAW_DECL_TRUNCL
+_GL_WARN_ON_USE (truncl, "truncl is unportable - "
+                 "use gnulib module truncl for portability");
+# endif
 #endif
 
 
--- a/lib/search.in.h
+++ b/lib/search.in.h
@@ -29,9 +29,9 @@
 #define _GL_SEARCH_H
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
 
-/* The definition of _GL_ARG_NONNULL is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 #ifdef __cplusplus
@@ -101,25 +101,25 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef tsearch
-# define tsearch(k,v,c) \
-    (GL_LINK_WARNING ("tsearch is unportable - " \
-                      "use gnulib module tsearch for portability"), \
-     tsearch (k, v, c))
+# if HAVE_RAW_DECL_TSEARCH
+_GL_WARN_ON_USE (tsearch, "tsearch is unportable - "
+                 "use gnulib module tsearch for portability");
+# endif
 # undef tfind
-# define tfind(k,v,c) \
-    (GL_LINK_WARNING ("tfind is unportable - " \
-                      "use gnulib module tsearch for portability"), \
-     tfind (k, v, c))
+# if HAVE_RAW_DECL_TFIND
+_GL_WARN_ON_USE (tfind, "tfind is unportable - "
+                 "use gnulib module tsearch for portability");
+# endif
 # undef tdelete
-# define tdelete(k,v,c) \
-    (GL_LINK_WARNING ("tdelete is unportable - " \
-                      "use gnulib module tsearch for portability"), \
-     tdelete (k, v, c))
+# if HAVE_RAW_DECL_TDELETE
+_GL_WARN_ON_USE (tdelete, "tdelete is unportable - "
+                 "use gnulib module tsearch for portability");
+# endif
 # undef twalk
-# define twalk(v,a) \
-    (GL_LINK_WARNING ("twalk is unportable - " \
-                      "use gnulib module tsearch for portability"), \
-     twalk (v, a))
+# if HAVE_RAW_DECL_TWALK
+_GL_WARN_ON_USE (twalk, "twalk is unportable - "
+                 "use gnulib module tsearch for portability");
+# endif
 #endif
 
 
--- a/lib/signal.in.h
+++ b/lib/signal.in.h
@@ -35,9 +35,9 @@
 #ifndef _GL_SIGNAL_H
 #define _GL_SIGNAL_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
 
-/* The definition of _GL_ARG_NONNULL is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 /* Define pid_t, uid_t.
    Also, mingw defines sigset_t not in <signal.h>, but in <sys/types.h>.  */
@@ -129,40 +129,40 @@
 # endif /* !@HAVE_POSIX_SIGNALBLOCKING@ */
 #elif defined GNULIB_POSIXCHECK
 # undef sigaddset
-# define sigaddset(s,n) \
-  (GL_LINK_WARNING ("sigaddset is unportable - "        \
-                    "use gnulib module sigprocmask for portability"),   \
-   sigaddset (s, n))
+# if HAVE_RAW_DECL_SIGADDSET
+_GL_WARN_ON_USE (sigaddset, "sigaddset is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
 # undef sigdelset
-# define sigdelset(s,n) \
-  (GL_LINK_WARNING ("sigdelset is unportable - "        \
-                    "use gnulib module sigprocmask for portability"),   \
-   sigdelset (s, n))
+# if HAVE_RAW_DECL_SIGDELSET
+_GL_WARN_ON_USE (sigdelset, "sigdelset is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
 # undef sigemptyset
-# define sigemptyset(s) \
-  (GL_LINK_WARNING ("sigemptyset is unportable - "        \
-                    "use gnulib module sigprocmask for portability"),   \
-   sigemptyset (s))
+# if HAVE_RAW_DECL_SIGEMPTYSET
+_GL_WARN_ON_USE (sigemptyset, "sigemptyset is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
 # undef sigfillset
-# define sigfillset(s) \
-  (GL_LINK_WARNING ("sigfillset is unportable - "        \
-                    "use gnulib module sigprocmask for portability"),   \
-   sigfillset (s))
+# if HAVE_RAW_DECL_SIGFILLSET
+_GL_WARN_ON_USE (sigfillset, "sigfillset is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
 # undef sigismember
-# define sigismember(s,n) \
-  (GL_LINK_WARNING ("sigismember is unportable - "        \
-                    "use gnulib module sigprocmask for portability"),   \
-   sigismember (s, n))
+# if HAVE_RAW_DECL_SIGISMEMBER
+_GL_WARN_ON_USE (sigismember, "sigismember is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
 # undef sigpending
-# define sigpending(s) \
-  (GL_LINK_WARNING ("sigpending is unportable - "        \
-                    "use gnulib module sigprocmask for portability"),   \
-   sigpending (s))
+# if HAVE_RAW_DECL_SIGPENDING
+_GL_WARN_ON_USE (sigpending, "sigpending is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
 # undef sigprocmask
-# define sigprocmask(h,s,o)                               \
-  (GL_LINK_WARNING ("sigprocmask is unportable - "        \
-                    "use gnulib module sigprocmask for portability"),   \
-   sigprocmask (h, s, o))
+# if HAVE_RAW_DECL_SIGPROCMASK
+_GL_WARN_ON_USE (sigprocmask, "sigprocmask is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
 #endif /* @GNULIB_SIGPROCMASK@ */
 
 
@@ -228,10 +228,10 @@
 # endif /* !@HAVE_SIGACTION@, !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@ */
 #elif defined GNULIB_POSIXCHECK
 # undef sigaction
-# define sigaction(s,a,o)                               \
-  (GL_LINK_WARNING ("sigaction is unportable - "        \
-                    "use gnulib module sigaction for portability"),   \
-   sigaction (s, a, o))
+# if HAVE_RAW_DECL_SIGACTION
+_GL_WARN_ON_USE (sigaction, "sigaction is unportable - "
+                 "use the gnulib module sigaction for portability");
+# endif
 #endif
 
 /* Some systems don't have SA_NODEFER.  */
--- a/lib/spawn.in.h
+++ b/lib/spawn.in.h
@@ -70,9 +70,9 @@
 # endif
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
 
-/* The definition of _GL_ARG_NONNULL is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 /* Data structure to contain attributes for thread creation.  */
@@ -163,10 +163,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawn
-# define posix_spawn(a,b,c,d,e,f)                   \
-  (GL_LINK_WARNING ("posix_spawn is unportable - "        \
-                    "use gnulib module posix_spawn for portability"),   \
-   posix_spawn (a, b, c, d, e, f))
+# if HAVE_RAW_DECL_POSIX_SPAWN
+_GL_WARN_ON_USE (posix_spawn, "posix_spawn is unportable - "
+                 "use gnulib module posix_spawn for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNP@
@@ -186,10 +186,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnp
-# define posix_spawnp(a,b,c,d,e,f)                   \
-  (GL_LINK_WARNING ("posix_spawnp is unportable - "        \
-                    "use gnulib module posix_spawnp for portability"),   \
-   posix_spawnp (a, b, c, d, e, f))
+# if HAVE_RAW_DECL_POSIX_SPAWNP
+_GL_WARN_ON_USE (posix_spawnp, "posix_spawnp is unportable - "
+                 "use gnulib module posix_spawnp for portability");
+# endif
 #endif
 
 
@@ -204,10 +204,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_init
-# define posix_spawnattr_init(a)                   \
-  (GL_LINK_WARNING ("posix_spawnattr_init is unportable - "        \
-                    "use gnulib module posix_spawnattr_init for portability"), \
-   posix_spawnattr_init (a))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_INIT
+_GL_WARN_ON_USE (posix_spawnattr_init, "posix_spawnattr_init is unportable - "
+                 "use gnulib module posix_spawnattr_init for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_DESTROY@
@@ -221,10 +221,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_destroy
-# define posix_spawnattr_destroy(a)                   \
-  (GL_LINK_WARNING ("posix_spawnattr_destroy is unportable - "        \
-                    "use gnulib module posix_spawnattr_destroy for portability"), \
-   posix_spawnattr_destroy (a))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_DESTROY
+_GL_WARN_ON_USE (posix_spawnattr_destroy, "posix_spawnattr_destroy is unportable - "
+                 "use gnulib module posix_spawnattr_destroy for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT@
@@ -240,10 +240,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_getsigdefault
-# define posix_spawnattr_getsigdefault(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_getsigdefault is unportable - "        \
-                    "use gnulib module posix_spawnattr_getsigdefault for portability"), \
-   posix_spawnattr_getsigdefault (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGDEFAULT
+_GL_WARN_ON_USE (posix_spawnattr_getsigdefault, "posix_spawnattr_getsigdefault is unportable - "
+                 "use gnulib module posix_spawnattr_getsigdefault for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT@
@@ -258,10 +258,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_setsigdefault
-# define posix_spawnattr_setsigdefault(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_setsigdefault is unportable - "        \
-                    "use gnulib module posix_spawnattr_setsigdefault for portability"), \
-   posix_spawnattr_setsigdefault (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGDEFAULT
+_GL_WARN_ON_USE (posix_spawnattr_setsigdefault, "posix_spawnattr_setsigdefault is unportable - "
+                 "use gnulib module posix_spawnattr_setsigdefault for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_GETSIGMASK@
@@ -276,10 +276,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_getsigmask
-# define posix_spawnattr_getsigmask(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_getsigmask is unportable - "        \
-                    "use gnulib module posix_spawnattr_getsigmask for portability"), \
-   posix_spawnattr_getsigmask (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGMASK
+_GL_WARN_ON_USE (posix_spawnattr_getsigmask, "posix_spawnattr_getsigmask is unportable - "
+                 "use gnulib module posix_spawnattr_getsigmask for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_SETSIGMASK@
@@ -294,10 +294,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_setsigmask
-# define posix_spawnattr_setsigmask(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_setsigmask is unportable - "        \
-                    "use gnulib module posix_spawnattr_setsigmask for portability"), \
-   posix_spawnattr_setsigmask (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGMASK
+_GL_WARN_ON_USE (posix_spawnattr_setsigmask, "posix_spawnattr_setsigmask is unportable - "
+                 "use gnulib module posix_spawnattr_setsigmask for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_GETFLAGS@
@@ -312,10 +312,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_getflags
-# define posix_spawnattr_getflags(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_getflags is unportable - "        \
-                    "use gnulib module posix_spawnattr_getflags for portability"), \
-   posix_spawnattr_getflags (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETFLAGS
+_GL_WARN_ON_USE (posix_spawnattr_getflags, "posix_spawnattr_getflags is unportable - "
+                 "use gnulib module posix_spawnattr_getflags for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_SETFLAGS@
@@ -330,10 +330,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_setflags
-# define posix_spawnattr_setflags(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_setflags is unportable - "        \
-                    "use gnulib module posix_spawnattr_setflags for portability"), \
-   posix_spawnattr_setflags (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETFLAGS
+_GL_WARN_ON_USE (posix_spawnattr_setflags, "posix_spawnattr_setflags is unportable - "
+                 "use gnulib module posix_spawnattr_setflags for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_GETPGROUP@
@@ -348,10 +348,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_getpgroup
-# define posix_spawnattr_getpgroup(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_getpgroup is unportable - "        \
-                    "use gnulib module posix_spawnattr_getpgroup for portability"), \
-   posix_spawnattr_getpgroup (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETPGROUP
+_GL_WARN_ON_USE (posix_spawnattr_getpgroup, "posix_spawnattr_getpgroup is unportable - "
+                 "use gnulib module posix_spawnattr_getpgroup for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_SETPGROUP@
@@ -366,10 +366,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_setpgroup
-# define posix_spawnattr_setpgroup(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_setpgroup is unportable - "        \
-                    "use gnulib module posix_spawnattr_setpgroup for portability"), \
-   posix_spawnattr_setpgroup (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETPGROUP
+_GL_WARN_ON_USE (posix_spawnattr_setpgroup, "posix_spawnattr_setpgroup is unportable - "
+                 "use gnulib module posix_spawnattr_setpgroup for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY@
@@ -384,10 +384,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_getschedpolicy
-# define posix_spawnattr_getschedpolicy(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_getschedpolicy is unportable - "        \
-                    "use gnulib module posix_spawnattr_getschedpolicy for portability"), \
-   posix_spawnattr_getschedpolicy (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPOLICY
+_GL_WARN_ON_USE (posix_spawnattr_getschedpolicy, "posix_spawnattr_getschedpolicy is unportable - "
+                 "use gnulib module posix_spawnattr_getschedpolicy for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY@
@@ -402,10 +402,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_setschedpolicy
-# define posix_spawnattr_setschedpolicy(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_setschedpolicy is unportable - "        \
-                    "use gnulib module posix_spawnattr_setschedpolicy for portability"), \
-   posix_spawnattr_setschedpolicy (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPOLICY
+_GL_WARN_ON_USE (posix_spawnattr_setschedpolicy, "posix_spawnattr_setschedpolicy is unportable - "
+                 "use gnulib module posix_spawnattr_setschedpolicy for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM@
@@ -420,10 +420,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_getschedparam
-# define posix_spawnattr_getschedparam(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_getschedparam is unportable - "        \
-                    "use gnulib module posix_spawnattr_getschedparam for portability"), \
-   posix_spawnattr_getschedparam (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPARAM
+_GL_WARN_ON_USE (posix_spawnattr_getschedparam, "posix_spawnattr_getschedparam is unportable - "
+                 "use gnulib module posix_spawnattr_getschedparam for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM@
@@ -438,10 +438,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_setschedparam
-# define posix_spawnattr_setschedparam(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_setschedparam is unportable - "        \
-                    "use gnulib module posix_spawnattr_setschedparam for portability"), \
-   posix_spawnattr_setschedparam (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPARAM
+_GL_WARN_ON_USE (posix_spawnattr_setschedparam, "posix_spawnattr_setschedparam is unportable - "
+                 "use gnulib module posix_spawnattr_setschedparam for portability");
+# endif
 #endif
 
 
@@ -456,10 +456,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawn_file_actions_init
-# define posix_spawn_file_actions_init(a)                         \
-  (GL_LINK_WARNING ("posix_spawn_file_actions_init is unportable - "        \
-                    "use gnulib module posix_spawn_file_actions_init for portability"), \
-   posix_spawn_file_actions_init (a))
+# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_INIT
+_GL_WARN_ON_USE (posix_spawn_file_actions_init, "posix_spawn_file_actions_init is unportable - "
+                 "use gnulib module posix_spawn_file_actions_init for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY@
@@ -473,10 +473,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawn_file_actions_destroy
-# define posix_spawn_file_actions_destroy(a)                         \
-  (GL_LINK_WARNING ("posix_spawn_file_actions_destroy is unportable - "        \
-                    "use gnulib module posix_spawn_file_actions_destroy for portability"), \
-   posix_spawn_file_actions_destroy (a))
+# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_DESTROY
+_GL_WARN_ON_USE (posix_spawn_file_actions_destroy, "posix_spawn_file_actions_destroy is unportable - "
+                 "use gnulib module posix_spawn_file_actions_destroy for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN@
@@ -494,10 +494,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawn_file_actions_addopen
-# define posix_spawn_file_actions_addopen(a, b, c, d, e)                     \
-  (GL_LINK_WARNING ("posix_spawn_file_actions_addopen is unportable - "        \
-                    "use gnulib module posix_spawn_file_actions_addopen for portability"), \
-   posix_spawn_file_actions_addopen (a, b, c, d, e))
+# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN
+_GL_WARN_ON_USE (posix_spawn_file_actions_addopen, "posix_spawn_file_actions_addopen is unportable - "
+                 "use gnulib module posix_spawn_file_actions_addopen for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE@
@@ -513,10 +513,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawn_file_actions_addclose
-# define posix_spawn_file_actions_addclose(a,b)                          \
-  (GL_LINK_WARNING ("posix_spawn_file_actions_addclose is unportable - "        \
-                    "use gnulib module posix_spawn_file_actions_addclose for portability"), \
-   posix_spawn_file_actions_addclose (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE
+_GL_WARN_ON_USE (posix_spawn_file_actions_addclose, "posix_spawn_file_actions_addclose is unportable - "
+                 "use gnulib module posix_spawn_file_actions_addclose for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2@
@@ -532,10 +532,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawn_file_actions_adddup2
-# define posix_spawn_file_actions_adddup2(a,b,c)                         \
-  (GL_LINK_WARNING ("posix_spawn_file_actions_adddup2 is unportable - "        \
-                    "use gnulib module posix_spawn_file_actions_adddup2 for portability"), \
-   posix_spawn_file_actions_adddup2 (a, b, c))
+# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2
+_GL_WARN_ON_USE (posix_spawn_file_actions_adddup2, "posix_spawn_file_actions_adddup2 is unportable - "
+                 "use gnulib module posix_spawn_file_actions_adddup2 for portability");
+# endif
 #endif
 
 
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -57,8 +57,6 @@
 #endif
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
 /* The definition of _GL_WARN_ON_USE is copied here.  */
@@ -78,10 +76,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef dprintf
-# define dprintf \
-    (GL_LINK_WARNING ("dprintf is unportable - " \
-                      "use gnulib module dprintf for portability"), \
-     dprintf)
+# if HAVE_RAW_DECL_DPRINTF
+_GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
+                 "use gnulib module dprintf for portability");
+# endif
 #endif
 
 #if @GNULIB_FCLOSE@
@@ -92,11 +90,9 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fclose
-# define fclose(f) \
-   (GL_LINK_WARNING ("fclose is not always POSIX compliant - " \
-                     "use gnulib module fclose for portable " \
-                     "POSIX compliance"), \
-    fclose (f))
+/* Assume fclose is always declared.  */
+_GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
+                 "use gnulib module fclose for portable POSIX compliance");
 #endif
 
 #if @GNULIB_FFLUSH@
@@ -112,11 +108,9 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fflush
-# define fflush(f) \
-   (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
-                     "use gnulib module fflush for portable " \
-                     "POSIX compliance"), \
-    fflush (f))
+/* Assume fflush is always declared.  */
+_GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
+                 "use gnulib module fflush for portable POSIX compliance");
 #endif
 
 /* It is very rare that the developer ever has full control of stdin,
@@ -134,10 +128,9 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fopen
-# define fopen(f,m) \
-   (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
-                     "use gnulib module fopen for portability"), \
-    fopen (f, m))
+/* Assume fopen is always declared.  */
+_GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - "
+                 "use gnulib module fopen for portability");
 #endif
 
 #if @GNULIB_FPRINTF_POSIX@
@@ -154,11 +147,10 @@
        _GL_ARG_NONNULL ((1, 2));
 #elif defined GNULIB_POSIXCHECK
 # undef fprintf
-# define fprintf \
-    (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
-                      "use gnulib module fprintf-posix for portable " \
-                      "POSIX compliance"), \
-     fprintf)
+/* Assume fprintf is always declared.  */
+_GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
+                 "use gnulib module fprintf-posix for portable "
+                 "POSIX compliance");
 #endif
 
 #if @GNULIB_FPURGE@
@@ -176,10 +168,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fpurge
-# define fpurge(f) \
-   (GL_LINK_WARNING ("fpurge is not always present - " \
-                     "use gnulib module fpurge for portability"), \
-    fpurge (f))
+# if HAVE_RAW_DECL_FPURGE
+_GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
+                 "use gnulib module fpurge for portability");
+# endif
 #endif
 
 #if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
@@ -203,10 +195,9 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef freopen
-# define freopen(f,m,s) \
-   (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
-                     "use gnulib module freopen for portability"), \
-    freopen (f, m, s))
+/* Assume freopen is always declared.  */
+_GL_WARN_ON_USE (freopen, "freopen on Win32 platforms is not POSIX compatible - "
+                 "use gnulib module freopen for portability");
 #endif
 
 /* Set up the following warnings, based on which modules are in use.
@@ -362,10 +353,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getdelim
-# define getdelim(l, s, d, f)                                       \
-  (GL_LINK_WARNING ("getdelim is unportable - "                     \
-                    "use gnulib module getdelim for portability"),  \
-   getdelim (l, s, d, f))
+# if HAVE_RAW_DECL_GETDELIM
+_GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
+                 "use gnulib module getdelim for portability");
+# endif
 #endif
 
 #if @GNULIB_GETLINE@
@@ -385,10 +376,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getline
-# define getline(l, s, f)                                               \
-  (GL_LINK_WARNING ("getline is unportable - "                          \
-                    "use gnulib module getline for portability"),       \
-   getline (l, s, f))
+# if HAVE_RAW_DECL_GETLINE
+_GL_WARN_ON_USE (getline, "getline is unportable - "
+                 "use gnulib module getline for portability");
+# endif
 #endif
 
 #if @GNULIB_OBSTACK_PRINTF@
@@ -421,10 +412,9 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef perror
-# define perror(s) \
-    (GL_LINK_WARNING ("perror is not always POSIX compliant - " \
-                      "use gnulib module perror for portability"), \
-     perror (s))
+/* Assume perror is always declared.  */
+_GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
+                 "use gnulib module perror for portability");
 #endif
 
 #if @GNULIB_POPEN@
@@ -436,10 +426,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef popen
-# define popen(c,m) \
-   (GL_LINK_WARNING ("popen is buggy on some platforms - " \
-                     "use gnulib module popen or pipe for more portability"), \
-    popen (c, m))
+# if HAVE_RAW_DECL_POPEN
+_GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
+                 "use gnulib module popen or pipe for more portability");
+# endif
 #endif
 
 #if @GNULIB_PRINTF_POSIX@
@@ -456,18 +446,10 @@
        __attribute__ ((__format__ (__printf__, 1, 2))) _GL_ARG_NONNULL ((1));
 #elif defined GNULIB_POSIXCHECK
 # undef printf
-# define printf \
-    (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
-                      "use gnulib module printf-posix for portable " \
-                      "POSIX compliance"), \
-     printf)
-/* Don't break __attribute__((format(printf,M,N))).  */
-# define format(kind,m,n) format (__##kind##__, m, n)
-# define __format__(kind,m,n) __format__ (__##kind##__, m, n)
-# define ____printf____ __printf__
-# define ____scanf____ __scanf__
-# define ____strftime____ __strftime__
-# define ____strfmon____ __strfmon__
+/* Assume printf is always declared.  */
+_GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
+                 "use gnulib module printf-posix for portable "
+                 "POSIX compliance");
 #endif
 
 #if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
@@ -496,10 +478,9 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef remove
-# define remove(n)                                         \
-   (GL_LINK_WARNING ("remove cannot handle directories on some platforms - " \
-                     "use gnulib module remove for more portability"), \
-    remove (n))
+/* Assume remove is always declared.  */
+_GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
+                 "use gnulib module remove for more portability");
 #endif
 
 #if @GNULIB_RENAME@
@@ -511,10 +492,9 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rename
-# define rename(o,n)                                       \
-   (GL_LINK_WARNING ("rename is buggy on some platforms - " \
-                     "use gnulib module rename for more portability"), \
-    rename (o, n))
+/* Assume rename is always declared.  */
+_GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
+                 "use gnulib module rename for more portability");
 #endif
 
 #if @GNULIB_RENAMEAT@
@@ -528,10 +508,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef renameat
-# define renameat(d1,f1,d2,f2)             \
-    (GL_LINK_WARNING ("renameat is not portable - " \
-                      "use gnulib module renameat for portability"), \
-     renameat (d1, f1, d2, f2))
+# if HAVE_RAW_DECL_RENAMEAT
+_GL_WARN_ON_USE (renameat, "renameat is not portable - "
+                 "use gnulib module renameat for portability");
+# endif
 #endif
 
 #if @GNULIB_SNPRINTF@
@@ -545,10 +525,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef snprintf
-# define snprintf \
-    (GL_LINK_WARNING ("snprintf is unportable - " \
-                      "use gnulib module snprintf for portability"), \
-     snprintf)
+# if HAVE_RAW_DECL_SNPRINTF
+_GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
+                 "use gnulib module snprintf for portability");
+# endif
 #endif
 
 /* Some people would argue that sprintf should be handled like gets
@@ -569,11 +549,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef sprintf
-# define sprintf \
-    (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
-                      "use gnulib module sprintf-posix for portable " \
-                      "POSIX compliance"), \
-     sprintf)
+/* Assume sprintf is always declared.  */
+_GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
+                 "use gnulib module sprintf-posix for portable "
+                 "POSIX compliance");
 #endif
 
 #if @GNULIB_VASPRINTF@
@@ -603,10 +582,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef vdprintf
-# define vdprintf(d,f,a) \
-    (GL_LINK_WARNING ("vdprintf is unportable - " \
-                      "use gnulib module vdprintf for portability"), \
-     vdprintf (d, f, a))
+# if HAVE_RAW_DECL_VDPRINTF
+_GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
+                 "use gnulib module vdprintf for portability");
+# endif
 #endif
 
 #if @GNULIB_VFPRINTF_POSIX@
@@ -623,11 +602,10 @@
        _GL_ARG_NONNULL ((1, 2));
 #elif defined GNULIB_POSIXCHECK
 # undef vfprintf
-# define vfprintf(s,f,a) \
-    (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
-                      "use gnulib module vfprintf-posix for portable " \
-                      "POSIX compliance"), \
-     vfprintf (s, f, a))
+/* Assume vfprintf is always declared.  */
+_GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
+                 "use gnulib module vfprintf-posix for portable "
+                      "POSIX compliance");
 #endif
 
 #if @GNULIB_VPRINTF_POSIX@
@@ -642,11 +620,10 @@
        __attribute__ ((__format__ (__printf__, 1, 0))) _GL_ARG_NONNULL ((1));
 #elif defined GNULIB_POSIXCHECK
 # undef vprintf
-# define vprintf(f,a) \
-    (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
-                      "use gnulib module vprintf-posix for portable " \
-                      "POSIX compliance"), \
-     vprintf (f, a))
+/* Assume vprintf is always declared.  */
+_GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
+                 "use gnulib module vprintf-posix for portable "
+                 "POSIX compliance");
 #endif
 
 #if @GNULIB_VSNPRINTF@
@@ -660,10 +637,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef vsnprintf
-# define vsnprintf(b,s,f,a) \
-    (GL_LINK_WARNING ("vsnprintf is unportable - " \
-                      "use gnulib module vsnprintf for portability"), \
-     vsnprintf (b, s, f, a))
+# if HAVE_RAW_DECL_VSNPRINTF
+_GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
+                 "use gnulib module vsnprintf for portability");
+# endif
 #endif
 
 #if @GNULIB_VSPRINTF_POSIX@
@@ -675,11 +652,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef vsprintf
-# define vsprintf(b,f,a) \
-    (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
-                      "use gnulib module vsprintf-posix for portable " \
-                      "POSIX compliance"), \
-     vsprintf (b, f, a))
+/* Assume vsprintf is always declared.  */
+_GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
+                 "use gnulib module vsprintf-posix for portable "
+                      "POSIX compliance");
 #endif
 
 #ifdef __cplusplus
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -74,9 +74,9 @@
 # include <unistd.h>
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
 
-/* The definition of _GL_ARG_NONNULL is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 /* Some systems do not define EXIT_*, despite otherwise supporting C89.  */
@@ -105,10 +105,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef atoll
-# define atoll(s) \
-    (GL_LINK_WARNING ("atoll is unportable - " \
-                      "use gnulib module atoll for portability"), \
-     atoll (s))
+# if HAVE_RAW_DECL_ATOLL
+_GL_WARN_ON_USE (atoll, "atoll is unportable - "
+                 "use gnulib module atoll for portability");
+# endif
 #endif
 
 #if @GNULIB_CALLOC_POSIX@
@@ -119,10 +119,9 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef calloc
-# define calloc(n,s) \
-    (GL_LINK_WARNING ("calloc is not POSIX compliant everywhere - " \
-                      "use gnulib module calloc-posix for portability"), \
-     calloc (n, s))
+/* Assume calloc is always declared.  */
+_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
+                 "use gnulib module calloc-posix for portability");
 #endif
 
 #if @GNULIB_CANONICALIZE_FILE_NAME@
@@ -134,10 +133,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef canonicalize_file_name
-# define canonicalize_file_name(n)                        \
-    (GL_LINK_WARNING ("canonicalize_file_name is unportable - " \
-                      "use gnulib module canonicalize-lgpl for portability"), \
-     canonicalize_file_name (n))
+# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
+_GL_WARN_ON_USE (canonicalize_file_name, "canonicalize_file_name is unportable - "
+                 "use gnulib module canonicalize-lgpl for portability");
+# endif
 #endif
 
 #if @GNULIB_GETLOADAVG@
@@ -150,10 +149,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getloadavg
-# define getloadavg(l,n) \
-    (GL_LINK_WARNING ("getloadavg is not portable - " \
-                      "use gnulib module getloadavg for portability"), \
-     getloadavg (l, n))
+# if HAVE_RAW_DECL_GETLOADAVG
+_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
+                 "use gnulib module getloadavg for portability");
+# endif
 #endif
 
 #if @GNULIB_GETSUBOPT@
@@ -174,10 +173,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getsubopt
-# define getsubopt(o,t,v) \
-    (GL_LINK_WARNING ("getsubopt is unportable - " \
-                      "use gnulib module getsubopt for portability"), \
-     getsubopt (o, t, v))
+# if HAVE_RAW_DECL_GETSUBOPT
+_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
+                 "use gnulib module getsubopt for portability");
+# endif
 #endif
 
 #if @GNULIB_MALLOC_POSIX@
@@ -188,10 +187,9 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef malloc
-# define malloc(s) \
-    (GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \
-                      "use gnulib module malloc-posix for portability"), \
-     malloc (s))
+/* Assume malloc is always declared.  */
+_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
+                 "use gnulib module malloc-posix for portability");
 #endif
 
 #if @GNULIB_MKDTEMP@
@@ -205,10 +203,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkdtemp
-# define mkdtemp(t) \
-    (GL_LINK_WARNING ("mkdtemp is unportable - " \
-                      "use gnulib module mkdtemp for portability"), \
-     mkdtemp (t))
+# if HAVE_RAW_DECL_MKDTEMP
+_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
+                 "use gnulib module mkdtemp for portability");
+# endif
 #endif
 
 #if @GNULIB_MKOSTEMP@
@@ -229,10 +227,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkostemp
-# define mkostemp(t,f) \
-    (GL_LINK_WARNING ("mkostemp is unportable - " \
-                      "use gnulib module mkostemp for portability"), \
-     mkostemp (t, f))
+# if HAVE_RAW_DECL_MKOSTEMP
+_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
+                 "use gnulib module mkostemp for portability");
+# endif
 #endif
 
 #if @GNULIB_MKOSTEMPS@
@@ -255,10 +253,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkostemps
-# define mkostemps(t,s,f)                          \
-    (GL_LINK_WARNING ("mkostemps is unportable - " \
-                      "use gnulib module mkostemps for portability"), \
-     mkostemps (t, s, f))
+# if HAVE_RAW_DECL_MKOSTEMPS
+_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
+                 "use gnulib module mkostemps for portability");
+# endif
 #endif
 
 #if @GNULIB_MKSTEMP@
@@ -277,10 +275,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkstemp
-# define mkstemp(t) \
-    (GL_LINK_WARNING ("mkstemp is unportable - " \
-                      "use gnulib module mkstemp for portability"), \
-     mkstemp (t))
+# if HAVE_RAW_DECL_MKSTEMP
+_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
+                 "use gnulib module mkstemp for portability");
+# endif
 #endif
 
 #if @GNULIB_MKSTEMPS@
@@ -300,10 +298,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkstemps
-# define mkstemps(t,s)                             \
-    (GL_LINK_WARNING ("mkstemps is unportable - " \
-                      "use gnulib module mkstemps for portability"), \
-     mkstemps (t, s))
+# if HAVE_RAW_DECL_MKSTEMPS
+_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
+                 "use gnulib module mkstemps for portability");
+# endif
 #endif
 
 #if @GNULIB_PUTENV@
@@ -333,25 +331,25 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef random_r
-# define random_r(b,r)                            \
-    (GL_LINK_WARNING ("random_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     random_r (b,r))
+# if HAVE_RAW_DECL_RANDOM_R
+_GL_WARN_ON_USE (random_r, "random_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
 # undef initstate_r
-# define initstate_r(s,b,sz,r)                       \
-    (GL_LINK_WARNING ("initstate_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     initstate_r (s,b,sz,r))
+# if HAVE_RAW_DECL_INITSTATE_R
+_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
 # undef srandom_r
-# define srandom_r(s,r)                            \
-    (GL_LINK_WARNING ("srandom_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     srandom_r (s,r))
+# if HAVE_RAW_DECL_SRANDOM_R
+_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
 # undef setstate_r
-# define setstate_r(a,r)                                    \
-    (GL_LINK_WARNING ("setstate_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     setstate_r (a,r))
+# if HAVE_RAW_DECL_SETSTATE_R
+_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
 #endif
 
 #if @GNULIB_REALLOC_POSIX@
@@ -362,10 +360,9 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef realloc
-# define realloc(p,s) \
-    (GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \
-                      "use gnulib module realloc-posix for portability"), \
-     realloc (p, s))
+/* Assume realloc is always declared.  */
+_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
+                 "use gnulib module realloc-posix for portability");
 #endif
 
 #if @GNULIB_REALPATH@
@@ -377,10 +374,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef realpath
-# define realpath(n,r)                        \
-    (GL_LINK_WARNING ("realpath is unportable - use gnulib module " \
-                      "canonicalize or canonicalize-lgpl for portability"), \
-     realpath (n, r))
+# if HAVE_RAW_DECL_REALPATH
+_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
+                 "canonicalize or canonicalize-lgpl for portability");
+# endif
 #endif
 
 #if @GNULIB_RPMATCH@
@@ -391,10 +388,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rpmatch
-# define rpmatch(r) \
-    (GL_LINK_WARNING ("rpmatch is unportable - " \
-                      "use gnulib module rpmatch for portability"), \
-     rpmatch (r))
+# if HAVE_RAW_DECL_RPMATCH
+_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
+                 "use gnulib module rpmatch for portability");
+# endif
 #endif
 
 #if @GNULIB_SETENV@
@@ -410,10 +407,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef setenv
-# define setenv(n,v,o)                                                  \
-    (GL_LINK_WARNING ("setenv is unportable - "                         \
-                      "use gnulib module setenv for portability"),      \
-     setenv (n, v, o))
+# if HAVE_RAW_DECL_SETENV
+_GL_WARN_ON_USE (setenv, "setenv is unportable - "
+                 "use gnulib module setenv for portability");
+# endif
 #endif
 
 #if @GNULIB_STRTOD@
@@ -426,10 +423,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtod
-# define strtod(s, e)                           \
-    (GL_LINK_WARNING ("strtod is unportable - " \
-                      "use gnulib module strtod for portability"), \
-     strtod (s, e))
+# if HAVE_RAW_DECL_STRTOD
+_GL_WARN_ON_USE (strtod, "strtod is unportable - "
+                 "use gnulib module strtod for portability");
+# endif
 #endif
 
 #if @GNULIB_STRTOLL@
@@ -447,10 +444,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtoll
-# define strtoll(s,e,b) \
-    (GL_LINK_WARNING ("strtoll is unportable - " \
-                      "use gnulib module strtoll for portability"), \
-     strtoll (s, e, b))
+# if HAVE_RAW_DECL_STRTOLL
+_GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
+                 "use gnulib module strtoll for portability");
+# endif
 #endif
 
 #if @GNULIB_STRTOULL@
@@ -468,10 +465,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtoull
-# define strtoull(s,e,b) \
-    (GL_LINK_WARNING ("strtoull is unportable - " \
-                      "use gnulib module strtoull for portability"), \
-     strtoull (s, e, b))
+# if HAVE_RAW_DECL_STRTOULL
+_GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
+                 "use gnulib module strtoull for portability");
+# endif
 #endif
 
 #if @GNULIB_UNSETENV@
@@ -485,10 +482,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef unsetenv
-# define unsetenv(n)                                                    \
-    (GL_LINK_WARNING ("unsetenv is unportable - "                       \
-                      "use gnulib module unsetenv for portability"),    \
-     unsetenv (n))
+# if HAVE_RAW_DECL_UNSETENV
+_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
+                 "use gnulib module unsetenv for portability");
+# endif
 #endif
 
 #ifdef __cplusplus
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -48,9 +48,9 @@
 #endif
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
 
-/* The definition of _GL_ARG_NONNULL is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 #ifdef __cplusplus
@@ -67,10 +67,9 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memchr
-# define memchr(s,c,n) \
-    (GL_LINK_WARNING ("memchr has platform-specific bugs - " \
-                      "use gnulib module memchr for portability" ), \
-     memchr (s, c, n))
+/* Assume memchr is always declared.  */
+_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
+                 "use gnulib module memchr for portability" );
 #endif
 
 /* Return the first occurrence of NEEDLE in HAYSTACK.  */
@@ -85,11 +84,11 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memmem
-# define memmem(a,al,b,bl) \
-    (GL_LINK_WARNING ("memmem is unportable and often quadratic - " \
-                      "use gnulib module memmem-simple for portability, " \
-                      "and module memmem for speed" ), \
-     memmem (a, al, b, bl))
+# if HAVE_RAW_DECL_MEMMEM
+_GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
+                 "use gnulib module memmem-simple for portability, "
+                 "and module memmem for speed" );
+# endif
 #endif
 
 /* Copy N bytes of SRC to DEST, return pointer to bytes after the
@@ -102,10 +101,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mempcpy
-# define mempcpy(a,b,n) \
-    (GL_LINK_WARNING ("mempcpy is unportable - " \
-                      "use gnulib module mempcpy for portability"), \
-     mempcpy (a, b, n))
+# if HAVE_RAW_DECL_MEMPCPY
+_GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
+                 "use gnulib module mempcpy for portability");
+# endif
 #endif
 
 /* Search backwards through a block for a byte (specified as an int).  */
@@ -116,10 +115,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memrchr
-# define memrchr(a,b,c) \
-    (GL_LINK_WARNING ("memrchr is unportable - " \
-                      "use gnulib module memrchr for portability"), \
-     memrchr (a, b, c))
+# if HAVE_RAW_DECL_MEMRCHR
+_GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
+                 "use gnulib module memrchr for portability");
+# endif
 #endif
 
 /* Find the first occurrence of C in S.  More efficient than
@@ -132,10 +131,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rawmemchr
-# define rawmemchr(a,b) \
-    (GL_LINK_WARNING ("rawmemchr is unportable - " \
-                      "use gnulib module rawmemchr for portability"), \
-     rawmemchr (a, b))
+# if HAVE_RAW_DECL_RAWMEMCHR
+_GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
+                 "use gnulib module rawmemchr for portability");
+# endif
 #endif
 
 /* Copy SRC to DST, returning the address of the terminating '\0' in DST.  */
@@ -146,10 +145,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef stpcpy
-# define stpcpy(a,b) \
-    (GL_LINK_WARNING ("stpcpy is unportable - " \
-                      "use gnulib module stpcpy for portability"), \
-     stpcpy (a, b))
+# if HAVE_RAW_DECL_STPCPY
+_GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
+                 "use gnulib module stpcpy for portability");
+# endif
 #endif
 
 /* Copy no more than N bytes of SRC to DST, returning a pointer past the
@@ -163,21 +162,20 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef stpncpy
-# define stpncpy(a,b,n) \
-    (GL_LINK_WARNING ("stpncpy is unportable - " \
-                      "use gnulib module stpncpy for portability"), \
-     stpncpy (a, b, n))
+# if HAVE_RAW_DECL_STPNCPY
+_GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
+                 "use gnulib module stpncpy for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strchr() does not work with multibyte strings if the locale encoding is
    GB18030 and the character to be searched is a digit.  */
 # undef strchr
-# define strchr(s,c) \
-    (GL_LINK_WARNING ("strchr cannot work correctly on character strings " \
-                      "in some multibyte locales - " \
-                      "use mbschr if you care about internationalization"), \
-     strchr (s, c))
+/* Assume strchr is always declared.  */
+_GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings "
+                 "in some multibyte locales - "
+                 "use mbschr if you care about internationalization");
 #endif
 
 /* Find the first occurrence of C in S or the final NUL byte.  */
@@ -188,10 +186,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strchrnul
-# define strchrnul(a,b) \
-    (GL_LINK_WARNING ("strchrnul is unportable - " \
-                      "use gnulib module strchrnul for portability"), \
-     strchrnul (a, b))
+# if HAVE_RAW_DECL_STRCHRNUL
+_GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
+                 "use gnulib module strchrnul for portability");
+# endif
 #endif
 
 /* Duplicate S, returning an identical malloc'd string.  */
@@ -205,10 +203,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strdup
-# define strdup(a) \
-    (GL_LINK_WARNING ("strdup is unportable - " \
-                      "use gnulib module strdup for portability"), \
-     strdup (a))
+# if HAVE_RAW_DECL_STRDUP
+_GL_WARN_ON_USE (strdup, "strdup is unportable - "
+                 "use gnulib module strdup for portability");
+# endif
 #endif
 
 /* Return a newly allocated copy of at most N bytes of STRING.  */
@@ -222,10 +220,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strndup
-# define strndup(a,n) \
-    (GL_LINK_WARNING ("strndup is unportable - " \
-                      "use gnulib module strndup for portability"), \
-     strndup (a, n))
+# if HAVE_RAW_DECL_STRNDUP
+_GL_WARN_ON_USE (strndup, "strndup is unportable - "
+                 "use gnulib module strndup for portability");
+# endif
 #endif
 
 /* Find the length (number of bytes) of STRING, but scan at most
@@ -238,10 +236,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strnlen
-# define strnlen(a,n) \
-    (GL_LINK_WARNING ("strnlen is unportable - " \
-                      "use gnulib module strnlen for portability"), \
-     strnlen (a, n))
+# if HAVE_RAW_DECL_STRNLEN
+_GL_WARN_ON_USE (strnlen, "strnlen is unportable - "
+                 "use gnulib module strnlen for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
@@ -250,11 +248,10 @@
    locale encoding is GB18030 and one of the characters to be searched is a
    digit.  */
 # undef strcspn
-# define strcspn(s,a) \
-    (GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscspn if you care about internationalization"), \
-     strcspn (s, a))
+/* Assume strcspn is always declared.  */
+_GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbscspn if you care about internationalization");
 #endif
 
 /* Find the first occurrence in S of any character in ACCEPT.  */
@@ -269,40 +266,36 @@
    locale encoding is GB18030 and one of the characters to be searched is a
    digit.  */
 #  undef strpbrk
-#  define strpbrk(s,a) \
-     (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbspbrk if you care about internationalization"), \
-      strpbrk (s, a))
+_GL_WARN_ON_USE (strpbrk, "strpbrk cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbspbrk if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strpbrk
-# define strpbrk(s,a) \
-    (GL_LINK_WARNING ("strpbrk is unportable - " \
-                      "use gnulib module strpbrk for portability"), \
-     strpbrk (s, a))
+# if HAVE_RAW_DECL_STRPBRK
+_GL_WARN_ON_USE (strpbrk, "strpbrk is unportable - "
+                 "use gnulib module strpbrk for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strspn() assumes the second argument is a list of single-byte characters.
    Even in this simple case, it cannot work with multibyte strings.  */
 # undef strspn
-# define strspn(s,a) \
-    (GL_LINK_WARNING ("strspn cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbsspn if you care about internationalization"), \
-     strspn (s, a))
+/* Assume strspn is always declared.  */
+_GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbsspn if you care about internationalization");
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strrchr() does not work with multibyte strings if the locale encoding is
    GB18030 and the character to be searched is a digit.  */
 # undef strrchr
-# define strrchr(s,c) \
-    (GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \
-                      "in some multibyte locales - " \
-                      "use mbsrchr if you care about internationalization"), \
-     strrchr (s, c))
+/* Assume strrchr is always declared.  */
+_GL_WARN_ON_USE (strrchr, "strrchr cannot work correctly on character strings "
+                 "in some multibyte locales - "
+                 "use mbsrchr if you care about internationalization");
 #endif
 
 /* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
@@ -328,18 +321,16 @@
 # endif
 # if defined GNULIB_POSIXCHECK
 #  undef strsep
-#  define strsep(s,d) \
-     (GL_LINK_WARNING ("strsep cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbssep if you care about internationalization"), \
-      strsep (s, d))
+_GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbssep if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strsep
-# define strsep(s,d) \
-    (GL_LINK_WARNING ("strsep is unportable - " \
-                      "use gnulib module strsep for portability"), \
-     strsep (s, d))
+# if HAVE_RAW_DECL_STRSEP
+_GL_WARN_ON_USE (strsep, "strsep is unportable - "
+                 "use gnulib module strsep for portability");
+# endif
 #endif
 
 #if @GNULIB_STRSTR@
@@ -354,13 +345,12 @@
    POSIX says that it operates on "strings", and "string" in POSIX is defined
    as a sequence of bytes, not of characters.  */
 # undef strstr
-# define strstr(a,b) \
-    (GL_LINK_WARNING ("strstr is quadratic on many systems, and cannot " \
-                      "work correctly on character strings in most "    \
-                      "multibyte locales - " \
-                      "use mbsstr if you care about internationalization, " \
-                      "or use strstr if you care about speed"), \
-     strstr (a, b))
+/* Assume strstr is always declared.  */
+_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
+                 "work correctly on character strings in most "
+                 "multibyte locales - "
+                 "use mbsstr if you care about internationalization, "
+                 "or use strstr if you care about speed");
 #endif
 
 /* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
@@ -378,13 +368,13 @@
    It is a glibc extension, and glibc implements it only for unibyte
    locales.  */
 # undef strcasestr
-# define strcasestr(a,b) \
-    (GL_LINK_WARNING ("strcasestr does work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscasestr if you care about " \
-                      "internationalization, or use c-strcasestr if you want " \
-                      "a locale independent function"), \
-     strcasestr (a, b))
+# if HAVE_RAW_DECL_STRCASESTR
+_GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbscasestr if you care about "
+                 "internationalization, or use c-strcasestr if you want "
+                 "a locale independent function");
+# endif
 #endif
 
 /* Parse S into tokens separated by characters in DELIM.
@@ -413,7 +403,7 @@
 # if @REPLACE_STRTOK_R@
 #  undef strtok_r
 #  define strtok_r rpl_strtok_r
-# elif @UNDEFINE_STRTOK_R@
+# elif @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK
 #  undef strtok_r
 # endif
 # if ! @HAVE_DECL_STRTOK_R@ || @REPLACE_STRTOK_R@
@@ -422,19 +412,16 @@
      _GL_ARG_NONNULL ((2, 3));
 # endif
 # if defined GNULIB_POSIXCHECK
-#  undef strtok_r
-#  define strtok_r(s,d,p) \
-     (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbstok_r if you care about internationalization"), \
-      strtok_r (s, d, p))
+_GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbstok_r if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtok_r
-# define strtok_r(s,d,p) \
-    (GL_LINK_WARNING ("strtok_r is unportable - " \
-                      "use gnulib module strtok_r for portability"), \
-     strtok_r (s, d, p))
+# if HAVE_RAW_DECL_STRTOK_R
+_GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
+                 "use gnulib module strtok_r for portability");
+# endif
 #endif
 
 
@@ -614,10 +601,9 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strerror
-# define strerror(e) \
-    (GL_LINK_WARNING ("strerror is unportable - " \
-                      "use gnulib module strerror to guarantee non-NULL result"), \
-     strerror (e))
+/* Assume strerror is always declared.  */
+_GL_WARN_ON_USE (strerror, "strerror is unportable - "
+                 "use gnulib module strerror to guarantee non-NULL result");
 #endif
 
 #if @GNULIB_STRSIGNAL@
@@ -629,10 +615,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strsignal
-# define strsignal(a) \
-    (GL_LINK_WARNING ("strsignal is unportable - " \
-                      "use gnulib module strsignal for portability"), \
-     strsignal (a))
+# if HAVE_RAW_DECL_STRSIGNAL
+_GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
+                 "use gnulib module strsignal for portability");
+# endif
 #endif
 
 #if @GNULIB_STRVERSCMP@
@@ -641,10 +627,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strverscmp
-# define strverscmp(a, b) \
-    (GL_LINK_WARNING ("strverscmp is unportable - " \
-                      "use gnulib module strverscmp for portability"), \
-     strverscmp (a, b))
+# if HAVE_RAW_DECL_STRVERSCMP
+_GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
+                 "use gnulib module strverscmp for portability");
+# endif
 #endif
 
 
--- a/lib/strings.in.h
+++ b/lib/strings.in.h
@@ -29,10 +29,9 @@
 #define _GL_STRINGS_H
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 #ifdef __cplusplus
 extern "C" {
@@ -52,14 +51,14 @@
    POSIX says that it operates on "strings", and "string" in POSIX is defined
    as a sequence of bytes, not of characters.   */
 # undef strcasecmp
-# define strcasecmp(a,b) \
-    (GL_LINK_WARNING ("strcasecmp cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscasecmp if you care about " \
-                      "internationalization, or use c_strcasecmp (from " \
-                      "gnulib module c-strcase) if you want a locale " \
-                      "independent function"), \
-     strcasecmp (a, b))
+# if HAVE_RAW_DECL_STRCASECMP
+_GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbscasecmp if you care about "
+                 "internationalization, or use c_strcasecmp , "
+                 "gnulib module c-strcase) if you want a locale "
+                 "independent function");
+# endif
 #endif
 
 /* Compare no more than N bytes of strings S1 and S2, ignoring case,
@@ -75,14 +74,14 @@
    POSIX says that it operates on "strings", and "string" in POSIX is defined
    as a sequence of bytes, not of characters.  */
 # undef strncasecmp
-# define strncasecmp(a,b,n) \
-    (GL_LINK_WARNING ("strncasecmp cannot work correctly on character " \
-                      "strings in multibyte locales - " \
-                      "use mbsncasecmp or mbspcasecmp if you care about " \
-                      "internationalization, or use c_strncasecmp (from " \
-                      "gnulib module c-strcase) if you want a locale " \
-                      "independent function"), \
-     strncasecmp (a, b, n))
+# if HAVE_RAW_DECL_STRNCASECMP
+_GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbsncasecmp or mbspcasecmp if you care about "
+                 "internationalization, or use c_strncasecmp , "
+                 "gnulib module c-strcase) if you want a locale "
+                 "independent function");
+# endif
 #endif
 
 
--- a/lib/sys_file.in.h
+++ b/lib/sys_file.in.h
@@ -41,7 +41,7 @@
 # define LOCK_NB 4       /* Don't block when locking.  */
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 #if @GNULIB_FLOCK@
 /* Apply or remove advisory locks on an open file.
@@ -51,10 +51,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef flock
-# define flock(fd,op)                          \
-    (GL_LINK_WARNING ("flock is unportable - " \
-                      "use gnulib module flock for portability"), \
-     flock ((fd), (op)))
+# if HAVE_RAW_DECL_FLOCK
+_GL_WARN_ON_USE (flock, "flock is unportable - "
+                 "use gnulib module flock for portability");
+# endif
 #endif
 
 
--- a/lib/sys_ioctl.in.h
+++ b/lib/sys_ioctl.in.h
@@ -36,7 +36,7 @@
 # include <unistd.h>
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 /* Declare overridden functions.  */
@@ -57,10 +57,10 @@
 # define ioctl ioctl_used_without_requesting_gnulib_module_ioctl
 #elif defined GNULIB_POSIXCHECK
 # undef ioctl
-# define ioctl \
-    (GL_LINK_WARNING ("ioctl does not portably work on sockets - " \
-                      "use gnulib module ioctl for portability"), \
-     ioctl)
+# if HAVE_RAW_DECL_IOCTL
+_GL_WARN_ON_USE (ioctl, "ioctl does not portably work on sockets - "
+                 "use gnulib module ioctl for portability");
+# endif
 #endif
 
 
--- a/lib/sys_select.in.h
+++ b/lib/sys_select.in.h
@@ -69,7 +69,7 @@
 
 # include <sys/socket.h>
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 # ifdef __cplusplus
 extern "C" {
@@ -86,10 +86,10 @@
 #  define select select_used_without_requesting_gnulib_module_select
 # elif defined GNULIB_POSIXCHECK
 #  undef select
-#  define select(n,r,w,e,t) \
-     (GL_LINK_WARNING ("select is not always POSIX compliant - " \
-                       "use gnulib module select for portability"), \
-      select (n, r, w, e, t))
+#  if HAVE_RAW_DECL_SELECT
+_GL_WARN_ON_USE (select, "select is not always POSIX compliant - "
+                 "use gnulib module select for portability");
+#  endif
 # endif
 
 # ifdef __cplusplus
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -126,7 +126,7 @@
 #  define SHUT_RDWR SD_BOTH
 # endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 # if @HAVE_WINSOCK2_H@
 /* Include headers needed by the emulation code.  */
@@ -187,10 +187,10 @@
 #  define socket socket_used_without_requesting_gnulib_module_socket
 # elif defined GNULIB_POSIXCHECK
 #  undef socket
-#  define socket(d,t,p) \
-     (GL_LINK_WARNING ("socket is not always POSIX compliant - " \
-                       "use gnulib module socket for portability"), \
-      socket (d, t, p))
+#  if HAVE_RAW_DECL_SOCKET
+_GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - "
+                 "use gnulib module socket for portability");
+#  endif
 # endif
 
 # if @GNULIB_CONNECT@
@@ -204,10 +204,10 @@
 #  define connect socket_used_without_requesting_gnulib_module_connect
 # elif defined GNULIB_POSIXCHECK
 #  undef connect
-#  define connect(s,a,l) \
-     (GL_LINK_WARNING ("connect is not always POSIX compliant - " \
-                       "use gnulib module connect for portability"), \
-      connect (s, a, l))
+#  if HAVE_RAW_DECL_CONNECT
+_GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - "
+                 "use gnulib module connect for portability");
+#  endif
 # endif
 
 # if @GNULIB_ACCEPT@
@@ -221,10 +221,10 @@
 #  define accept accept_used_without_requesting_gnulib_module_accept
 # elif defined GNULIB_POSIXCHECK
 #  undef accept
-#  define accept(s,a,l) \
-     (GL_LINK_WARNING ("accept is not always POSIX compliant - " \
-                       "use gnulib module accept for portability"), \
-      accept (s, a, l))
+# if HAVE_RAW_DECL_ACCEPT
+_GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - "
+                 "use gnulib module accept for portability");
+#  endif
 # endif
 
 # if @GNULIB_BIND@
@@ -238,10 +238,10 @@
 #  define bind bind_used_without_requesting_gnulib_module_bind
 # elif defined GNULIB_POSIXCHECK
 #  undef bind
-#  define bind(s,a,l) \
-     (GL_LINK_WARNING ("bind is not always POSIX compliant - " \
-                       "use gnulib module bind for portability"), \
-      bind (s, a, l))
+#  if HAVE_RAW_DECL_BIND
+_GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - "
+                 "use gnulib module bind for portability");
+#  endif
 # endif
 
 # if @GNULIB_GETPEERNAME@
@@ -256,10 +256,10 @@
 #  define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
 # elif defined GNULIB_POSIXCHECK
 #  undef getpeername
-#  define getpeername(s,a,l) \
-     (GL_LINK_WARNING ("getpeername is not always POSIX compliant - " \
-                       "use gnulib module getpeername for portability"), \
-      getpeername (s, a, l))
+#  if HAVE_RAW_DECL_GETPEERNAME
+_GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - "
+                 "use gnulib module getpeername for portability");
+#  endif
 # endif
 
 # if @GNULIB_GETSOCKNAME@
@@ -274,10 +274,10 @@
 #  define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
 # elif defined GNULIB_POSIXCHECK
 #  undef getsockname
-#  define getsockname(s,a,l) \
-     (GL_LINK_WARNING ("getsockname is not always POSIX compliant - " \
-                       "use gnulib module getsockname for portability"), \
-      getsockname (s, a, l))
+#  if HAVE_RAW_DECL_GETSOCKNAME
+_GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - "
+                 "use gnulib module getsockname for portability");
+#  endif
 # endif
 
 # if @GNULIB_GETSOCKOPT@
@@ -292,10 +292,10 @@
 #  define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
 # elif defined GNULIB_POSIXCHECK
 #  undef getsockopt
-#  define getsockopt(s,lvl,o,v,l) \
-     (GL_LINK_WARNING ("getsockopt is not always POSIX compliant - " \
-                       "use gnulib module getsockopt for portability"), \
-      getsockopt (s, lvl, o, v, l))
+#  if HAVE_RAW_DECL_GETSOCKOPT
+_GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - "
+                 "use gnulib module getsockopt for portability");
+#  endif
 # endif
 
 # if @GNULIB_LISTEN@
@@ -309,10 +309,10 @@
 #  define listen listen_used_without_requesting_gnulib_module_listen
 # elif defined GNULIB_POSIXCHECK
 #  undef listen
-#  define listen(s,b) \
-     (GL_LINK_WARNING ("listen is not always POSIX compliant - " \
-                       "use gnulib module listen for portability"), \
-      listen (s, b))
+#  if HAVE_RAW_DECL_LISTEN
+_GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - "
+                 "use gnulib module listen for portability");
+#  endif
 # endif
 
 # if @GNULIB_RECV@
@@ -326,10 +326,10 @@
 #  define recv recv_used_without_requesting_gnulib_module_recv
 # elif defined GNULIB_POSIXCHECK
 #  undef recv
-#  define recv(s,b,n,f) \
-     (GL_LINK_WARNING ("recv is not always POSIX compliant - " \
-                       "use gnulib module recv for portability"), \
-      recv (s, b, n, f))
+#  if HAVE_RAW_DECL_RECV
+_GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - "
+                 "use gnulib module recv for portability");
+#  endif
 # endif
 
 # if @GNULIB_SEND@
@@ -343,10 +343,10 @@
 #  define send send_used_without_requesting_gnulib_module_send
 # elif defined GNULIB_POSIXCHECK
 #  undef send
-#  define send(s,b,n,f) \
-     (GL_LINK_WARNING ("send is not always POSIX compliant - " \
-                       "use gnulib module send for portability"), \
-      send (s, b, n, f))
+#  if HAVE_RAW_DECL_SEND
+_GL_WARN_ON_USE (send, "send is not always POSIX compliant - "
+                 "use gnulib module send for portability");
+#  endif
 # endif
 
 # if @GNULIB_RECVFROM@
@@ -361,10 +361,10 @@
 #  define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
 # elif defined GNULIB_POSIXCHECK
 #  undef recvfrom
-#  define recvfrom(s,b,n,f,a,l) \
-     (GL_LINK_WARNING ("recvfrom is not always POSIX compliant - " \
-                       "use gnulib module recvfrom for portability"), \
-      recvfrom (s, b, n, f, a, l))
+#  if HAVE_RAW_DECL_RECVFROM
+_GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - "
+                 "use gnulib module recvfrom for portability");
+#  endif
 # endif
 
 # if @GNULIB_SENDTO@
@@ -379,10 +379,10 @@
 #  define sendto sendto_used_without_requesting_gnulib_module_sendto
 # elif defined GNULIB_POSIXCHECK
 #  undef sendto
-#  define sendto(s,b,n,f,a,l) \
-     (GL_LINK_WARNING ("sendto is not always POSIX compliant - " \
-                       "use gnulib module sendto for portability"), \
-      sendto (s, b, n, f, a, l))
+#  if HAVE_RAW_DECL_SENDTO
+_GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - "
+                 "use gnulib module sendto for portability");
+#  endif
 # endif
 
 # if @GNULIB_SETSOCKOPT@
@@ -397,10 +397,10 @@
 #  define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
 # elif defined GNULIB_POSIXCHECK
 #  undef setsockopt
-#  define setsockopt(s,lvl,o,v,l) \
-     (GL_LINK_WARNING ("setsockopt is not always POSIX compliant - " \
-                       "use gnulib module setsockopt for portability"), \
-      setsockopt (s, lvl, o, v, l))
+#  if HAVE_RAW_DECL_SETSOCKOPT
+_GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - "
+                 "use gnulib module setsockopt for portability");
+#  endif
 # endif
 
 # if @GNULIB_SHUTDOWN@
@@ -414,10 +414,10 @@
 #  define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
 # elif defined GNULIB_POSIXCHECK
 #  undef shutdown
-#  define shutdown(s,h) \
-     (GL_LINK_WARNING ("shutdown is not always POSIX compliant - " \
-                       "use gnulib module shutdown for portability"), \
-      shutdown (s, h))
+#  if HAVE_RAW_DECL_SHUTDOWN
+_GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
+                 "use gnulib module shutdown for portability");
+#  endif
 # endif
 
 # if @HAVE_WINSOCK2_H@
@@ -448,10 +448,10 @@
                     int flags);
 #elif defined GNULIB_POSIXCHECK
 # undef accept4
-# define accept4(s,a,l,f) \
-    (GL_LINK_WARNING ("accept4 is unportable - " \
-                      "use gnulib module accept4 for portability"), \
-     accept4 (s, a, l, f))
+# if HAVE_RAW_DECL_ACCEPT4
+_GL_WARN_ON_USE (accept4, "accept4 is unportable - "
+                 "use gnulib module accept4 for portability");
+# endif
 #endif
 
 #ifdef __cplusplus
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -47,9 +47,9 @@
 #ifndef _GL_SYS_STAT_H
 #define _GL_SYS_STAT_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
 
-/* The definition of _GL_ARG_NONNULL is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 /* Before doing "#define mkdir rpl_mkdir" below, we need to include all
    headers that may declare mkdir().  */
@@ -302,10 +302,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fchmodat
-# define fchmodat(d,n,m,f)                         \
-    (GL_LINK_WARNING ("fchmodat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     fchmodat (d, n, m, f))
+# if HAVE_RAW_DECL_FCHMODAT
+_GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -326,10 +326,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fstatat
-# define fstatat(d,n,s,f)                         \
-    (GL_LINK_WARNING ("fstatat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     fstatat (d, n, s, f))
+# if HAVE_RAW_DECL_FSTATAT
+_GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -343,10 +343,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef futimens
-# define futimens(f,t)                         \
-    (GL_LINK_WARNING ("futimens is not portable - " \
-                      "use gnulib module futimens for portability"), \
-     futimens (f, t))
+# if HAVE_RAW_DECL_FUTIMENS
+_GL_WARN_ON_USE (futimens, "futimens is not portable - "
+                 "use gnulib module futimens for portability");
+# endif
 #endif
 
 
@@ -368,10 +368,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lchmod
-# define lchmod(f,m) \
-    (GL_LINK_WARNING ("lchmod is unportable - " \
-                      "use gnulib module lchmod for portability"), \
-     lchmod (f, m))
+# if HAVE_RAW_DECL_LCHMOD
+_GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
+                 "use gnulib module lchmod for portability");
+# endif
 #endif
 
 
@@ -388,10 +388,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lstat
-# define lstat(p,b)                                                     \
-  (GL_LINK_WARNING ("lstat is unportable - "                            \
-                    "use gnulib module lstat for portability"),         \
-   lstat (p, b))
+# if HAVE_RAW_DECL_LSTAT
+_GL_WARN_ON_USE (lstat, "lstat is unportable - "
+                 "use gnulib module lstat for portability");
+# endif
 #endif
 
 
@@ -423,10 +423,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkdirat
-# define mkdirat(d,n,m)                         \
-    (GL_LINK_WARNING ("mkdirat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     mkdirat (d, n, m))
+# if HAVE_RAW_DECL_MKDIRAT
+_GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -440,10 +440,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkfifo
-# define mkfifo(n,m)                                                    \
-    (GL_LINK_WARNING ("mkfifo is not portable - "                       \
-                      "use gnulib module mkfifo for portability"),      \
-     mkfifo (n, m))
+# if HAVE_RAW_DECL_MKFIFO
+_GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
+                 "use gnulib module mkfifo for portability");
+# endif
 #endif
 
 
@@ -454,10 +454,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkfifoat
-# define mkfifoat(d,n,m)                                     \
-    (GL_LINK_WARNING ("mkfifoat is not portable - " \
-                      "use gnulib module mkfifoat for portability"), \
-     mkfifoat (d, n, m))
+# if HAVE_RAW_DECL_MKFIFOAT
+_GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
+                 "use gnulib module mkfifoat for portability");
+# endif
 #endif
 
 
@@ -472,10 +472,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mknod
-# define mknod(n,m,d)                                                   \
-    (GL_LINK_WARNING ("mknod is not portable - "                        \
-                      "use gnulib module mknod for portability"),       \
-     mknod (n, m, d))
+# if HAVE_RAW_DECL_MKNOD
+_GL_WARN_ON_USE (mknod, "mknod is not portable - "
+                 "use gnulib module mknod for portability");
+# endif
 #endif
 
 
@@ -486,10 +486,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mknodat
-# define mknodat(f,n,m,d)                            \
-    (GL_LINK_WARNING ("mknodat is not portable - " \
-                      "use gnulib module mkfifoat for portability"), \
-     mknodat (f, n, m, d))
+# if HAVE_RAW_DECL_MKNODAT
+_GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
+                 "use gnulib module mkfifoat for portability");
+# endif
 #endif
 
 
@@ -512,10 +512,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef stat
-# define stat(p,b)                                                      \
-  (GL_LINK_WARNING ("stat is unportable - "                             \
-                    "use gnulib module stat for portability"),          \
-   stat (p, b))
+# if HAVE_RAW_DECL_STAT
+_GL_WARN_ON_USE (stat, "stat is unportable - "
+                 "use gnulib module stat for portability");
+# endif
 #endif
 
 
@@ -531,10 +531,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef utimensat
-# define utimensat(d,n,t,f)                          \
-    (GL_LINK_WARNING ("utimensat is not portable - " \
-                      "use gnulib module utimensat for portability"), \
-     utimensat (d, n, t, f))
+# if HAVE_RAW_DECL_UTIMENSAT
+_GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
+                 "use gnulib module utimensat for portability");
+# endif
 #endif
 
 
--- a/lib/sys_times.in.h
+++ b/lib/sys_times.in.h
@@ -38,9 +38,9 @@
 #  include <time.h>
 # endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
 
-/* The definition of _GL_ARG_NONNULL is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 # ifdef __cplusplus
 extern "C" {
@@ -64,10 +64,10 @@
 #  endif
 # elif defined GNULIB_POSIXCHECK
 #  undef times
-#  define times(s)                                              \
-  (GL_LINK_WARNING ("times is unportable - "                    \
-                    "use gnulib module times for portability"), \
-   times (s))
+#  if HAVE_RAW_DECL_TIMES
+_GL_WARN_ON_USE (times, "times is unportable - "
+                 "use gnulib module times for portability");
+#  endif
 # endif
 
 # ifdef __cplusplus
--- a/lib/sys_utsname.in.h
+++ b/lib/sys_utsname.in.h
@@ -27,9 +27,9 @@
 
 #define _GL_SYS_UTSNAME_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
 
-/* The definition of _GL_ARG_NONNULL is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 #ifdef __cplusplus
@@ -81,10 +81,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef uname
-# define uname(b) \
-    (GL_LINK_WARNING ("uname is unportable - " \
-                      "use gnulib module uname for portability"), \
-     uname (b))
+# if HAVE_RAW_DECL_UNAME
+_GL_WARN_ON_USE (uname, "uname is unportable - "
+                 "use gnulib module uname for portability");
+# endif
 #endif
 
 
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -114,8 +114,6 @@
 # endif
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
 /* The definition of _GL_WARN_ON_USE is copied here.  */
@@ -164,11 +162,11 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef chown
-# define chown(f,u,g) \
-    (GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \
-                      "doesn't treat a uid or gid of -1 on some systems - " \
-                      "use gnulib module chown for portability"), \
-     chown (f, u, g))
+# if HAVE_RAW_DECL_CHOWN
+_GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
+                 "doesn't treat a uid or gid of -1 on some systems - "
+                 "use gnulib module chown for portability");
+# endif
 #endif
 
 
@@ -184,10 +182,9 @@
 # define close close_used_without_requesting_gnulib_module_close
 #elif defined GNULIB_POSIXCHECK
 # undef close
-# define close(f) \
-    (GL_LINK_WARNING ("close does not portably work on sockets - " \
-                      "use gnulib module close for portability"), \
-     close (f))
+/* Assume close is always declared.  */
+_GL_WARN_ON_USE (close, "close does not portably work on sockets - "
+                 "use gnulib module close for portability");
 #endif
 
 
@@ -211,10 +208,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef dup2
-# define dup2(o,n) \
-    (GL_LINK_WARNING ("dup2 is unportable - " \
-                      "use gnulib module dup2 for portability"), \
-     dup2 (o, n))
+# if HAVE_RAW_DECL_DUP2
+_GL_WARN_ON_USE (dup2, "dup2 is unportable - "
+                 "use gnulib module dup2 for portability");
+# endif
 #endif
 
 
@@ -233,10 +230,10 @@
 extern int dup3 (int oldfd, int newfd, int flags);
 #elif defined GNULIB_POSIXCHECK
 # undef dup3
-# define dup3(o,n,f) \
-    (GL_LINK_WARNING ("dup3 is unportable - " \
-                      "use gnulib module dup3 for portability"), \
-     dup3 (o, n, f))
+# if HAVE_RAW_DECL_DUP3
+_GL_WARN_ON_USE (dup3, "dup3 is unportable - "
+                 "use gnulib module dup3 for portability");
+# endif
 #endif
 
 
@@ -274,10 +271,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef euidaccess
-# define euidaccess(f,m) \
-    (GL_LINK_WARNING ("euidaccess is unportable - " \
-                      "use gnulib module euidaccess for portability"), \
-     euidaccess (f, m))
+# if HAVE_RAW_DECL_EUIDACCESS
+_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
+                 "use gnulib module euidaccess for portability");
+# endif
 #endif
 
 
@@ -288,10 +285,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef faccessat
-# define faccessat(d,n,m,f)                         \
-    (GL_LINK_WARNING ("faccessat is not portable - " \
-                      "use gnulib module faccessat for portability"), \
-     faccessat (d, n, m, f))
+# if HAVE_RAW_DECL_FACCESSAT
+_GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
+                 "use gnulib module faccessat for portability");
+# endif
 #endif
 
 
@@ -314,10 +311,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fchdir
-# define fchdir(f) \
-    (GL_LINK_WARNING ("fchdir is unportable - " \
-                      "use gnulib module fchdir for portability"), \
-     fchdir (f))
+# if HAVE_RAW_DECL_FCHDIR
+_GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
+                 "use gnulib module fchdir for portability");
+# endif
 #endif
 
 
@@ -332,10 +329,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fchownat
-# define fchownat(d,n,o,g,f)                        \
-    (GL_LINK_WARNING ("fchownat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     fchownat (d, n, o, g, f))
+# if HAVE_RAW_DECL_FCHOWNAT
+_GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -349,10 +346,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fsync
-# define fsync(fd) \
-    (GL_LINK_WARNING ("fsync is unportable - " \
-                      "use gnulib module fsync for portability"), \
-     fsync (fd))
+# if HAVE_RAW_DECL_FSYNC
+_GL_WARN_ON_USE (fsync, "fsync is unportable - "
+                 "use gnulib module fsync for portability");
+# endif
 #endif
 
 
@@ -366,10 +363,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef ftruncate
-# define ftruncate(f,l) \
-    (GL_LINK_WARNING ("ftruncate is unportable - " \
-                      "use gnulib module ftruncate for portability"), \
-     ftruncate (f, l))
+# if HAVE_RAW_DECL_FTRUNCATE
+_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
+                 "use gnulib module ftruncate for portability");
+# endif
 #endif
 
 
@@ -390,10 +387,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getcwd
-# define getcwd(b,s) \
-    (GL_LINK_WARNING ("getcwd is unportable - " \
-                      "use gnulib module getcwd for portability"), \
-     getcwd (b, s))
+# if HAVE_RAW_DECL_GETCWD
+_GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
+                 "use gnulib module getcwd for portability");
+# endif
 #endif
 
 
@@ -413,10 +410,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getdomainname
-# define getdomainname(n,l) \
-    (GL_LINK_WARNING ("getdomainname is unportable - " \
-                      "use gnulib module getdomainname for portability"), \
-     getdomainname (n, l))
+# if HAVE_RAW_DECL_GETDOMAINNAME
+_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
+                 "use gnulib module getdomainname for portability");
+# endif
 #endif
 
 
@@ -428,10 +425,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getdtablesize
-# define getdtablesize() \
-    (GL_LINK_WARNING ("getdtablesize is unportable - " \
-                      "use gnulib module getdtablesize for portability"), \
-     getdtablesize ())
+# if HAVE_RAW_DECL_GETDTABLESIZE
+_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
+                 "use gnulib module getdtablesize for portability");
+# endif
 #endif
 
 
@@ -450,10 +447,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getgroups
-# define getgroups(n,g)                                                 \
-    (GL_LINK_WARNING ("getgroups is unportable - "                      \
-                      "use gnulib module getgroups for portability"),   \
-     getgroups (n, g))
+# if HAVE_RAW_DECL_GETGROUPS
+_GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
+                 "use gnulib module getgroups for portability");
+# endif
 #endif
 
 
@@ -477,10 +474,10 @@
 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
 #elif defined GNULIB_POSIXCHECK
 # undef gethostname
-# define gethostname(n,l) \
-    (GL_LINK_WARNING ("gethostname is unportable - " \
-                      "use gnulib module gethostname for portability"), \
-     gethostname (n, l))
+# if HAVE_RAW_DECL_GETHOSTNAME
+_GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
+                 "use gnulib module gethostname for portability");
+# endif
 #endif
 
 
@@ -500,10 +497,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getlogin
-# define getlogin() \
-    (GL_LINK_WARNING ("getlogin is unportable - " \
-                      "use gnulib module getlogin for portability"), \
-     getlogin ())
+# if HAVE_RAW_DECL_GETLOGIN
+_GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
+                 "use gnulib module getlogin for portability");
+# endif
 #endif
 
 
@@ -527,10 +524,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getlogin_r
-# define getlogin_r(n,s) \
-    (GL_LINK_WARNING ("getlogin_r is unportable - " \
-                      "use gnulib module getlogin_r for portability"), \
-     getlogin_r (n, s))
+# if HAVE_RAW_DECL_GETLOGIN_R
+_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
+                 "use gnulib module getlogin_r for portability");
+# endif
 #endif
 
 
@@ -585,10 +582,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getpagesize
-# define getpagesize() \
-    (GL_LINK_WARNING ("getpagesize is unportable - " \
-                      "use gnulib module getpagesize for portability"), \
-     getpagesize ())
+# if HAVE_RAW_DECL_GETPAGESIZE
+_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
+                 "use gnulib module getpagesize for portability");
+# endif
 #endif
 
 
@@ -605,20 +602,20 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getusershell
-# define getusershell() \
-    (GL_LINK_WARNING ("getusershell is unportable - " \
-                      "use gnulib module getusershell for portability"), \
-     getusershell ())
+# if HAVE_RAW_DECL_GETUSERSHELL
+_GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
 # undef setusershell
-# define setusershell() \
-    (GL_LINK_WARNING ("setusershell is unportable - " \
-                      "use gnulib module getusershell for portability"), \
-     setusershell ())
+# if HAVE_RAW_DECL_SETUSERSHELL
+_GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
 # undef endusershell
-# define endusershell() \
-    (GL_LINK_WARNING ("endusershell is unportable - " \
-                      "use gnulib module getusershell for portability"), \
-     endusershell ())
+# if HAVE_RAW_DECL_ENDUSERSHELL
+_GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
 #endif
 
 
@@ -638,10 +635,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lchown
-# define lchown(f,u,g) \
-    (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \
-                      "systems - use gnulib module lchown for portability"), \
-     lchown (f, u, g))
+# if HAVE_RAW_DECL_LCHOWN
+_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
+                 "use gnulib module lchown for portability");
+# endif
 #endif
 
 
@@ -659,10 +656,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef link
-# define link(path1,path2) \
-    (GL_LINK_WARNING ("link is unportable - " \
-                      "use gnulib module link for portability"), \
-     link (path1, path2))
+# if HAVE_RAW_DECL_LINK
+_GL_WARN_ON_USE (link, "link is unportable - "
+                 "use gnulib module link for portability");
+# endif
 #endif
 
 #if @GNULIB_LINKAT@
@@ -680,10 +677,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef linkat
-# define linkat(f1,path1,f2,path2,f)              \
-    (GL_LINK_WARNING ("linkat is unportable - " \
-                      "use gnulib module linkat for portability"), \
-     linkat (f1, path1, f2, path2,f))
+# if HAVE_RAW_DECL_LINKAT
+_GL_WARN_ON_USE (linkat, "linkat is unportable - "
+                 "use gnulib module linkat for portability");
+# endif
 #endif
 
 #if @GNULIB_LSEEK@
@@ -697,10 +694,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lseek
-# define lseek(f,o,w) \
-    (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \
-                      "systems - use gnulib module lseek for portability"), \
-     lseek (f, o, w))
+# if HAVE_RAW_DECL_LSEEK
+_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
+                 "systems - use gnulib module lseek for portability");
+# endif
 #endif
 
 
@@ -719,10 +716,10 @@
 extern int pipe2 (int fd[2], int flags) _GL_ARG_NONNULL ((1));
 #elif defined GNULIB_POSIXCHECK
 # undef pipe2
-# define pipe2(f,o) \
-    (GL_LINK_WARNING ("pipe2 is unportable - " \
-                      "use gnulib module pipe2 for portability"), \
-     pipe2 (f, o))
+# if HAVE_RAW_DECL_PIPE2
+_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
+                 "use gnulib module pipe2 for portability");
+# endif
 #endif
 
 
@@ -740,10 +737,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef pread
-# define pread(f,b,s,o)                        \
-    (GL_LINK_WARNING ("pread is unportable - " \
-                      "use gnulib module pread for portability"), \
-     pread (f, b, s, o))
+# if HAVE_RAW_DECL_PREAD
+_GL_WARN_ON_USE (pread, "pread is unportable - "
+                 "use gnulib module pread for portability");
+# endif
 #endif
 
 
@@ -762,10 +759,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef readlink
-# define readlink(f,b,s) \
-    (GL_LINK_WARNING ("readlink is unportable - " \
-                      "use gnulib module readlink for portability"), \
-     readlink (f, b, s))
+# if HAVE_RAW_DECL_READLINK
+_GL_WARN_ON_USE (readlink, "readlink is unportable - "
+                 "use gnulib module readlink for portability");
+# endif
 #endif
 
 
@@ -776,10 +773,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef readlinkat
-# define readlinkat(d,n,b,l)                         \
-    (GL_LINK_WARNING ("readlinkat is not portable - " \
-                      "use gnulib module symlinkat for portability"), \
-     readlinkat (d, n, b, l))
+# if HAVE_RAW_DECL_READLINKAT
+_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
+                 "use gnulib module symlinkat for portability");
+# endif
 #endif
 
 
@@ -791,10 +788,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rmdir
-# define rmdir(n) \
-    (GL_LINK_WARNING ("rmdir is unportable - " \
-                      "use gnulib module rmdir for portability"), \
-     rmdir (n))
+# if HAVE_RAW_DECL_RMDIR
+_GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
+                 "use gnulib module rmdir for portability");
+# endif
 #endif
 
 
@@ -812,10 +809,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef sleep
-# define sleep(n) \
-    (GL_LINK_WARNING ("sleep is unportable - " \
-                      "use gnulib module sleep for portability"), \
-     sleep (n))
+# if HAVE_RAW_DECL_SLEEP
+_GL_WARN_ON_USE (sleep, "sleep is unportable - "
+                 "use gnulib module sleep for portability");
+# endif
 #endif
 
 
@@ -830,10 +827,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef symlink
-# define symlink(c,n)                        \
-    (GL_LINK_WARNING ("symlink is not portable - " \
-                      "use gnulib module symlink for portability"), \
-     symlink (c, n))
+# if HAVE_RAW_DECL_SYMLINK
+_GL_WARN_ON_USE (symlink, "symlink is not portable - "
+                 "use gnulib module symlink for portability");
+# endif
 #endif
 
 
@@ -844,10 +841,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef symlinkat
-# define symlinkat(c,d,n)                            \
-    (GL_LINK_WARNING ("symlinkat is not portable - " \
-                      "use gnulib module symlinkat for portability"), \
-     symlinkat (c, d, n))
+# if HAVE_RAW_DECL_SYMLINKAT
+_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
+                 "use gnulib module symlinkat for portability");
+# endif
 #endif
 
 
@@ -859,10 +856,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef unlink
-# define unlink(n)                         \
-    (GL_LINK_WARNING ("unlink is not portable - " \
-                      "use gnulib module unlink for portability"), \
-     unlink (n))
+# if HAVE_RAW_DECL_UNLINK
+_GL_WARN_ON_USE (unlink, "unlink is not portable - "
+                 "use gnulib module unlink for portability");
+# endif
 #endif
 
 
@@ -876,10 +873,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef unlinkat
-# define unlinkat(d,n,f)                         \
-    (GL_LINK_WARNING ("unlinkat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     unlinkat (d, n, f))
+# if HAVE_RAW_DECL_UNLINKAT
+_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -897,10 +894,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef usleep
-# define usleep(n) \
-    (GL_LINK_WARNING ("usleep is unportable - " \
-                      "use gnulib module usleep for portability"), \
-     usleep (n))
+# if HAVE_RAW_DECL_USLEEP
+_GL_WARN_ON_USE (usleep, "usleep is unportable - "
+                 "use gnulib module usleep for portability");
+# endif
 #endif
 
 
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -75,9 +75,9 @@
 #ifndef _GL_WCHAR_H
 #define _GL_WCHAR_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
 
-/* The definition of _GL_ARG_NONNULL is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 #ifdef __cplusplus
 extern "C" {
@@ -115,10 +115,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef btowc
-# define btowc(c) \
-    (GL_LINK_WARNING ("btowc is unportable - " \
-                      "use gnulib module btowc for portability"), \
-     btowc (c))
+# if HAVE_RAW_DECL_BTOWC
+_GL_WARN_ON_USE (btowc, "btowc is unportable - "
+                 "use gnulib module btowc for portability");
+# endif
 #endif
 
 
@@ -134,10 +134,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wctob
-# define wctob(w) \
-    (GL_LINK_WARNING ("wctob is unportable - " \
-                      "use gnulib module wctob for portability"), \
-     wctob (w))
+# if HAVE_RAW_DECL_WCTOB
+_GL_WARN_ON_USE (wctob, "wctob is unportable - "
+                 "use gnulib module wctob for portability");
+# endif
 #endif
 
 
@@ -152,10 +152,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsinit
-# define mbsinit(p) \
-    (GL_LINK_WARNING ("mbsinit is unportable - " \
-                      "use gnulib module mbsinit for portability"), \
-     mbsinit (p))
+# if HAVE_RAW_DECL_MBSINIT
+_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
+                 "use gnulib module mbsinit for portability");
+# endif
 #endif
 
 
@@ -170,10 +170,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbrtowc
-# define mbrtowc(w,s,n,p) \
-    (GL_LINK_WARNING ("mbrtowc is unportable - " \
-                      "use gnulib module mbrtowc for portability"), \
-     mbrtowc (w, s, n, p))
+# if HAVE_RAW_DECL_MBRTOWC
+_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
+                 "use gnulib module mbrtowc for portability");
+# endif
 #endif
 
 
@@ -188,10 +188,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbrlen
-# define mbrlen(s,n,p) \
-    (GL_LINK_WARNING ("mbrlen is unportable - " \
-                      "use gnulib module mbrlen for portability"), \
-     mbrlen (s, n, p))
+# if HAVE_RAW_DECL_MBRLEN
+_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
+                 "use gnulib module mbrlen for portability");
+# endif
 #endif
 
 
@@ -207,10 +207,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsrtowcs
-# define mbsrtowcs(d,s,l,p) \
-    (GL_LINK_WARNING ("mbsrtowcs is unportable - " \
-                      "use gnulib module mbsrtowcs for portability"), \
-     mbsrtowcs (d, s, l, p))
+# if HAVE_RAW_DECL_MBSRTOWCS
+_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
+                 "use gnulib module mbsrtowcs for portability");
+# endif
 #endif
 
 
@@ -226,10 +226,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsnrtowcs
-# define mbsnrtowcs(d,s,n,l,p) \
-    (GL_LINK_WARNING ("mbsnrtowcs is unportable - " \
-                      "use gnulib module mbsnrtowcs for portability"), \
-     mbsnrtowcs (d, s, n, l, p))
+# if HAVE_RAW_DECL_MBSNRTOWCS
+_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
+                 "use gnulib module mbsnrtowcs for portability");
+# endif
 #endif
 
 
@@ -244,10 +244,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcrtomb
-# define wcrtomb(s,w,p) \
-    (GL_LINK_WARNING ("wcrtomb is unportable - " \
-                      "use gnulib module wcrtomb for portability"), \
-     wcrtomb (s, w, p))
+# if HAVE_RAW_DECL_WCRTOMB
+_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
+                 "use gnulib module wcrtomb for portability");
+# endif
 #endif
 
 
@@ -263,10 +263,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsrtombs
-# define wcsrtombs(d,s,l,p) \
-    (GL_LINK_WARNING ("wcsrtombs is unportable - " \
-                      "use gnulib module wcsrtombs for portability"), \
-     wcsrtombs (d, s, l, p))
+# if HAVE_RAW_DECL_WCSRTOMBS
+_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
+                 "use gnulib module wcsrtombs for portability");
+# endif
 #endif
 
 
@@ -282,10 +282,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsnrtombs
-# define wcsnrtombs(d,s,n,l,p) \
-    (GL_LINK_WARNING ("wcsnrtombs is unportable - " \
-                      "use gnulib module wcsnrtombs for portability"), \
-     wcsnrtombs (d, s, n, l, p))
+# if HAVE_RAW_DECL_WCSNRTOMBS
+_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
+                 "use gnulib module wcsnrtombs for portability");
+# endif
 #endif
 
 
@@ -303,10 +303,10 @@
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcwidth
-# define wcwidth(w) \
-    (GL_LINK_WARNING ("wcwidth is unportable - " \
-                      "use gnulib module wcwidth for portability"), \
-     wcwidth (w))
+# if HAVE_RAW_DECL_WCWIDTH
+_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
+                 "use gnulib module wcwidth for portability");
+# endif
 #endif
 
 
--- a/m4/arpa_inet_h.m4
+++ b/m4/arpa_inet_h.m4
@@ -1,4 +1,4 @@
-# arpa_inet_h.m4 serial 6
+# arpa_inet_h.m4 serial 7
 dnl Copyright (C) 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -21,6 +21,16 @@
   AC_SUBST([HAVE_ARPA_INET_H])
   dnl <arpa/inet.h> is always overridden, because of GNULIB_POSIXCHECK.
   gl_CHECK_NEXT_HEADERS([arpa/inet.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+/* On some systems, this header is not self-consistent.  */
+#ifndef __GLIBC__
+# include <sys/socket.h>
+#endif
+#include <arpa/inet.h>
+    ]], [inet_ntop inet_pton])
 ])
 
 dnl Unconditionally enables the replacement of <arpa/inet.h>.
--- a/m4/ctype.m4
+++ b/m4/ctype.m4
@@ -1,4 +1,4 @@
-# ctype_h.m4 serial 2
+# ctype_h.m4 serial 3
 dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,6 +10,11 @@
   dnl Execute this unconditionally, because CTYPE_H may be set by other
   dnl modules, after this code is executed.
   gl_CHECK_NEXT_HEADERS([ctype.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <ctype.h>
+    ]], [isblank])
 ])
 
 AC_DEFUN([gl_CTYPE_MODULE_INDICATOR],
--- a/m4/dirent_h.m4
+++ b/m4/dirent_h.m4
@@ -1,4 +1,4 @@
-# dirent_h.m4 serial 8
+# dirent_h.m4 serial 9
 dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -14,6 +14,11 @@
 
   dnl <dirent.h> is always overridden, because of GNULIB_POSIXCHECK.
   gl_CHECK_NEXT_HEADERS([dirent.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <dirent.h>
+    ]], [alphasort dirfd fdopendir scandir])
 ])
 
 dnl Unconditionally enables the replacement of <dirent.h>.
--- a/m4/fcntl_h.m4
+++ b/m4/fcntl_h.m4
@@ -1,4 +1,4 @@
-# serial 9
+# serial 10
 # Configure fcntl.h.
 dnl Copyright (C) 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
@@ -12,6 +12,12 @@
   AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
   AC_REQUIRE([gl_FCNTL_O_FLAGS])
   gl_CHECK_NEXT_HEADERS([fcntl.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, if it is not common
+  dnl enough to be declared everywhere.
+  gl_WARN_ON_USE_PREPARE([[#include <fcntl.h>
+    ]], [fcntl openat])
 ])
 
 AC_DEFUN([gl_FCNTL_MODULE_INDICATOR],
--- a/m4/inttypes.m4
+++ b/m4/inttypes.m4
@@ -1,4 +1,4 @@
-# inttypes.m4 serial 16
+# inttypes.m4 serial 17
 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -233,6 +233,11 @@
   else
     UINT64_MAX_EQ_ULONG_MAX=-1
   fi
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <inttypes.h>
+    ]], [imaxabs imaxdiv strtoimax strtoumax])
 ])
 
 # Define the symbol $1 to be 1 if the condition is true, 0 otherwise.
--- a/m4/langinfo_h.m4
+++ b/m4/langinfo_h.m4
@@ -1,4 +1,4 @@
-# langinfo_h.m4 serial 2
+# langinfo_h.m4 serial 3
 dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -51,6 +51,11 @@
   AC_SUBST([HAVE_LANGINFO_H])
   AC_SUBST([HAVE_LANGINFO_CODESET])
   AC_SUBST([HAVE_LANGINFO_ERA])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <langinfo.h>
+    ]], [nl_langinfo])
 ])
 
 AC_DEFUN([gl_LANGINFO_MODULE_INDICATOR],
--- a/m4/locale_h.m4
+++ b/m4/locale_h.m4
@@ -1,4 +1,4 @@
-# locale_h.m4 serial 6
+# locale_h.m4 serial 7
 dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -56,6 +56,15 @@
      || test $gl_cv_header_locale_h_needs_xlocale_h = yes; then
     gl_REPLACE_LOCALE_H
   fi
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <locale.h>
+/* Some systems provide declarations in a non-standard header.  */
+#if HAVE_XLOCALE_H
+# include <xlocale.h>
+#endif
+   ]], [duplocale])
 ])
 
 dnl Unconditionally enables the replacement of <locale.h>.
--- a/m4/math_h.m4
+++ b/m4/math_h.m4
@@ -1,4 +1,4 @@
-# math_h.m4 serial 16
+# math_h.m4 serial 17
 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -35,6 +35,12 @@
   if test $gl_cv_header_math_huge_val_works = no; then
     REPLACE_HUGE_VAL=1
   fi
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <math.h>
+    ]], [acosl asinl atanl ceilf ceill cosl expl floorf floorl frexpl
+    ldexpl logl round roundf roundl sinl sqrtl tanl trunc truncf truncl])
 ])
 
 AC_DEFUN([gl_MATH_MODULE_INDICATOR],
--- a/m4/search_h.m4
+++ b/m4/search_h.m4
@@ -1,4 +1,4 @@
-# search_h.m4 serial 4
+# search_h.m4 serial 5
 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -15,6 +15,11 @@
     HAVE_SEARCH_H=0
   fi
   AC_SUBST([HAVE_SEARCH_H])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <search.h>
+    ]], [tdelete tfind tsearch twalk])
 ])
 
 AC_DEFUN([gl_SEARCH_MODULE_INDICATOR],
--- a/m4/signal_h.m4
+++ b/m4/signal_h.m4
@@ -1,4 +1,4 @@
-# signal_h.m4 serial 8
+# signal_h.m4 serial 9
 dnl Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -15,6 +15,12 @@
 #include <signal.h>
     ]])
   AC_REQUIRE([AC_TYPE_UID_T])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <signal.h>
+    ]], [sigaction sigaddset sigdelset sigemptyset sigfillset sigismember
+    sigpending sigprocmask])
 ])
 
 AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR],
--- a/m4/spawn_h.m4
+++ b/m4/spawn_h.m4
@@ -1,4 +1,4 @@
-# spawn_h.m4 serial 5
+# spawn_h.m4 serial 6
 dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -34,6 +34,20 @@
   AC_SUBST([HAVE_SPAWN_H])
 
   AC_REQUIRE([AC_C_RESTRICT])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <spawn.h>
+    ]], [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_spawwn_file_actions_adddup2])
 ])
 
 dnl Unconditionally enables the replacement of <spawn.h>.
--- a/m4/stdio_h.m4
+++ b/m4/stdio_h.m4
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 23
+# stdio_h.m4 serial 24
 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -36,7 +36,8 @@
   dnl corresponding gnulib module is not in use, and which is not
   dnl guaranteed by C89.
   gl_WARN_ON_USE_PREPARE([[#include <stdio.h>
-    ]], [fseeko ftello])
+    ]], [dprintf fpurge fseeko ftello getdelim getline popen renameat
+    snprintf vdprintf vsnprintf])
 ])
 
 AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
--- a/m4/stdlib_h.m4
+++ b/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 21
+# stdlib_h.m4 serial 22
 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -22,6 +22,20 @@
       # include <random.h>
       #endif
     ]])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <stdlib.h>
+#if HAVE_SYS_LOADAVG_H
+# include <sys/loadavg.h>
+#endif
+#if HAVE_RANDOM_H
+# include <random.h>
+#endif
+    ]], [atoll canonicalize_file_name getloadavg getsubopt mkdtemp
+    mkostemp mkostemps mkstemp mkstemps random_r initstat_r srandom_r
+    setstate_r realpath rpmatch setenv strtod strtoll strtoull unsetenv])
 ])
 
 AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
--- a/m4/string_h.m4
+++ b/m4/string_h.m4
@@ -5,7 +5,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 10
+# serial 11
 
 # Written by Paul Eggert.
 
@@ -21,6 +21,13 @@
   AC_REQUIRE([AC_C_RESTRICT])
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
   gl_CHECK_NEXT_HEADERS([string.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <string.h>
+    ]], [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup
+    strndup strnlen strpbrk strsep strcasestr strtok_r strsignal strverscmp])
 ])
 
 AC_DEFUN([gl_STRING_MODULE_INDICATOR],
--- a/m4/strings_h.m4
+++ b/m4/strings_h.m4
@@ -1,4 +1,5 @@
 # Configure a replacement for <string.h>.
+# serial 2
 
 # Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -16,6 +17,11 @@
 [
   AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS])
   gl_CHECK_NEXT_HEADERS([strings.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <strings.h>
+    ]], [strcasecmp strncasecmp])
 ])
 
 AC_DEFUN([gl_STRINGS_MODULE_INDICATOR],
--- a/m4/sys_file_h.m4
+++ b/m4/sys_file_h.m4
@@ -1,4 +1,5 @@
 # Configure a replacement for <sys/file.h>.
+# serial 3
 
 # Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -7,8 +8,6 @@
 
 # Written by Richard W.M. Jones.
 
-# serial 2
-
 AC_DEFUN([gl_HEADER_SYS_FILE_H],
 [
   AC_REQUIRE([gl_HEADER_SYS_FILE_H_DEFAULTS])
@@ -26,6 +25,11 @@
     HAVE_SYS_FILE_H=0
   fi
   AC_SUBST([HAVE_SYS_FILE_H])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <sys/file.h>
+    ]], [flock])
 ])
 
 AC_DEFUN([gl_HEADER_SYS_FILE_MODULE_INDICATOR],
--- a/m4/sys_ioctl_h.m4
+++ b/m4/sys_ioctl_h.m4
@@ -1,4 +1,4 @@
-# sys_ioctl_h.m4 serial 4
+# sys_ioctl_h.m4 serial 5
 dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -33,6 +33,15 @@
   AC_SUBST([HAVE_SYS_IOCTL_H])
   dnl <sys/ioctl.h> is always overridden, because of GNULIB_POSIXCHECK.
   gl_CHECK_NEXT_HEADERS([sys/ioctl.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <sys/ioctl.h>
+/* Some platforms declare ioctl in the wrong header.  */
+#ifndef __GLIBC__
+# include <unistd.h>
+#endif
+    ]], [ioctl])
 ])
 
 dnl Unconditionally enables the replacement of <sys/ioctl.h>.
--- a/m4/sys_select_h.m4
+++ b/m4/sys_select_h.m4
@@ -1,4 +1,4 @@
-# sys_select_h.m4 serial 10
+# sys_select_h.m4 serial 11
 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -56,6 +56,17 @@
   if test $gl_cv_header_sys_select_h_selfcontained != yes; then
     gl_PREREQ_SYS_H_WINSOCK2
   fi
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+/* Some systems require prerequisite headers.  */
+#include <sys/types.h>
+#if !defined __GLIBC__ && HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <sys/select.h>
+    ]], [select])
 ])
 
 AC_DEFUN([gl_SYS_SELECT_MODULE_INDICATOR],
--- a/m4/sys_socket_h.m4
+++ b/m4/sys_socket_h.m4
@@ -1,4 +1,4 @@
-# sys_socket_h.m4 serial 13
+# sys_socket_h.m4 serial 14
 dnl Copyright (C) 2005-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -66,6 +66,18 @@
     gl_PREREQ_SYS_H_WINSOCK2
   fi
   AC_SUBST([SYS_SOCKET_H])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+/* Some systems require prerequisite headers.  */
+#include <sys/types.h>
+#if !defined __GLIBC__ && HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <sys/select.h>
+    ]], [socket connect accept bind getpeername getsockname getsockopt
+    listen recv send recvfrom sendto setsockopt shutdown accept4])
 ])
 
 AC_DEFUN([gl_PREREQ_SYS_H_SOCKET],
--- a/m4/sys_stat_h.m4
+++ b/m4/sys_stat_h.m4
@@ -1,4 +1,4 @@
-# sys_stat_h.m4 serial 21   -*- Autoconf -*-
+# sys_stat_h.m4 serial 22   -*- Autoconf -*-
 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -27,6 +27,11 @@
     [#include <sys/types.h>
      #include <sys/stat.h>])
 
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h>
+    ]], [fchmodat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat
+    mknod mknodat stat utimensat])
 ]) # gl_HEADER_SYS_STAT_H
 
 AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
--- a/m4/sys_times_h.m4
+++ b/m4/sys_times_h.m4
@@ -1,5 +1,5 @@
 # Configure a replacement for <sys/times.h>.
-# serial 3
+# serial 4
 
 # Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -24,6 +24,16 @@
     HAVE_STRUCT_TMS=0
   fi
   AC_SUBST([HAVE_SYS_TIMES_H])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+/* Some systems have incomplete headers.  */
+#ifndef __GLIBC__
+# include <time.h>
+#endif
+#include <sys/times.h>
+    ]], [times])
 ])
 
 AC_DEFUN([gl_SYS_TIMES_MODULE_INDICATOR],
--- a/m4/sys_utsname_h.m4
+++ b/m4/sys_utsname_h.m4
@@ -1,4 +1,4 @@
-# sys_utsname_h.m4 serial 3
+# sys_utsname_h.m4 serial 4
 dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -24,6 +24,11 @@
       ]])
   fi
   AC_SUBST([HAVE_SYS_UTSNAME_H])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <sys/utsname.h>
+    ]], [uname])
 ])
 
 AC_DEFUN([gl_SYS_UTSNAME_MODULE_INDICATOR],
--- a/m4/unistd_h.m4
+++ b/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 38
+# unistd_h.m4 serial 39
 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -26,11 +26,20 @@
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use.
   gl_WARN_ON_USE_PREPARE([[#include <unistd.h>
-/* Some systems declare environ in the wrong header.  */
+/* Some systems declare various items in the wrong headers.  */
 #ifndef __GLIBC__
+# include <fcntl.h>
+# include <stdio.h>
 # include <stdlib.h>
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+#  include <io.h>
+# endif
 #endif
-    ]], [environ])
+    ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat
+    fsync ftruncate getcwd getdomainname getdtablesize getgroups
+    gethostname getlogin getlogin_r getpagesize getusershell setusershell
+    endusershell lchown link linkat lseek pipe2 pread readlink readlinkat
+    rmdir sleep symlink symlinkat unlink unlinkat usleep])
 ])
 
 AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
--- a/m4/wchar.m4
+++ b/m4/wchar.m4
@@ -7,7 +7,7 @@
 
 dnl Written by Eric Blake.
 
-# wchar.m4 serial 30
+# wchar.m4 serial 31
 
 AC_DEFUN([gl_WCHAR_H],
 [
@@ -33,6 +33,19 @@
     HAVE_WINT_T=0
   fi
   AC_SUBST([HAVE_WINT_T])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+/* Some systems require additional headers.  */
+#ifndef __GLIBC__
+# include <stddef.h>
+# include <stdio.h>
+# include <time.h>
+#endif
+#include <wchar.h>
+    ]], [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb
+    wcsrtombs wcsnrtombs wcwidth])
 ])
 
 dnl Check whether <wchar.h> is usable at all.
--- a/modules/arpa_inet
+++ b/modules/arpa_inet
@@ -6,10 +6,10 @@
 m4/arpa_inet_h.m4
 
 Depends-on:
+arg-nonnull
 include_next
-link-warning
-arg-nonnull
 sys_socket
+warn-on-use
 
 configure.ac:
 gl_HEADER_ARPA_INET
@@ -20,7 +20,7 @@
 
 # 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) $(ARG_NONNULL_H)
+arpa/inet.h: arpa_inet.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
 	$(AM_V_at)$(MKDIR_P) arpa
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -32,8 +32,8 @@
 	      -e 's|@''GNULIB_INET_PTON''@|$(GNULIB_INET_PTON)|g' \
 	      -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)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/arpa_inet.in.h; \
 	} > $@-t && \
 	mv $@-t $@
--- a/modules/ctype
+++ b/modules/ctype
@@ -7,7 +7,7 @@
 
 Depends-on:
 include_next
-link-warning
+warn-on-use
 
 configure.ac:
 gl_CTYPE_H
@@ -17,7 +17,7 @@
 
 # We need the following in order to create <ctype.h> when the system
 # doesn't have one that works with the given compiler.
-ctype.h: ctype.in.h $(LINK_WARNING_H)
+ctype.h: ctype.in.h $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -25,7 +25,7 @@
 	      -e 's|@''NEXT_CTYPE_H''@|$(NEXT_CTYPE_H)|g' \
 	      -e 's/@''GNULIB_ISBLANK''@/$(GNULIB_ISBLANK)/g' \
 	      -e 's/@''HAVE_ISBLANK''@/$(HAVE_ISBLANK)/g' \
-	      -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/ctype.in.h; \
 	} > $@-t && \
 	mv $@-t $@
--- a/modules/dirent
+++ b/modules/dirent
@@ -7,9 +7,9 @@
 m4/unistd_h.m4
 
 Depends-on:
+arg-nonnull
 include_next
-link-warning
-arg-nonnull
+warn-on-use
 
 configure.ac:
 gl_DIRENT_H
@@ -19,7 +19,7 @@
 
 # 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) $(ARG_NONNULL_H)
+dirent.h: dirent.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -36,8 +36,8 @@
 	      -e 's|@''REPLACE_CLOSEDIR''@|$(REPLACE_CLOSEDIR)|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)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/dirent.in.h; \
 	} > $@-t && \
 	mv $@-t $@
--- a/modules/fcntl-h
+++ b/modules/fcntl-h
@@ -7,11 +7,11 @@
 m4/fcntl-o.m4
 
 Depends-on:
+arg-nonnull
+extensions
 include_next
-link-warning
-arg-nonnull
 unistd
-extensions
+warn-on-use
 
 configure.ac:
 gl_FCNTL_H
@@ -21,7 +21,7 @@
 
 # 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) $(ARG_NONNULL_H)
+fcntl.h: fcntl.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -35,8 +35,8 @@
 	      -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \
 	      -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \
 	      -e 's|@''REPLACE_OPENAT''@|$(REPLACE_OPENAT)|g' \
-	      -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
 	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/fcntl.in.h; \
 	} > $@-t && \
 	mv $@-t $@
--- a/modules/inttypes
+++ b/modules/inttypes
@@ -7,11 +7,11 @@
 m4/inttypes.m4
 
 Depends-on:
+arg-nonnull
 include_next
-link-warning
-arg-nonnull
 multiarch
 stdint
+warn-on-use
 
 configure.ac:
 gl_INTTYPES_H
@@ -21,7 +21,7 @@
 
 # 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) $(ARG_NONNULL_H)
+inttypes.h: inttypes.in.h $(WARN_ON_USE_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' \
@@ -45,8 +45,8 @@
 	      -e 's/@''INT64_MAX_EQ_LONG_MAX''@/$(INT64_MAX_EQ_LONG_MAX)/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)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/inttypes.in.h; \
 	} > $@-t && \
 	mv $@-t $@
--- a/modules/langinfo
+++ b/modules/langinfo
@@ -8,7 +8,7 @@
 Depends-on:
 extensions
 include_next
-link-warning
+warn-on-use
 
 configure.ac:
 gl_LANGINFO_H
@@ -18,7 +18,7 @@
 
 # We need the following in order to create an empty placeholder for
 # <langinfo.h> when the system doesn't have one.
-langinfo.h: langinfo.in.h $(LINK_WARNING_H)
+langinfo.h: langinfo.in.h $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''HAVE_LANGINFO_H''@|$(HAVE_LANGINFO_H)|g' \
@@ -30,7 +30,7 @@
 	      -e 's|@''HAVE_LANGINFO_ERA''@|$(HAVE_LANGINFO_ERA)|g' \
 	      -e 's|@''HAVE_NL_LANGINFO''@|$(HAVE_NL_LANGINFO)|g' \
 	      -e 's|@''REPLACE_NL_LANGINFO''@|$(REPLACE_NL_LANGINFO)|g' \
-	      -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/langinfo.in.h; \
 	} > $@-t && \
 	mv $@-t $@
--- a/modules/locale
+++ b/modules/locale
@@ -6,11 +6,11 @@
 m4/locale_h.m4
 
 Depends-on:
-include_next
 arg-nonnull
 extensions
-link-warning
+include_next
 stddef
+warn-on-use
 
 configure.ac:
 gl_LOCALE_H
@@ -20,7 +20,7 @@
 
 # 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 $(LINK_WARNING_H) $(ARG_NONNULL_H)
+locale.h: locale.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -29,8 +29,8 @@
 	      -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_LINK_WARNING/r $(LINK_WARNING_H)' \
 	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/locale.in.h; \
 	} > $@-t && \
 	mv $@-t $@
--- a/modules/math
+++ b/modules/math
@@ -8,7 +8,6 @@
 Depends-on:
 arg-nonnull
 include_next
-link-warning
 warn-on-use
 
 configure.ac:
@@ -19,7 +18,7 @@
 
 # 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) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+math.h: math.in.h $(WARN_ON_USE_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' \
@@ -97,7 +96,6 @@
 	      -e 's|@''REPLACE_SIGNBIT''@|$(REPLACE_SIGNBIT)|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)' \
 	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/math.in.h; \
--- a/modules/search
+++ b/modules/search
@@ -6,9 +6,9 @@
 m4/search_h.m4
 
 Depends-on:
+arg-nonnull
 include_next
-link-warning
-arg-nonnull
+warn-on-use
 
 configure.ac:
 gl_SEARCH_H
@@ -18,7 +18,7 @@
 
 # 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) $(ARG_NONNULL_H)
+search.h: search.in.h $(WARN_ON_USE_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' \
@@ -28,8 +28,8 @@
 	      -e 's|@''GNULIB_TSEARCH''@|$(GNULIB_TSEARCH)|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)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/search.in.h; \
 	} > $@-t && \
 	mv $@-t $@
--- a/modules/signal
+++ b/modules/signal
@@ -6,9 +6,9 @@
 m4/signal_h.m4
 
 Depends-on:
+arg-nonnull
 include_next
-link-warning
-arg-nonnull
+warn-on-use
 
 configure.ac:
 gl_SIGNAL_H
@@ -18,7 +18,7 @@
 
 # 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) $(ARG_NONNULL_H)
+signal.h: signal.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -33,8 +33,8 @@
 	      -e 's|@''HAVE_SIGACTION''@|$(HAVE_SIGACTION)|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)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/signal.in.h; \
 	} > $@-t && \
 	mv $@-t $@
--- a/modules/spawn
+++ b/modules/spawn
@@ -6,10 +6,10 @@
 m4/spawn_h.m4
 
 Depends-on:
+arg-nonnull
 include_next
-link-warning
-arg-nonnull
 sched
+warn-on-use
 
 configure.ac:
 gl_SPAWN_H
@@ -19,7 +19,7 @@
 
 # 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) $(ARG_NONNULL_H)
+spawn.h: spawn.in.h $(WARN_ON_USE_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' \
@@ -51,8 +51,8 @@
 	      -e 's|@''HAVE_POSIX_SPAWNATTR_T''@|$(HAVE_POSIX_SPAWNATTR_T)|g' \
 	      -e 's|@''HAVE_POSIX_SPAWN_FILE_ACTIONS_T''@|$(HAVE_POSIX_SPAWN_FILE_ACTIONS_T)|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)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/spawn.in.h; \
 	} > $@-t && \
 	mv $@-t $@
--- a/modules/stdio
+++ b/modules/stdio
@@ -8,7 +8,6 @@
 
 Depends-on:
 include_next
-link-warning
 arg-nonnull
 raise
 stddef
@@ -22,7 +21,7 @@
 
 # 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) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+stdio.h: stdio.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -107,7 +106,6 @@
 	      -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|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)' \
 	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
 	} > $@-t && \
--- a/modules/stdlib
+++ b/modules/stdlib
@@ -6,12 +6,12 @@
 m4/stdlib_h.m4
 
 Depends-on:
+arg-nonnull
 include_next
-link-warning
-arg-nonnull
-unistd
 stddef
 stdint
+unistd
+warn-on-use
 
 configure.ac:
 gl_STDLIB_H
@@ -21,7 +21,7 @@
 
 # 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) $(ARG_NONNULL_H)
+stdlib.h: stdlib.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -77,8 +77,8 @@
 	      -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|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)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/stdlib.in.h; \
 	} > $@-t && \
 	mv $@-t $@
--- a/modules/string
+++ b/modules/string
@@ -6,11 +6,11 @@
 m4/string_h.m4
 
 Depends-on:
+arg-nonnull
 extensions
 include_next
-link-warning
-arg-nonnull
 stddef
+warn-on-use
 
 configure.ac:
 gl_HEADER_STRING_H
@@ -20,7 +20,7 @@
 
 # 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) $(ARG_NONNULL_H)
+string.h: string.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -88,8 +88,9 @@
 	      -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|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)'; \
+	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
+	      < $(srcdir)/string.in.h; \
 	} > $@-t && \
 	mv $@-t $@
 MOSTLYCLEANFILES += string.h string.h-t
--- a/modules/strings
+++ b/modules/strings
@@ -6,9 +6,9 @@
 m4/strings_h.m4
 
 Depends-on:
+arg-nonnull
 include_next
-link-warning
-arg-nonnull
+warn-on-use
 
 configure.ac:
 gl_HEADER_STRINGS_H
@@ -18,7 +18,7 @@
 
 # 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) $(ARG_NONNULL_H)
+strings.h: strings.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -26,8 +26,8 @@
 	      -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|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)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/strings.in.h; \
 	} > $@-t && \
 	mv $@-t $@
--- a/modules/sys_file
+++ b/modules/sys_file
@@ -7,7 +7,7 @@
 
 Depends-on:
 include_next
-link-warning
+warn-on-use
 
 configure.ac:
 gl_HEADER_SYS_FILE_H
@@ -18,7 +18,7 @@
 
 # We need the following in order to create <sys/file.h> when the system
 # has one that is incomplete.
-sys/file.h: sys_file.in.h $(LINK_WARNING_H)
+sys/file.h: sys_file.in.h $(WARN_ON_USE_H)
 	$(AM_V_at)$(MKDIR_P) sys
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -28,7 +28,7 @@
 	      -e 's|@''NEXT_SYS_FILE_H''@|$(NEXT_SYS_FILE_H)|g' \
 	      -e 's/@''HAVE_FLOCK''@/$(HAVE_FLOCK)/g' \
 	      -e 's/@''GNULIB_FLOCK''@/$(GNULIB_FLOCK)/g' \
-	      -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/sys_file.in.h; \
 	} > $@-t && \
 	mv $@-t $@
--- a/modules/sys_ioctl
+++ b/modules/sys_ioctl
@@ -7,8 +7,8 @@
 
 Depends-on:
 include_next
-link-warning
 unistd
+warn-on-use
 
 configure.ac:
 gl_SYS_IOCTL_H
@@ -19,7 +19,7 @@
 
 # We need the following in order to create <sys/ioctl.h> when the system
 # does not have a complete one.
-sys/ioctl.h: sys_ioctl.in.h $(LINK_WARNING_H)
+sys/ioctl.h: sys_ioctl.in.h $(WARN_ON_USE_H)
 	$(AM_V_at)$(MKDIR_P) sys
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -30,7 +30,7 @@
 	      -e 's|@''GNULIB_IOCTL''@|$(GNULIB_IOCTL)|g' \
 	      -e 's|@''SYS_IOCTL_H_HAVE_WINSOCK2_H''@|$(SYS_IOCTL_H_HAVE_WINSOCK2_H)|g' \
 	      -e 's|@''SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \
-	      -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/sys_ioctl.in.h; \
 	} > $@-t && \
 	mv $@-t $@
--- a/modules/sys_select
+++ b/modules/sys_select
@@ -7,9 +7,9 @@
 
 Depends-on:
 include_next
-link-warning
 sys_socket
 sys_time
+warn-on-use
 
 configure.ac:
 gl_HEADER_SYS_SELECT
@@ -20,7 +20,7 @@
 
 # We need the following in order to create <sys/select.h> when the system
 # doesn't have one that works with the given compiler.
-sys/select.h: sys_select.in.h $(LINK_WARNING_H)
+sys/select.h: sys_select.in.h $(WARN_ON_USE_H)
 	$(AM_V_at)$(MKDIR_P) sys
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -31,7 +31,7 @@
 	      -e 's|@''GNULIB_SELECT''@|$(GNULIB_SELECT)|g' \
 	      -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
 	      -e 's|@''REPLACE_SELECT''@|$(REPLACE_SELECT)|g' \
-	      -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/sys_select.in.h; \
 	} > $@-t && \
 	mv $@-t $@
--- a/modules/sys_socket
+++ b/modules/sys_socket
@@ -7,11 +7,11 @@
 m4/sockpfaf.m4
 
 Depends-on:
-include_next
-link-warning
+alignof
 arg-nonnull
 errno
-alignof
+include_next
+warn-on-use
 
 configure.ac:
 gl_HEADER_SYS_SOCKET
@@ -22,7 +22,7 @@
 
 # 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) $(ARG_NONNULL_H)
+sys/socket.h: sys_socket.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
 	$(AM_V_at)$(MKDIR_P) sys
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -51,8 +51,8 @@
 	      -e 's|@''HAVE_STRUCT_SOCKADDR_STORAGE''@|$(HAVE_STRUCT_SOCKADDR_STORAGE)|g' \
 	      -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)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/sys_socket.in.h; \
 	} > $@-t && \
 	mv -f $@-t $@
--- a/modules/sys_stat
+++ b/modules/sys_stat
@@ -7,10 +7,10 @@
 m4/unistd_h.m4
 
 Depends-on:
+arg-nonnull
 include_next
-link-warning
-arg-nonnull
 time
+warn-on-use
 
 configure.ac:
 gl_HEADER_SYS_STAT_H
@@ -21,7 +21,7 @@
 
 # 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) $(ARG_NONNULL_H)
+sys/stat.h: sys_stat.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
 	$(AM_V_at)$(MKDIR_P) sys
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -60,8 +60,8 @@
 	      -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \
 	      -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)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/sys_stat.in.h; \
 	} > $@-t && \
 	mv $@-t $@
--- a/modules/sys_times
+++ b/modules/sys_times
@@ -8,7 +8,7 @@
 Depends-on:
 arg-nonnull
 include_next
-link-warning
+warn-on-use
 
 configure.ac:
 gl_SYS_TIMES_H
@@ -19,7 +19,7 @@
 
 # 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) $(ARG_NONNULL_H)
+sys/times.h: sys_times.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
 	$(AM_V_at)$(MKDIR_P) sys
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -30,8 +30,8 @@
 	      -e 's|@''GNULIB_TIMES''@|$(GNULIB_TIMES)|g' \
 	      -e 's|@''HAVE_STRUCT_TMS''@|$(HAVE_STRUCT_TMS)|g' \
 	      -e 's|@''HAVE_TIMES''@|$(HAVE_TIMES)|g' \
-	      -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
 	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/sys_times.in.h; \
 	} > $@-t && \
 	mv $@-t $@
--- a/modules/sys_utsname
+++ b/modules/sys_utsname
@@ -8,7 +8,7 @@
 Depends-on:
 arg-nonnull
 include_next
-link-warning
+warn-on-use
 
 configure.ac:
 gl_SYS_UTSNAME_H
@@ -19,7 +19,7 @@
 
 # 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) $(ARG_NONNULL_H)
+sys/utsname.h: sys_utsname.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
 	$(AM_V_at)$(MKDIR_P) sys
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -30,8 +30,8 @@
 	      -e 's|@''GNULIB_UNAME''@|$(GNULIB_UNAME)|g' \
 	      -e 's|@''HAVE_STRUCT_UTSNAME''@|$(HAVE_STRUCT_UTSNAME)|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)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/sys_utsname.in.h; \
 	} > $@-t && \
 	mv $@-t $@
--- a/modules/unistd
+++ b/modules/unistd
@@ -8,7 +8,6 @@
 Depends-on:
 arg-nonnull
 include_next
-link-warning
 stddef
 warn-on-use
 
@@ -20,7 +19,7 @@
 
 # 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) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+unistd.h: unistd.in.h $(WARN_ON_USE_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' \
@@ -121,7 +120,6 @@
 	      -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|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)' \
 	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
 	} > $@-t && \
--- a/modules/wchar
+++ b/modules/wchar
@@ -7,10 +7,10 @@
 m4/wint_t.m4
 
 Depends-on:
+arg-nonnull
 include_next
-link-warning
-arg-nonnull
 stddef
+warn-on-use
 
 configure.ac:
 gl_WCHAR_H
@@ -20,7 +20,7 @@
 
 # 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) $(ARG_NONNULL_H)
+wchar.h: wchar.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -62,8 +62,8 @@
 	      -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|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)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	    < $(srcdir)/wchar.in.h; \
 	} > $@-t && \
 	mv $@-t $@