bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] stdio: simplify by removing some files and dependencies


From: Paul Eggert
Subject: [PATCH] stdio: simplify by removing some files and dependencies
Date: Sun, 27 Feb 2011 22:54:56 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7

I was thinking of modifying GNU Emacs to use gnulib's stdio
module and found that the module contains some dependencies
and code that neither Emacs nor coreutils needs.  Here's
a proposed patch to simplify stdio so that, for example,
Emacs and coreutils won't need m4/asm-underscore.m4 or
lib/stdio-write.c.

---
 ChangeLog              |   19 +++++++++++++++++++
 m4/fseeko.m4           |   22 +++++++++++++++++++++-
 m4/printf-posix-rpl.m4 |    3 ++-
 m4/stdio_h.m4          |   23 +----------------------
 modules/ftello         |    1 +
 modules/printf-posix   |    1 +
 modules/sigpipe        |    4 ++++
 modules/stdio          |    3 ---
 8 files changed, 49 insertions(+), 27 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e349a4e..a3949ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2011-02-27  Paul Eggert  <address@hidden>
+
+       stdio: simplify by removing some files and dependencies
+       * m4/fseeko.m4 (gl_STDIN_LARGE_OFFSET): Moved here, from ...
+       * m4/stdio_h.m4 (gl_STDIN_LARGE_OFFSET): ... here, because
+       only fseek and ftell need it.
+       (gl_STDIO_H): Do not require gl_ASM_SYMBOL_PREFIX, since this
+       symbol is needed only if printf is replaced.
+       * m4/printf-posix-rpl.m4 (gl_REPLACE_PRINTF):
+       Require gl_ASM_SYMBOL_PREFIX.
+       * modules/ftello (Files): Add m4/fseeko.m4, for gl_STDIN_LARGE_OFFSET.
+       * modules/printf-posix (Files): Add m4/asm-underscore.m4.
+       * modules/sigpipe (Files): Likewise.  Also, add m4/stdio-write.c.
+       (Depends-on): Add 'raise'.
+       (configure.ac): Require gl_ASM_SYMBOL_PREFIX.
+       * modules/stdio (Files): Remove lib/stdio-write.c,
+       m4/asm-underscore.m4.
+       (Depends-on): Remove 'raise'.
+
 2011-02-25  Eric Blake  <address@hidden>
 
        strstr: expand test coverage
diff --git a/m4/fseeko.m4 b/m4/fseeko.m4
index 4a67260..76507d1 100644
--- a/m4/fseeko.m4
+++ b/m4/fseeko.m4
@@ -1,4 +1,4 @@
-# fseeko.m4 serial 10
+# fseeko.m4 serial 11
 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -53,3 +53,23 @@ AC_DEFUN([gl_REPLACE_FSEEKO],
   dnl If we are also using the fseek module, then fseek needs replacing, too.
   m4_ifdef([gl_REPLACE_FSEEK], [gl_REPLACE_FSEEK])
 ])
