bug-gnulib
[Top][All Lists]
Advanced

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

Re: link-warning usage improvements


From: Bruno Haible
Subject: Re: link-warning usage improvements
Date: Mon, 15 Mar 2010 00:50:07 +0100
User-agent: KMail/1.9.9

Eric Blake wrote on 2009-12-31:
> Date: Thu, 24 Dec 2009 12:06:48 -0700
> Subject: [PATCH 4/4] link-warning: always build headers with link warnings
> 
> Replacement headers must be built unconditionally if they use
> GL_LINK_WARNING, if the warning is to ever trigger on a
> glibc system during CFLAGS=-DGNULIB_POSIXCHECK.
> 
> * modules/arpa_inet (Makefile.am): Always build replacement
> header.
> * modules/ctype (Makefile.am): Likewise.
> * modules/dirent (Makefile.am): Likewise.
> * modules/inttypes (Makefile.am): Likewise.
> * modules/langinfo (Makefile.am): Likewise.
> * modules/locale (Makefile.am): Likewise.
> * modules/spawn (Makefile.am): Likewise.
> * modules/sys_file (Makefile.am): Likewise.
> * modules/sys_ioctl (Makefile.am): Likewise.
> * modules/sys_select (Makefile.am): Likewise.
> * modules/sys_socket (Makefile.am): Likewise.
> * modules/sys_times (Makefile.am): Likewise.
> * modules/sys_utsname (Makefile.am): Likewise.
> * modules/sys_wait (Makefile.am): Likewise.
> * modules/wchar (Makefile.am): Likewise.

When I create a testdir for the modules
  ./gnulib-tool --create-testdir --dir=... --with-tests flock unlink unlinkat 
pipe-filter-gi
and build it on MacOS X, I get a compilation error:

  ./sys/select.h:338:7: error: #if with no expression

The reason is that HAVE_WINSOCK2_H expands to empty, instead of 0 or 1. This is
because gl_PREREQ_SYS_H_WINSOCK2 has not been invoked. Apparently the *.m4
files have not been reviewed when the above commit was made.

This fixes it:

2010-03-14  Bruno Haible  <address@hidden>

        Fix bug introduced on 2009-12-31.
        * m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Invoke
        gl_PREREQ_SYS_H_WINSOCK2 always.
        * m4/sys_socket_h.m4 (gl_HEADER_SYS_SOCKET): Likewise. Remove
        SYS_SOCKET_H variable.
        * m4/sys_file_h.m4 (gl_HEADER_SYS_FILE_H): Remove test for flock.
        Update comments.
        * m4/ctype.m4 (gl_CTYPE_H): Update comments.
        * m4/langinfo_h.m4 (gl_LANGINFO_H): Likewise.
        * m4/sys_times_h.m4 (gl_SYS_TIMES_H): Likewise.
        * m4/sys_utsname_h.m4 (gl_SYS_UTSNAME_H): Likewise.
        * m4/sys_wait_h.m4 (gl_SYS_WAIT_H): Likewise.

--- m4/sys_select_h.m4.orig     Mon Mar 15 00:28:05 2010
+++ m4/sys_select_h.m4  Mon Mar 15 00:23:33 2010
@@ -1,4 +1,4 @@
-# sys_select_h.m4 serial 12
+# sys_select_h.m4 serial 13
 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,
@@ -46,6 +46,7 @@
       fi
     ])
   AC_CHECK_HEADERS_ONCE([sys/select.h])
+  dnl <sys/select.h> is always overridden, because of GNULIB_POSIXCHECK.
   gl_CHECK_NEXT_HEADERS([sys/select.h])
   if test $ac_cv_header_sys_select_h = yes; then
     HAVE_SYS_SELECT_H=1
@@ -53,9 +54,7 @@
     HAVE_SYS_SELECT_H=0
   fi
   AC_SUBST([HAVE_SYS_SELECT_H])
-  if test $gl_cv_header_sys_select_h_selfcontained != yes; then
-    gl_PREREQ_SYS_H_WINSOCK2
-  fi
+  gl_PREREQ_SYS_H_WINSOCK2
 
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use.
--- m4/sys_socket_h.m4.orig     Mon Mar 15 00:28:05 2010
+++ m4/sys_socket_h.m4  Mon Mar 15 00:22:10 2010
@@ -1,4 +1,4 @@
-# sys_socket_h.m4 serial 15
+# sys_socket_h.m4 serial 16
 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,
@@ -19,7 +19,6 @@
         [gl_cv_header_sys_socket_h_selfcontained=no])
     ])
   if test $gl_cv_header_sys_socket_h_selfcontained = yes; then
-    SYS_SOCKET_H=''
     dnl If the shutdown function exists, <sys/socket.h> should define
     dnl SHUT_RD, SHUT_WR, SHUT_RDWR.
     AC_CHECK_FUNCS([shutdown])
@@ -37,8 +36,6 @@
         SYS_SOCKET_H='sys/socket.h'
       fi
     fi
-  else
-    SYS_SOCKET_H='sys/socket.h'
   fi
   # We need to check for ws2tcpip.h now.
   gl_PREREQ_SYS_H_SOCKET
@@ -56,16 +53,11 @@
 ])
   if test $ac_cv_type_struct_sockaddr_storage = no; then
     HAVE_STRUCT_SOCKADDR_STORAGE=0
