bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: link-warning usage improvements


From: Eric Blake
Subject: Re: link-warning usage improvements
Date: Tue, 29 Dec 2009 22:16:13 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Bruno Haible on 12/24/2009 1:46 PM:
> Eric Blake wrote:
>> Any objections to a patch that
>> makes replacement of these headers unconditional, so that
>> GNULIB_POSIXCHECK will work better?
>>
> 
> modules/spawn and modules/sys_times will be some work, because currently the
> replacement header file will not work on systems which already have the
> typedefs.

modules/sys_utsname also needs help (sys_tims and sys_utsname need to use
include_next, and spawn just needs to special-case type existence).  So I
haven't finished the unconditional replacement part.  But I am committing
these preliminary patches.

Eric Blake (3):
      [1/3] tests: test more substitute headers
The best way to ensure unconditional replacement didn't break anything is
to add tests first ;)

      [2/3] stdio: remove unused variables
I noticed a partial cleanup from a long time ago, and finished the job.

      [3/3] link-warning: make usage consistent
Several modules used GL_LINK_WARNING without the proper dependencies.  And
getopt did not use GL_LINK_WARNING (I suppose it could, since getopt_long
is available but broken on some platforms; but properly using link-warning
requires more work and is deserving of a separate patch).

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAks64h0ACgkQ84KuGfSFAYCcCQCfZCFyVgDo5DX2EQxt9LOUDrs8
2iYAnic1+n/xrw6KkBNantykoPf7TXF9
=Mjb/
-----END PGP SIGNATURE-----
From 2233a5dfb90328805fea25b6ff386f1be8e172f6 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Tue, 29 Dec 2009 17:01:09 -0700
Subject: [PATCH 1/3] tests: test more substitute headers

Add tests of common headers, in preparation of always providing
a gnulib wrapper (for improved LINK_WARNING support).

* modules/ctype-tests: New file.
* modules/dirent-tests: Likewise.
* modules/spawn-tests: Likewise.
* modules/sys_file-tests: Likewise.
* modules/sys_ioctl-tests: Likewise.
* modules/sys_wait-tests: Likewise.
* tests/test-ctype.c: Likewise.
* tests/test-dirent.c: Likewise.
* tests/test-spawn.c: Likewise.
* tests/test-sys_file.c: Likewise.
* tests/test-sys_ioctl.c: Likewise.
* tests/test-sys_wait.c: Likewise.
* m4/spawn_h.m4 (gl_SPAWN_H): Replace header if it is missing.
* lib/sys_file.in.h (LOCK_SH, LOCK_EX, LOCK_UN, LOCK_NB): Provide
whether or not flock is in use.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog               |   17 ++++++++++++++
 lib/sys_file.in.h       |   18 +++++++-------
 m4/spawn_h.m4           |    3 +-
 modules/ctype-tests     |   10 ++++++++
 modules/dirent-tests    |   10 ++++++++
 modules/spawn-tests     |   10 ++++++++
 modules/sys_file-tests  |   10 ++++++++
 modules/sys_ioctl-tests |   10 ++++++++
 modules/sys_wait-tests  |   10 ++++++++
 tests/test-ctype.c      |   27 +++++++++++++++++++++++
 tests/test-dirent.c     |   32 +++++++++++++++++++++++++++
 tests/test-spawn.c      |   54 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/test-sys_file.c   |   35 ++++++++++++++++++++++++++++++
 tests/test-sys_ioctl.c  |   27 +++++++++++++++++++++++
 tests/test-sys_wait.c   |   30 ++++++++++++++++++++++++++
 15 files changed, 293 insertions(+), 10 deletions(-)
 create mode 100644 modules/ctype-tests
 create mode 100644 modules/dirent-tests
 create mode 100644 modules/spawn-tests
 create mode 100644 modules/sys_file-tests
 create mode 100644 modules/sys_ioctl-tests
 create mode 100644 modules/sys_wait-tests
 create mode 100644 tests/test-ctype.c
 create mode 100644 tests/test-dirent.c
 create mode 100644 tests/test-spawn.c
 create mode 100644 tests/test-sys_file.c
 create mode 100644 tests/test-sys_ioctl.c
 create mode 100644 tests/test-sys_wait.c

