]> sourceware.org Git - newlib-cygwin.git/commitdiff
2013-04-10 Bin Cheng <bin.cheng@arm.com>
authorJeff Johnston <jjohnstn@redhat.com>
Wed, 10 Apr 2013 18:47:46 +0000 (18:47 +0000)
committerJeff Johnston <jjohnstn@redhat.com>
Wed, 10 Apr 2013 18:47:46 +0000 (18:47 +0000)
        * acconfig.h (_FSEEK_OPTIMIZATION): Undef
        * newlib.hin (_FSEEK_OPTIMIZATION): Undef
        * configure.in (--disable-newlib-fseek-optimization): New option.
        * configure: Regenerated.
        * libc/stdio/fflush.c (__sflush_r): Use _FSEEK_OPTIMIZATION to
        control fseek optimization.
        * libc/stdio/fseeko.c (_fseeko_r): Ditto.
        * libc/stdio/makebuf.c (__smakebuf_r): Ditto.
        * libc/stdio64/fseeko64.c (_fseeko64_r): Ditto.

newlib/ChangeLog
newlib/acconfig.h
newlib/configure
newlib/configure.in
newlib/libc/stdio/fflush.c
newlib/libc/stdio/fseeko.c
newlib/libc/stdio/makebuf.c
newlib/libc/stdio64/fseeko64.c
newlib/newlib.hin

index a37ff28e9929f4b0b83d1f16ee62aad7c36941b4..2c4d024bbc44f9ff3f6fde8da9e4ecfb78511346 100644 (file)
@@ -1,3 +1,14 @@
+2013-04-10  Bin Cheng  <bin.cheng@arm.com>
+       * acconfig.h (_FSEEK_OPTIMIZATION): Undef
+       * newlib.hin (_FSEEK_OPTIMIZATION): Undef
+       * configure.in (--disable-newlib-fseek-optimization): New option.
+       * configure: Regenerated.
+       * libc/stdio/fflush.c (__sflush_r): Use _FSEEK_OPTIMIZATION to
+       control fseek optimization.
+       * libc/stdio/fseeko.c (_fseeko_r): Ditto.
+       * libc/stdio/makebuf.c (__smakebuf_r): Ditto.
+       * libc/stdio64/fseeko64.c (_fseeko64_r): Ditto.
+
 2013-04-08  Matthew Gretton-Dann  <matthew.gretton-dann@linaro.org>
 
        * libc/stdio/vfieeefp.h (ldieee): Fix typo.
index 42b38d232127801aaada28ffec9e2457b7c9999d..3d26b826d857e2565b65bf1ff8d070c9b8d56024 100644 (file)
@@ -58,6 +58,9 @@
 /* Define if ivo supported in streamio.  */
 #undef _FVWRITE_IN_STREAMIO
 
+/* Define if fseek functions support seek optimization.  */
+#undef _FSEEK_OPTIMIZATION
+
 @BOTTOM@
 /*
  * Iconv encodings enabled ("to" direction)
index 71499b57f3abc93a7de0b90a9ca6f8b04e60e89b..e57fcf7f571994b59d7276a18839e52c699a6a53 100755 (executable)
@@ -790,6 +790,7 @@ enable_newlib_iconv_external_ccs
 enable_newlib_atexit_dynamic_alloc
 enable_newlib_reent_small
 enable_newlib_fvwrite_in_streamio
+enable_newlib_fseek_optimization
 enable_multilib
 enable_target_optspace
 enable_malloc_debugging
@@ -1454,6 +1455,7 @@ Optional Features:
   --disable-newlib-atexit-alloc    disable dynamic allocation of atexit entries
   --enable-newlib-reent-small   enable small reentrant struct support
   --disable-newlib-fvwrite-in-streamio    disable iov in streamio
+  --disable-newlib-fseek-optimization    disable fseek optimization
   --enable-multilib         build many library versions (default)
   --enable-target-optspace  optimize for space
   --enable-malloc-debugging indicate malloc debugging requested
@@ -2366,6 +2368,19 @@ else
   newlib_fvwrite_in_streamio=yes
 fi
 
+# Check whether --enable-newlib-fseek-optimization was given.
+if test "${enable_newlib_fseek_optimization+set}" = set; then :
+  enableval=$enable_newlib_fseek_optimization; if test "${newlib_fseek_optimization+set}" != set; then
+  case "${enableval}" in
+    yes) newlib_fseek_optimization=yes ;;
+    no)  newlib_fseek_optimization=no  ;;
+    *)   as_fn_error $? "bad value ${enableval} for newlib-fseek-optimization option" "$LINENO" 5 ;;
+  esac
+ fi
+else
+  newlib_fseek_optimization=yes
+fi
+
 
 # Make sure we can run config.sub.
 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
@@ -11666,7 +11681,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11654 "configure"
+#line 11684 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11772,7 +11787,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11760 "configure"
+#line 11790 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12254,6 +12269,13 @@ _ACEOF
 
 fi
 
+if test "${newlib_fseek_optimization}" = "yes"; then
+cat >>confdefs.h <<_ACEOF
+#define _FSEEK_OPTIMIZATION 1
+_ACEOF
+
+fi
+
 
 if test "x${iconv_encodings}" != "x" \
    || test "x${iconv_to_encodings}" != "x" \
index daabcf27632132097ced6b6b341fb654b6d7dcef..f4a65c0df0eaaa1827c5d43027409c43357b80e1 100644 (file)
@@ -135,6 +135,17 @@ AC_ARG_ENABLE(newlib-fvwrite-in-streamio,
   esac
  fi], [newlib_fvwrite_in_streamio=yes])dnl
 
+dnl Support --disable-newlib-fseek-optimization
+AC_ARG_ENABLE(newlib-fseek-optimization,
+[  --disable-newlib-fseek-optimization    disable fseek optimization],
+[if test "${newlib_fseek_optimization+set}" != set; then
+  case "${enableval}" in
+    yes) newlib_fseek_optimization=yes ;;
+    no)  newlib_fseek_optimization=no  ;;
+    *)   AC_MSG_ERROR(bad value ${enableval} for newlib-fseek-optimization option) ;;
+  esac
+ fi], [newlib_fseek_optimization=yes])dnl
+
 NEWLIB_CONFIGURE(.)
 
 dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
@@ -327,6 +338,10 @@ fi
 if test "${newlib_fvwrite_in_streamio}" = "yes"; then
 AC_DEFINE_UNQUOTED(_FVWRITE_IN_STREAMIO)
 fi
+if test "${newlib_fseek_optimization}" = "yes"; then
+AC_DEFINE_UNQUOTED(_FSEEK_OPTIMIZATION)
+fi
 
 dnl
 dnl Parse --enable-newlib-iconv-encodings option argument
index b2bde7af5daa65b3c640449b65eac35e9f4aea5e..ee24cf7caa88424d5d222e039152fa4a7f27c1ab 100644 (file)
@@ -80,10 +80,12 @@ _DEFUN(__sflush_r, (ptr, fp),
   t = fp->_flags;
   if ((t & __SWR) == 0)
     {
+#ifdef _FSEEK_OPTIMIZATION
       /* For a read stream, an fflush causes the next seek to be
          unoptimized (i.e. forces a system-level seek).  This conforms
          to the POSIX and SUSv3 standards.  */
       fp->_flags |= __SNPT;