+
+dnl Code shared by fseeko and ftello.  Determine if large files are supported,
+dnl but stdin does not start as a large file by default.
+AC_DEFUN([gl_STDIN_LARGE_OFFSET],
+  [
+    AC_CACHE_CHECK([whether stdin defaults to large file offsets],
+      [gl_cv_var_stdin_large_offset],
+      [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
+[[#if defined __SL64 && defined __SCLE /* cygwin */
+  /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making
+     fseeko/ftello needlessly fail.  This bug was fixed in 1.5.25, and
+     it is easier to do a version check than building a runtime test.  */
+# include <cygwin/version.h>
+# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25)
+  choke me
+# endif
+#endif]])],
+        [gl_cv_var_stdin_large_offset=yes],
+        [gl_cv_var_stdin_large_offset=no])])
+])
diff --git a/m4/printf-posix-rpl.m4 b/m4/printf-posix-rpl.m4
index c57f92d..b9f606d 100644
--- a/m4/printf-posix-rpl.m4
+++ b/m4/printf-posix-rpl.m4
@@ -1,4 +1,4 @@
-# printf-posix-rpl.m4 serial 3
+# printf-posix-rpl.m4 serial 4
 dnl Copyright (C) 2007-2011 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,7 @@ AC_DEFUN([gl_FUNC_PRINTF_POSIX],
 AC_DEFUN([gl_REPLACE_PRINTF],
 [
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([gl_ASM_SYMBOL_PREFIX])
   AC_LIBOBJ([printf])
   REPLACE_PRINTF=1
   AC_DEFINE([REPLACE_PRINTF_POSIX], [1],
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
index b6163d6..7f3ae56 100644
--- a/m4/stdio_h.m4
+++ b/m4/stdio_h.m4
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 32
+# stdio_h.m4 serial 33
 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -8,7 +8,6 @@ AC_DEFUN([gl_STDIO_H],
 [
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
   AC_REQUIRE([AC_C_INLINE])
-  AC_REQUIRE([gl_ASM_SYMBOL_PREFIX])
   gl_NEXT_HEADERS([stdio.h])
   dnl No need to create extra modules for these functions. Everyone who uses
   dnl <stdio.h> likely needs them.
@@ -139,23 +138,3 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   REPLACE_VSNPRINTF=0;           AC_SUBST([REPLACE_VSNPRINTF])
   REPLACE_VSPRINTF=0;            AC_SUBST([REPLACE_VSPRINTF])
 ])
-
-dnl Code shared by fseeko and ftello.  Determine if large files are supported,
-dnl but stdin does not start as a large file by default.
-AC_DEFUN([gl_STDIN_LARGE_OFFSET],
-  [
-    AC_CACHE_CHECK([whether stdin defaults to large file offsets],
-      [gl_cv_var_stdin_large_offset],
-      [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
-[[#if defined __SL64 && defined __SCLE /* cygwin */
-  /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making
-     fseeko/ftello needlessly fail.  This bug was fixed in 1.5.25, and
-     it is easier to do a version check than building a runtime test.  */
-# include <cygwin/version.h>
-# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25)
-  choke me
-# endif
-#endif]])],
-        [gl_cv_var_stdin_large_offset=yes],
-        [gl_cv_var_stdin_large_offset=no])])
-])
diff --git a/modules/ftello b/modules/ftello
index 99c7097..0cf160c 100644
--- a/modules/ftello
+++ b/modules/ftello
@@ -4,6 +4,7 @@ ftello() function: Retrieve the position of a FILE stream.
 Files:
 lib/ftello.c
 lib/stdio-impl.h
+m4/fseeko.m4
 m4/ftello.m4
 
 Depends-on:
diff --git a/modules/printf-posix b/modules/printf-posix
index b9884f4..0597ef9 100644
--- a/modules/printf-posix
+++ b/modules/printf-posix
@@ -11,6 +11,7 @@ Files:
 lib/printf.c
 m4/printf-posix-rpl.m4
 m4/printf.m4
+m4/asm-underscore.m4
 
 Depends-on:
 stdio
diff --git a/modules/sigpipe b/modules/sigpipe
index 99e3e9e..4f03c9e 100644
--- a/modules/sigpipe
+++ b/modules/sigpipe
@@ -8,8 +8,11 @@ have side effects on the compilation of the main modules in 
lib/.
 
 Files:
 m4/sigpipe.m4
+lib/stdio-write.c
+m4/asm-underscore.m4
 
 Depends-on:
+raise
 signal
 sigprocmask
 stdio
@@ -24,6 +27,7 @@ AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
 GNULIB_SIGNAL_H_SIGPIPE=1
 dnl Define the substituted variable GNULIB_STDIO_H_SIGPIPE to 1.
 AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+AC_REQUIRE([gl_ASM_SYMBOL_PREFIX])
 GNULIB_STDIO_H_SIGPIPE=1
 dnl Define the substituted variable GNULIB_UNISTD_H_SIGPIPE to 1.
 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
diff --git a/modules/stdio b/modules/stdio
index 1a45909..2e6c726 100644
--- a/modules/stdio
+++ b/modules/stdio
@@ -3,15 +3,12 @@ A GNU-like <stdio.h>.
 
 Files:
 lib/stdio.in.h
-lib/stdio-write.c
 m4/stdio_h.m4
-m4/asm-underscore.m4
 
 Depends-on:
 include_next
 arg-nonnull
 c++defs
-raise
 stddef
 warn-on-use
 
-- 
1.7.4




reply via email to

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