diff --git a/ChangeLog b/ChangeLog
index 496239c..6e2b549 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2009-12-29  Eric Blake  <address@hidden>

+       tests: test more substitute headers
+       * modules/ctype-tests: New file.
+       * modules/dirent-tests: Likewise.
+       * modules/spawn-tests: Likewise.
+       * modules/sys_file-tests: Likewise.
+       * modules/sys_ioctl-tests: Likewise.
+       * modules/sys_wait-tests: Likewise.
+       * tests/test-ctype.c: Likewise.
+       * tests/test-dirent.c: Likewise.
+       * tests/test-spawn.c: Likewise.
+       * tests/test-sys_file.c: Likewise.
+       * tests/test-sys_ioctl.c: Likewise.
+       * tests/test-sys_wait.c: Likewise.
+       * m4/spawn_h.m4 (gl_SPAWN_H): Replace header if it is missing.
+       * lib/sys_file.in.h (LOCK_SH, LOCK_EX, LOCK_UN, LOCK_NB): Provide
+       whether or not flock is in use.
+
        tests: remove License section from module
        * modules/arpa_inet-tests: Remove unneeded section.
        * modules/byteswap-tests: Likewise.
diff --git a/lib/sys_file.in.h b/lib/sys_file.in.h
index fbd87c7..4462664 100644
--- a/lib/sys_file.in.h
+++ b/lib/sys_file.in.h
@@ -31,21 +31,21 @@
 #ifndef _GL_SYS_FILE_H
 #define _GL_SYS_FILE_H

+#ifndef LOCK_SH
+/* Operations for the 'flock' call (same as Linux kernel constants).  */
+# define LOCK_SH 1       /* Shared lock.  */
+# define LOCK_EX 2       /* Exclusive lock.  */
+# define LOCK_UN 8       /* Unlock.  */
+
+/* Can be OR'd in to one of the above.  */
+# define LOCK_NB 4       /* Don't block when locking.  */
+#endif

 #if @GNULIB_FLOCK@
 /* Apply or remove advisory locks on an open file.
    Return 0 if successful, otherwise -1 and errno set.  */
 # if address@hidden@
 extern int flock (int fd, int operation);