+#endif
 
       /* For a seekable stream with buffered read characters, we will attempt
          a seek to the current position now.  A subsequent read will then get
@@ -152,7 +154,9 @@ _DEFUN(__sflush_r, (ptr, fp),
            {
              /* Seek successful or ignorable error condition.
                 We can clear read buffer now.  */
+#ifdef _FSEEK_OPTIMIZATION
              fp->_flags &= ~__SNPT;
+#endif
              fp->_r = 0;
              fp->_p = fp->_bf._base;
              if ((fp->_flags & __SOFF) && (curoff != -1 || ptr->_errno == 0))
index 97eafd9cae1acb555a9bfddf8a15ec02526b14e9..2c9419d97a76d577901def552eaa84fe81b926e5 100644 (file)
@@ -219,6 +219,8 @@ _DEFUN(_fseeko_r, (ptr, fp, offset, whence),
 
   if (fp->_bf._base == NULL)
     __smakebuf_r (ptr, fp);
+
+#ifdef _FSEEK_OPTIMIZATION
   if (fp->_flags & (__SWR | __SRW | __SNBF | __SNPT))
     goto dumb;
   if ((fp->_flags & __SOPT) == 0)
@@ -350,6 +352,7 @@ _DEFUN(_fseeko_r, (ptr, fp, offset, whence),
    * We get here if we cannot optimise the seek ... just
    * do it.  Allow the seek function to change fp->_bf._base.
    */
+#endif
 
 dumb:
   if (_fflush_r (ptr, fp)
index a3f47e2f7f056cb8786b3fec54fb776b2bf89920..349783ded4f1f6e2d4459dedfcdbd5c941c22593 100644 (file)
@@ -65,8 +65,10 @@ _DEFUN(__smakebuf_r, (ptr, fp),
         size = _DEFAULT_ASPRINTF_BUFSIZE;
       else
         size = BUFSIZ;
+#ifdef _FSEEK_OPTIMIZATION
       /* do not try to optimise fseek() */
       fp->_flags |= __SNPT;
+#endif
     }
   else
     {
@@ -76,6 +78,7 @@ _DEFUN(__smakebuf_r, (ptr, fp),
 #else
       size = BUFSIZ;
 #endif
+#ifdef _FSEEK_OPTIMIZATION
       /*
        * Optimize fseek() only if it is a regular file.
        * (The test for __sseek is mainly paranoia.)
@@ -91,6 +94,7 @@ _DEFUN(__smakebuf_r, (ptr, fp),
        }
       else
        fp->_flags |= __SNPT;
+#endif
     }
   if ((p = _malloc_r (ptr, size)) == NULL)
     {
index b323f97d8b3fbcd7c34bb48e5b4677874b69521e..d605dd09b295e85085e9aaafaab872a34b216e6f 100644 (file)
@@ -209,6 +209,8 @@ _DEFUN (_fseeko64_r, (ptr, fp, offset, whence),
 
   if (fp->_bf._base == NULL)
     __smakebuf_r (ptr, fp);
+
+#if _FSEEK_OPTIMIZATION
   if (fp->_flags & (__SWR | __SRW | __SNBF | __SNPT))
     goto dumb;
   if ((fp->_flags & __SOPT) == 0)
@@ -330,6 +332,7 @@ _DEFUN (_fseeko64_r, (ptr, fp, offset, whence),
    * We get here if we cannot optimise the seek ... just
    * do it.  Allow the seek function to change fp->_bf._base.
    */
+#endif
 
 dumb:
   if (_fflush_r (ptr, fp)
index 74218c73ef5cee025532a15d6079a6c85108dbc0..f9206e9168b5d91c71185c7a345f161fd523437e 100644 (file)
@@ -61,6 +61,9 @@
 /* Define if ivo supported in streamio.  */
 #undef _FVWRITE_IN_STREAMIO
 
+/* Define if fseek functions support seek optimization.  */
+#undef _FSEEK_OPTIMIZATION
+
 /*
  * Iconv encodings enabled ("to" direction)
  */
This page took 0.07159 seconds and 5 git commands to generate.