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: Thu, 31 Dec 2009 23:22:25 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Eric Blake <ebb9 <at> byu.net> writes:

> > Reducing two invocations of AC_CHECK_HEADERS_ONCE to a single one will
> > IMO not bring large benefits.
> 
> Then how about a patch in the converse direction, that ensures 
> AC_CHECK_HEADERS_ONCE is called prior to any use of ac_cv_header_xxx_h, 
rather 
> than the few modules that currently exploit gl_CHECK_NEXT_HEADERS.


From: Eric Blake <address@hidden>
Date: Thu, 31 Dec 2009 16:20:15 -0700
Subject: [PATCH] headers: make check of system header explicit

Exploiting knowledge of internal behavior of other macros can
be dangerous, especially since AC_CHECK_HEADERS_ONCE is designed
to be cheap on subsequent use.

* m4/netdb_h.m4 (gl_HEADER_NETDB): Don't exploit knowledge of
gl_CHECK_NEXT_HEADER internals, but call AC_CHECK_HEADERS_ONCE
ourselves.
* m4/search_h.m4 (gl_SEARCH_H): Likewise.
* m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Likewise.
* m4/sys_time_h.m4 (gl_HEADER_SYS_TIME_H_BODY): Likewise.
* m4/inttypes.m4 (gl_INTTYPES_H): Likewise, for gt_INTTYPES_PRI
internals.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog          |   12 ++++++++++++
 m4/inttypes.m4     |    1 +
 m4/netdb_h.m4      |    3 ++-
 m4/search_h.m4     |    3 ++-
 m4/sys_select_h.m4 |    3 ++-
 m4/sys_time_h.m4   |    2 ++
 6 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 23966ca..de9ca8e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2009-12-31  Eric Blake  <address@hidden>
+
+       headers: make check of system header explicit
+       * m4/netdb_h.m4 (gl_HEADER_NETDB): Don't exploit knowledge of
+       gl_CHECK_NEXT_HEADER internals, but call AC_CHECK_HEADERS_ONCE
+       ourselves.
+       * m4/search_h.m4 (gl_SEARCH_H): Likewise.
+       * m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Likewise.
+       * m4/sys_time_h.m4 (gl_HEADER_SYS_TIME_H_BODY): Likewise.
+       * m4/inttypes.m4 (gl_INTTYPES_H): Likewise, for gt_INTTYPES_PRI
+       internals.
+
 2009-12-31  Bruno Haible  <address@hidden>

        * tests/test-signal.c (main): Remove test of 'SIG'.
diff --git a/m4/inttypes.m4 b/m4/inttypes.m4
index 45bbac8..026de43 100644
--- a/m4/inttypes.m4
+++ b/m4/inttypes.m4
@@ -11,6 +11,7 @@ AC_DEFUN([gl_INTTYPES_H],
 [
   AC_REQUIRE([gl_STDINT_H])
   AC_REQUIRE([gt_INTTYPES_PRI])
+  AC_CHECK_HEADERS_ONCE([inttypes.h])
   AC_CHECK_DECLS_ONCE([imaxabs])
   AC_CHECK_DECLS_ONCE([imaxdiv])
   AC_CHECK_DECLS_ONCE([strtoimax])
diff --git a/m4/netdb_h.m4 b/m4/netdb_h.m4
index 6cc2cfc..be67e30 100644
--- a/m4/netdb_h.m4
+++ b/m4/netdb_h.m4
@@ -1,4 +1,4 @@
-# netdb_h.m4 serial 5
+# netdb_h.m4 serial 6
 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,
@@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is 
preserved.
 AC_DEFUN([gl_HEADER_NETDB],
 [
   AC_REQUIRE([gl_NETDB_H_DEFAULTS])
+  AC_CHECK_HEADERS_ONCE([netdb.h])
   gl_CHECK_NEXT_HEADERS([netdb.h])
   if test $ac_cv_header_netdb_h = yes; then
     AC_COMPILE_IFELSE(
diff --git a/m4/search_h.m4 b/m4/search_h.m4
index 07c9fae..02b42ae 100644
--- a/m4/search_h.m4
+++ b/m4/search_h.m4
@@ -1,4 +1,4 @@
-# search_h.m4 serial 3
+# search_h.m4 serial 4
 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,
@@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is 
preserved.
 AC_DEFUN([gl_SEARCH_H],
 [
   AC_REQUIRE([gl_SEARCH_H_DEFAULTS])
+  AC_CHECK_HEADERS_ONCE([search.h])
   gl_CHECK_NEXT_HEADERS([search.h])
   if test $ac_cv_header_search_h = yes; then
     HAVE_SEARCH_H=1
diff --git a/m4/sys_select_h.m4 b/m4/sys_select_h.m4
index 154d3e1..c9a1a69 100644
--- a/m4/sys_select_h.m4
+++ b/m4/sys_select_h.m4
@@ -1,4 +1,4 @@
-# sys_select_h.m4 serial 9
+# sys_select_h.m4 serial 10
 dnl Copyright (C) 2006-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,
@@ -45,6 +45,7 @@ AC_DEFUN([gl_HEADER_SYS_SELECT],
           ])
       fi
     ])
+  AC_CHECK_HEADERS_ONCE([sys/select.h])
   gl_CHECK_NEXT_HEADERS([sys/select.h])
   if test $ac_cv_header_sys_select_h = yes; then
     HAVE_SYS_SELECT_H=1
diff --git a/m4/sys_time_h.m4 b/m4/sys_time_h.m4
index 10fab8e..dd48db0 100644
--- a/m4/sys_time_h.m4
+++ b/m4/sys_time_h.m4
@@ -1,4 +1,5 @@
 # Configure a replacement for <sys/time.h>.
+# serial 2

 # Copyright (C) 2007, 2009 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -18,6 +19,7 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H],
 AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY],
 [
   AC_REQUIRE([AC_C_RESTRICT])
+  AC_CHECK_HEADERS_ONCE([sys/time.h])
   gl_CHECK_NEXT_HEADERS([sys/time.h])

   if test $ac_cv_header_sys_time_h = yes; then
-- 
1.6.4.2







reply via email to

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