-
-/* Operations for the 'flock' call (same as Linux kernel constants).  */
-#define LOCK_SH 1       /* Shared lock.  */
-#define LOCK_EX 2       /* Exclusive lock.  */
-#define LOCK_UN 8       /* Unlock.  */
-
-/* Can be OR'd in to one of the above.  */
-#define LOCK_NB 4       /* Don't block when locking.  */
-
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef flock
diff --git a/m4/spawn_h.m4 b/m4/spawn_h.m4
index 4c0c610..dd915fa 100644
--- a/m4/spawn_h.m4
+++ b/m4/spawn_h.m4
@@ -1,4 +1,4 @@
-# spawn_h.m4 serial 2
+# spawn_h.m4 serial 3
 dnl Copyright (C) 2008-2009 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,7 @@ AC_DEFUN([gl_SPAWN_H],
     HAVE_SPAWN_H=1
   else
     HAVE_SPAWN_H=0
+    gl_REPLACE_SPAWN_H
   fi
   AC_SUBST([HAVE_SPAWN_H])

diff --git a/modules/ctype-tests b/modules/ctype-tests
new file mode 100644
index 0000000..4b9f4af
--- /dev/null
+++ b/modules/ctype-tests
@@ -0,0 +1,10 @@
+Files:
+tests/test-ctype.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-ctype
+check_PROGRAMS += test-ctype
diff --git a/modules/dirent-tests b/modules/dirent-tests
new file mode 100644
index 0000000..2511f5f
--- /dev/null
+++ b/modules/dirent-tests
@@ -0,0 +1,10 @@
+Files:
+tests/test-dirent.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-dirent
+check_PROGRAMS += test-dirent
diff --git a/modules/spawn-tests b/modules/spawn-tests
new file mode 100644
index 0000000..c576fdd
--- /dev/null
+++ b/modules/spawn-tests
@@ -0,0 +1,10 @@
+Files:
+tests/test-spawn.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-spawn
+check_PROGRAMS += test-spawn
diff --git a/modules/sys_file-tests b/modules/sys_file-tests
new file mode 100644
index 0000000..f52629d
--- /dev/null
+++ b/modules/sys_file-tests
@@ -0,0 +1,10 @@
+Files:
+tests/test-sys_file.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-sys_file
+check_PROGRAMS += test-sys_file
diff --git a/modules/sys_ioctl-tests b/modules/sys_ioctl-tests
new file mode 100644
index 0000000..17363a7
--- /dev/null
+++ b/modules/sys_ioctl-tests
@@ -0,0 +1,10 @@
+Files:
+tests/test-sys_ioctl.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-sys_ioctl
+check_PROGRAMS += test-sys_ioctl
diff --git a/modules/sys_wait-tests b/modules/sys_wait-tests
new file mode 100644
index 0000000..9c877d8
--- /dev/null
+++ b/modules/sys_wait-tests
@@ -0,0 +1,10 @@
+Files:
+tests/test-sys_wait.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-sys_wait
+check_PROGRAMS += test-sys_wait
diff --git a/tests/test-ctype.c b/tests/test-ctype.c
new file mode 100644
index 0000000..2b11719
--- /dev/null
+++ b/tests/test-ctype.c
@@ -0,0 +1,27 @@
+/* Test of <ctype.h> substitute.
+   Copyright (C) 2009 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <address@hidden>, 2009.  */
+
+#include <config.h>
+
+#include <ctype.h>
+
+int
+main (void)
+{
+  return 0;
+}
diff --git a/tests/test-dirent.c b/tests/test-dirent.c
new file mode 100644
index 0000000..716b201
--- /dev/null
+++ b/tests/test-dirent.c
@@ -0,0 +1,32 @@
+/* Test of <dirent.h> substitute.
+   Copyright (C) 2009 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <address@hidden>, 2009.  */
+
+#include <config.h>
+
+#include <dirent.h>
+
+/* Check for existence of required types.  */
+static DIR *dir _GL_UNUSED;
+static struct dirent d;
+static ino_t i;
+
+int
+main (void)
+{
+  return d.d_name[0] + i;
+}
diff --git a/tests/test-spawn.c b/tests/test-spawn.c
new file mode 100644
index 0000000..f7b919b
--- /dev/null
+++ b/tests/test-spawn.c
@@ -0,0 +1,54 @@
+/* Test of <spawn.h> substitute.
+   Copyright (C) 2009 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <address@hidden>, 2009.  */
+
+#include <config.h>
+
+#include <spawn.h>
+
+/* Check for existence of required types.  */
+struct check
+{
+  posix_spawnattr_t a;
+  posix_spawn_file_actions_t b;
+  mode_t c;
+  pid_t d;
+  sigset_t e;
+} s;
+
+/* struct sched_param is allowed to be an incomplete type without
+   <sched.h>, but must have a forward declaration to avoid a
+   compilation error in the following usage.  */
+extern void f (struct sched_param *g);
+#include <sched.h>
+extern void f (struct sched_param *g);
+
+int
+main (void)
+{
+  switch (0)
+    {
+    case POSIX_SPAWN_RESETIDS:
+    case POSIX_SPAWN_SETPGROUP:
+    case POSIX_SPAWN_SETSIGDEF:
+    case POSIX_SPAWN_SETSIGMASK:
+    case POSIX_SPAWN_SETSCHEDPARAM:
+    case POSIX_SPAWN_SETSCHEDULER:
+      ;
+    }
+  return s.c + s.d;
+}
diff --git a/tests/test-sys_file.c b/tests/test-sys_file.c
new file mode 100644
index 0000000..56b547a
--- /dev/null
+++ b/tests/test-sys_file.c
@@ -0,0 +1,35 @@
+/* Test of <sys/file.h> substitute.
+   Copyright (C) 2009 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <address@hidden>, 2009.  */
+
+#include <config.h>
+
+#include <sys/file.h>
+
+int
+main (void)
+{
+  switch (0)
+    {
+    case LOCK_SH:
+    case LOCK_EX:
+    case LOCK_NB:
+    case LOCK_UN:
+      ;
+    }
+  return 0;
+}
diff --git a/tests/test-sys_ioctl.c b/tests/test-sys_ioctl.c
new file mode 100644
index 0000000..1281690
--- /dev/null
+++ b/tests/test-sys_ioctl.c
@@ -0,0 +1,27 @@
+/* Test of <sys/ioctl.h> substitute.
+   Copyright (C) 2009 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <address@hidden>, 2009.  */
+
+#include <config.h>
+
+#include <sys/ioctl.h>
+
+int
+main (void)
+{
+  return 0;
+}
diff --git a/tests/test-sys_wait.c b/tests/test-sys_wait.c
new file mode 100644
index 0000000..b11cf9d
--- /dev/null
+++ b/tests/test-sys_wait.c
@@ -0,0 +1,30 @@
+/* Test of <sys/wait.h> substitute.
+   Copyright (C) 2009 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <address@hidden>, 2009.  */
+
+#include <config.h>
+
+#include <sys/wait.h>
+
+/* Check for existence of required types.  */
+static pid_t a;
+
+int
+main (void)
+{
+  return a;
+}
-- 
1.6.4.2


From 7bfa0dd93fb4adf45f062ae29aa06a3d95655f45 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Tue, 29 Dec 2009 21:39:33 -0700
Subject: [PATCH 2/3] stdio: remove unused variables

Leftovers from 2007-05-24, commit e461ff7387.

* m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Remove unused variables.
* m4/fseeko.m4 (gl_FUNC_FSEEKO): Likewise.
* m4/ftello.m4 (gl_FUNC_FTELLO): Likewise.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog     |    5 +++++
 m4/fseeko.m4  |    8 +++-----
 m4/ftello.m4  |    8 +++-----
 m4/stdio_h.m4 |    4 +---
 4 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6e2b549..fb766c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2009-12-29  Eric Blake  <address@hidden>

+       stdio: remove unused variables
+       * m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Remove unused variables.
+       * m4/fseeko.m4 (gl_FUNC_FSEEKO): Likewise.
+       * m4/ftello.m4 (gl_FUNC_FTELLO): Likewise.
+
        tests: test more substitute headers
        * modules/ctype-tests: New file.
        * modules/dirent-tests: Likewise.
diff --git a/m4/fseeko.m4 b/m4/fseeko.m4
index feba6ab..a434747 100644
--- a/m4/fseeko.m4
+++ b/m4/fseeko.m4
@@ -1,4 +1,4 @@
-# fseeko.m4 serial 6
+# fseeko.m4 serial 7
 dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -19,10 +19,8 @@ AC_DEFUN([gl_FUNC_FSEEKO],
 ]], [fseeko (stdin, 0, 0);])],
         [gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
     ])