-    SYS_SOCKET_H='sys/socket.h'
   fi
   if test $ac_cv_type_sa_family_t = no; then
     HAVE_SA_FAMILY_T=0
-    SYS_SOCKET_H='sys/socket.h'
   fi
-  if test -n "$SYS_SOCKET_H"; then
-    gl_PREREQ_SYS_H_WINSOCK2
-  fi
-  AC_SUBST([SYS_SOCKET_H])
+  gl_PREREQ_SYS_H_WINSOCK2
 
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use.
--- m4/sys_file_h.m4.orig       Mon Mar 15 00:28:05 2010
+++ m4/sys_file_h.m4    Mon Mar 15 00:19:18 2010
@@ -1,7 +1,7 @@
 # Configure a replacement for <sys/file.h>.
-# serial 3
+# serial 4
 
-# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2008-2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -12,10 +12,7 @@
 [
   AC_REQUIRE([gl_HEADER_SYS_FILE_H_DEFAULTS])
 
-  dnl Only flock is defined in a working <sys/file.h>.  If that
-  dnl function is already there, we don't want to do any substitution.
-  AC_CHECK_FUNCS_ONCE([flock])
-
+  dnl <sys/file.h> is always overridden, because of GNULIB_POSIXCHECK.
   gl_CHECK_NEXT_HEADERS([sys/file.h])
 
   AC_CHECK_HEADERS_ONCE([sys/file.h])
--- m4/ctype.m4.orig    Mon Mar 15 00:28:05 2010
+++ m4/ctype.m4 Mon Mar 15 00:16:51 2010
@@ -1,5 +1,5 @@
-# ctype_h.m4 serial 3
-dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+# ctype_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,
 dnl with or without modifications, as long as this notice is preserved.
@@ -7,8 +7,8 @@
 AC_DEFUN([gl_CTYPE_H],
 [
   AC_REQUIRE([gl_CTYPE_H_DEFAULTS])
-  dnl Execute this unconditionally, because CTYPE_H may be set by other
-  dnl modules, after this code is executed.
+
+  dnl <ctype.h> is always overridden, because of GNULIB_POSIXCHECK.
   gl_CHECK_NEXT_HEADERS([ctype.h])
 
   dnl Check for declarations of anything we want to poison if the
--- m4/langinfo_h.m4.orig       Mon Mar 15 00:28:05 2010
+++ m4/langinfo_h.m4    Mon Mar 15 00:23:03 2010
@@ -1,4 +1,4 @@
-# langinfo_h.m4 serial 4
+# langinfo_h.m4 serial 5
 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,
@@ -11,6 +11,7 @@
   dnl Persuade glibc-2.0.6 <langinfo.h> to define CODESET.
   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
 
+  dnl <langinfo.h> is always overridden, because of GNULIB_POSIXCHECK.
   gl_CHECK_NEXT_HEADERS([langinfo.h])
 
   dnl Determine whether <langinfo.h> exists. It is missing on mingw and BeOS.
--- m4/sys_times_h.m4.orig      Mon Mar 15 00:28:05 2010
+++ m4/sys_times_h.m4   Mon Mar 15 00:27:39 2010
@@ -1,5 +1,5 @@
 # Configure a replacement for <sys/times.h>.
-# serial 4
+# serial 5
 
 # Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -12,6 +12,7 @@
 [
   AC_REQUIRE([gl_SYS_TIMES_H_DEFAULTS])
 
+  dnl <sys/times.h> is always overridden, because of GNULIB_POSIXCHECK.
   gl_CHECK_NEXT_HEADERS([sys/times.h])
   AC_CHECK_HEADERS_ONCE([sys/times.h])
   if test $ac_cv_header_sys_times_h = yes; then
--- m4/sys_utsname_h.m4.orig    Mon Mar 15 00:28:05 2010
+++ m4/sys_utsname_h.m4 Mon Mar 15 00:24:29 2010
@@ -1,5 +1,5 @@
-# sys_utsname_h.m4 serial 4
-dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+# sys_utsname_h.m4 serial 5
+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,
 dnl with or without modifications, as long as this notice is preserved.
@@ -12,6 +12,7 @@
   dnl once only, before all statements that occur in other macros.
   AC_REQUIRE([gl_SYS_UTSNAME_H_DEFAULTS])
 
+  dnl <sys/utsname.h> is always overridden, because of GNULIB_POSIXCHECK.
   gl_CHECK_NEXT_HEADERS([sys/utsname.h])
   AC_CHECK_HEADERS_ONCE([sys/utsname.h])
   if test $ac_cv_header_sys_utsname_h != yes; then
--- m4/sys_wait_h.m4.orig       Mon Mar 15 00:28:05 2010
+++ m4/sys_wait_h.m4    Mon Mar 15 00:24:44 2010
@@ -1,5 +1,5 @@
-# sys_wait_h.m4 serial 2
-dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+# sys_wait_h.m4 serial 3
+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,
 dnl with or without modifications, as long as this notice is preserved.
@@ -8,6 +8,7 @@
 [
   AC_REQUIRE([gl_SYS_WAIT_H_DEFAULTS])
 
+  dnl <sys/wait.h> is always overridden, because of GNULIB_POSIXCHECK.
   gl_CHECK_NEXT_HEADERS([sys/wait.h])
 ])
 




reply via email to

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