-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I've noticed that several modules use link-warning, but only conditionally build the replacement header. The simplest example of this is isblank and ctype.in.h - since the only thing in that file that used GL_LINK_WARNING was isblank, but glibc includes isblank, the replacement ctype.in.h is not built and you can use isblank on a glibc system without realizing the portability pitfall, even if you do CFLAGS=-DGNULIB_POSIXCHECK.
Here's the full list of suspect modules. Any objections to a patch that makes replacement of these headers unconditional, so that GNULIB_POSIXCHECK will work better? modules/arpa_inet:BUILT_SOURCES += $(ARPA_INET_H) modules/ctype:BUILT_SOURCES += $(CTYPE_H) modules/dirent:BUILT_SOURCES += $(DIRENT_H) modules/inttypes:BUILT_SOURCES += $(INTTYPES_H) modules/spawn:BUILT_SOURCES += $(SPAWN_H) modules/sys_file:BUILT_SOURCES += $(SYS_FILE_H) modules/sys_ioctl:BUILT_SOURCES += $(SYS_IOCTL_H) modules/sys_select:BUILT_SOURCES += $(SYS_SELECT_H) modules/sys_socket:BUILT_SOURCES += $(SYS_SOCKET_H) modules/sys_times:BUILT_SOURCES += $(SYS_TIMES_H) modules/sys_utsname:BUILT_SOURCES += $(SYS_UTSNAME_H) modules/sys_wait:BUILT_SOURCES += $(SYS_WAIT_H) modules/wchar:BUILT_SOURCES += $(WCHAR_H) Meanwhile, several *.in.h files used GL_LINK_WARNING without ensuring that it was defined. I'm checking in this: - -- Don't work too hard, make some time for fun as well! Eric Blake [email protected] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkszeLcACgkQ84KuGfSFAYDWgACfSXR5I10RYkolAYgGUjZOfjlh 2RoAnjgSTI9dBAORS1PTlMiw4zjAzzoy =Ed6H -----END PGP SIGNATURE-----
>From 537954867056ac60b50168b79ec6c0f6d6ba9103 Mon Sep 17 00:00:00 2001 From: Eric Blake <[email protected]> Date: Thu, 24 Dec 2009 07:19:23 -0700 Subject: [PATCH] link-warning: make usage consistent Ensure GL_LINK_WARNING is defined before use. * modules/ctype (Depends-on): Add link-warning. (Makefile.am): Update rules accordingly. * modules/langinfo (Depends-on, Makefile.am): Likewise. * modules/locale (Depends-on, Makefile.am): Likewise. * modules/sys_file (Makefile.am): Likewise. * lib/ctype.in.h (GL_LINK_WARNING): Ensure definition before use. * lib/langinfo.in.h (GL_LINK_WARNING): Likewise. * lib/locale.in.h (GL_LINK_WARNING): Likewise. * lib/sys_file.in.h (GL_LINK_WARNING): Likewise. Signed-off-by: Eric Blake <[email protected]> --- ChangeLog | 11 +++++++++++ lib/ctype.in.h | 2 ++ lib/langinfo.in.h | 1 + lib/locale.in.h | 2 ++ lib/sys_file.in.h | 3 ++- modules/ctype | 4 +++- modules/langinfo | 6 ++++-- modules/locale | 4 +++- modules/sys_file | 3 ++- 9 files changed, 30 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3cca24c..ae8338e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2009-12-24 Eric Blake <[email protected]> + link-warning: make usage consistent + * modules/ctype (Depends-on): Add link-warning. + (Makefile.am): Update rules accordingly. + * modules/langinfo (Depends-on, Makefile.am): Likewise. + * modules/locale (Depends-on, Makefile.am): Likewise. + * modules/sys_file (Makefile.am): Likewise. + * lib/ctype.in.h (GL_LINK_WARNING): Ensure definition before use. + * lib/langinfo.in.h (GL_LINK_WARNING): Likewise. + * lib/locale.in.h (GL_LINK_WARNING): Likewise. + * lib/sys_file.in.h (GL_LINK_WARNING): Likewise. + tests: add signature checks * tests/signature.h (SIGNATURE_CHECK): New file. * modules/atexit-tests (Files): Use it. diff --git a/lib/ctype.in.h b/lib/ctype.in.h index d1a3c5b..ba90077 100644 --- a/lib/ctype.in.h +++ b/lib/ctype.in.h @@ -36,6 +36,8 @@ #ifndef _GL_CTYPE_H #define _GL_CTYPE_H +/* The definition of GL_LINK_WARNING is copied here. */ + /* Return non-zero if c is a blank, i.e. a space or tab character. */ #if @GNULIB_ISBLANK@ # if !...@have_isblank@ diff --git a/lib/langinfo.in.h b/lib/langinfo.in.h index fc27826..26678cc 100644 --- a/lib/langinfo.in.h +++ b/lib/langinfo.in.h @@ -123,6 +123,7 @@ typedef int nl_item; #endif +/* The definition of GL_LINK_WARNING is copied here. */ /* Declare overridden functions. */ diff --git a/lib/locale.in.h b/lib/locale.in.h index 478795a..3a79c53 100644 --- a/lib/locale.in.h +++ b/lib/locale.in.h @@ -34,6 +34,8 @@ # include <xlocale.h> #endif +/* The definition of GL_LINK_WARNING is copied here. */ + /* The definition of _GL_ARG_NONNULL is copied here. */ /* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C. diff --git a/lib/sys_file.in.h b/lib/sys_file.in.h index a8f81fe..58a73aa 100644 --- a/lib/sys_file.in.h +++ b/lib/sys_file.in.h @@ -1,6 +1,6 @@ /* Provide a more complete sys/file.h. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,6 +31,7 @@ #ifndef _GL_SYS_FILE_H #define _GL_SYS_FILE_H +/* The definition of GL_LINK_WARNING is copied here. */ #if @GNULIB_FLOCK@ /* Apply or remove advisory locks on an open file. diff --git a/modules/ctype b/modules/ctype index b0ebf1b..e896814 100644 --- a/modules/ctype +++ b/modules/ctype @@ -7,6 +7,7 @@ m4/ctype.m4 Depends-on: include_next +link-warning configure.ac: gl_CTYPE_H @@ -16,7 +17,7 @@ BUILT_SOURCES += $(CTYPE_H) # 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 +ctype.h: ctype.in.h $(LINK_WARNING_H) $(AM_V_GEN)rm -f $...@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @@ -24,6 +25,7 @@ ctype.h: ctype.in.h -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)' \ < $(srcdir)/ctype.in.h; \ } > $...@-t && \ mv $...@-t $@ diff --git a/modules/langinfo b/modules/langinfo index f9b0a2f..fb413d0 100644 --- a/modules/langinfo +++ b/modules/langinfo @@ -6,8 +6,9 @@ lib/langinfo.in.h m4/langinfo_h.m4 Depends-on: -include_next extensions +include_next +link-warning configure.ac: gl_LANGINFO_H @@ -17,7 +18,7 @@ BUILT_SOURCES += $(LANGINFO_H) # 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 +langinfo.h: langinfo.in.h $(LINK_WARNING_H) $(AM_V_GEN)rm -f $...@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_LANGINFO_H''@|$(HAVE_LANGINFO_H)|g' \ @@ -29,6 +30,7 @@ langinfo.h: langinfo.in.h -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)' \ < $(srcdir)/langinfo.in.h; \ } > $...@-t && \ mv $...@-t $@ diff --git a/modules/locale b/modules/locale index 60d6081..2541300 100644 --- a/modules/locale +++ b/modules/locale @@ -9,6 +9,7 @@ Depends-on: include_next arg-nonnull extensions +link-warning stddef configure.ac: @@ -19,7 +20,7 @@ BUILT_SOURCES += $(LOCALE_H) # 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 $(ARG_NONNULL_H) +locale.h: locale.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H) $(AM_V_GEN)rm -f $...@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ @@ -28,6 +29,7 @@ locale.h: locale.in.h $(ARG_NONNULL_H) -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)' \ < $(srcdir)/locale.in.h; \ } > $...@-t && \ diff --git a/modules/sys_file b/modules/sys_file index 593604c..61c6202 100644 --- a/modules/sys_file +++ b/modules/sys_file @@ -18,7 +18,7 @@ BUILT_SOURCES += $(SYS_FILE_H) # 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 +sys/file.h: sys_file.in.h $(LINK_WARNING_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $...@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @@ -28,6 +28,7 @@ sys/file.h: sys_file.in.h -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)' \ < $(srcdir)/sys_file.in.h; \ } > $...@-t && \ mv $...@-t $@ -- 1.6.4.2