-  if test $gl_cv_func_fseeko = no; then
-    HAVE_FSEEKO=0
-    gl_REPLACE_FSEEKO
-  elif test $gl_cv_var_stdin_large_offset = no; then
+  if test $gl_cv_func_fseeko = no \
+      || test $gl_cv_var_stdin_large_offset = no; then
     gl_REPLACE_FSEEKO
   fi
 ])
diff --git a/m4/ftello.m4 b/m4/ftello.m4
index e1f1417..225e985 100644
--- a/m4/ftello.m4
+++ b/m4/ftello.m4
@@ -1,4 +1,4 @@
-# ftello.m4 serial 4
+# ftello.m4 serial 5
 dnl Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -18,10 +18,8 @@ AC_DEFUN([gl_FUNC_FTELLO],
       AC_TRY_LINK([#include <stdio.h>], [ftello (stdin);],
         [gl_cv_func_ftello=yes], [gl_cv_func_ftello=no])
     ])
-  if test $gl_cv_func_ftello = no; then
-    HAVE_FTELLO=0
-    gl_REPLACE_FTELLO
-  elif test $gl_cv_var_stdin_large_offset = no; then
+  if test $gl_cv_func_ftello = no \
+      || test $gl_cv_var_stdin_large_offset = no; then
     gl_REPLACE_FTELLO
   fi
 ])
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
index 256efe1..c690565 100644
--- a/m4/stdio_h.m4
+++ b/m4/stdio_h.m4
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 21
+# stdio_h.m4 serial 22
 dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -89,8 +89,6 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   HAVE_DECL_SNPRINTF=1;          AC_SUBST([HAVE_DECL_SNPRINTF])
   HAVE_DECL_VSNPRINTF=1;         AC_SUBST([HAVE_DECL_VSNPRINTF])
   HAVE_DPRINTF=1;                AC_SUBST([HAVE_DPRINTF])
-  HAVE_FSEEKO=1;                 AC_SUBST([HAVE_FSEEKO])
-  HAVE_FTELLO=1;                 AC_SUBST([HAVE_FTELLO])
   HAVE_RENAMEAT=1;               AC_SUBST([HAVE_RENAMEAT])
   HAVE_VASPRINTF=1;              AC_SUBST([HAVE_VASPRINTF])
   HAVE_VDPRINTF=1;               AC_SUBST([HAVE_VDPRINTF])
-- 
1.6.4.2


From e0bf16819c83c3ef1d11bf373f5f90a1f09c534c Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Thu, 24 Dec 2009 07:19:23 -0700
Subject: [PATCH 3/3] 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.
* modules/getopt-posix (Makefile.am): Delete unused link warning
efforts.
* 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 <address@hidden>
---
 ChangeLog            |   13 +++++++++++++
 lib/ctype.in.h       |    2 ++
 lib/langinfo.in.h    |    1 +
 lib/locale.in.h      |    2 ++
 lib/sys_file.in.h    |    2 ++
 modules/ctype        |    4 +++-
 modules/getopt-posix |    3 +--
 modules/langinfo     |    6 ++++--
 modules/locale       |    4 +++-
 modules/sys_file     |    3 ++-
 10 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fb766c3..79ffe48 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2009-12-29  Eric Blake  <address@hidden>

+       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.
+       * modules/getopt-posix (Makefile.am): Delete unused link warning
+       efforts.
+       * 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.
+
        stdio: remove unused variables
        * m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Remove unused variables.
        * m4/fseeko.m4 (gl_FUNC_FSEEKO): Likewise.
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 address@hidden@
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 4462664..2dff58c 100644
--- a/lib/sys_file.in.h
+++ b/lib/sys_file.in.h
@@ -41,6 +41,8 @@
 # define LOCK_NB 4       /* Don't block when locking.  */
 #endif

+/* The definition of GL_LINK_WARNING is copied here.  */
+
 #if @GNULIB_FLOCK@
 /* Apply or remove advisory locks on an open file.
    Return 0 if successful, otherwise -1 and errno set.  */
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 address@hidden $@ && \
        { 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; \
        } > address@hidden && \
        mv address@hidden $@
diff --git a/modules/getopt-posix b/modules/getopt-posix
index 63bc6c4..a3ae9f1 100644
--- a/modules/getopt-posix
+++ b/modules/getopt-posix
@@ -23,14 +23,13 @@ BUILT_SOURCES += $(GETOPT_H)

 # We need the following in order to create <getopt.h> when the system
 # doesn't have one that works with the given compiler.
-getopt.h: getopt.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+getopt.h: getopt.in.h $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              < $(srcdir)/getopt.in.h; \
        } > address@hidden && \
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 address@hidden $@ && \
        { 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; \
        } > address@hidden && \
        mv address@hidden $@
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 address@hidden $@ && \
        { 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; \
        } > address@hidden && \
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 address@hidden $@ && \
        { 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; \
        } > address@hidden && \
        mv address@hidden $@
-- 
1.6.4.2


reply via email to

[Prev in Thread] Current Thread [Next in Thread]