Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--newlib/ChangeLog18
-rw-r--r--newlib/README7
-rw-r--r--newlib/acconfig.h3
-rwxr-xr-xnewlib/configure24
-rw-r--r--newlib/configure.in15
-rw-r--r--newlib/libc/stdio/vfprintf.c4
-rw-r--r--newlib/libc/stdio/vfwprintf.c4
-rw-r--r--newlib/newlib.hin3
8 files changed, 77 insertions, 1 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 0a819332a..c55bef835 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,21 @@
+2013-06-19 Bin Cheng <bin.cheng@arm.com>
+
+ * acconfig.h (_UNBUF_STREAM_OPT): Undefine.
+ * newlib.hin (_UNBUF_STREAM_OPT): Undefine.
+ * configure.in (--enable-newlib-unbuf-stream-opt): New option.
+ * configure: Regenerate.
+ * libc/stdio/vfprintf.c (_VFPRINTF_R): Don't do optimization on
+ unbuffered stream files.
+ * libc/stdio/vfwprintf.c (_VFWPRINTF_R): Likewise.
+ * README: Add description about the option.
+ * newlib.hin (_UNBUF_STREAM_OPT): Undefine.
+ * configure.in (--enable-newlib-unbuf-stream-opt): New option.
+ * configure: Regenerate.
+ * libc/stdio/vfprintf.c (_VFPRINTF_R): Don't do optimization on
+ unbuffered stream files.
+ * libc/stdio/vfwprintf.c (_VFWPRINTF_R): Likewise.
+ * README: Add description about the option.
+
2013-06-19 Terraneo Federico <fede.tft@hotmail.it>
* libc/posix/readdir_r.c: Fix potential read past dirp->dd_buf.
diff --git a/newlib/README b/newlib/README
index 80bd0665c..d1753fcc9 100644
--- a/newlib/README
+++ b/newlib/README
@@ -321,6 +321,13 @@ One feature can be enabled by specifying `--enable-FEATURE=yes' or
support `--enable-malloc-debugging' any more.
Disabled by default.
+`--disable-newlib-unbuf-stream-opt'
+ NEWLIB does optimization when `fprintf to write only unbuffered unix
+ file'. It creates a temorary buffer to do the optimization that
+ increases stack consumption by about `BUFSIZ' bytes. This option
+ disables the optimization and saves size of text and stack.
+ Enabled by default.
+
`--enable-multilib'
Build many library versions.
Enabled by default.
diff --git a/newlib/acconfig.h b/newlib/acconfig.h
index 71d163bdb..e51eba3d4 100644
--- a/newlib/acconfig.h
+++ b/newlib/acconfig.h
@@ -64,6 +64,9 @@
/* Define if wide char orientation is supported. */
#undef _WIDE_ORIENT
+/* Define if unbuffered stream file optimization is supported. */
+#undef _UNBUF_STREAM_OPT
+
@BOTTOM@
/*
* Iconv encodings enabled ("to" direction)
diff --git a/newlib/configure b/newlib/configure
index fe55eb115..7f6155d54 100755
--- a/newlib/configure
+++ b/newlib/configure
@@ -793,6 +793,7 @@ enable_newlib_fvwrite_in_streamio
enable_newlib_fseek_optimization
enable_newlib_wide_orient
enable_newlib_nano_malloc
+enable_newlib_unbuf_stream_opt
enable_multilib
enable_target_optspace
enable_malloc_debugging
@@ -1460,6 +1461,7 @@ Optional Features:
--disable-newlib-fseek-optimization disable fseek optimization
--disable-newlib-wide-orient Turn off wide orientation in streamio
--enable-newlib-nano-malloc use small-footprint nano-malloc implementation
+ --disable-newlib-unbuf-stream-opt disable unbuffered stream optimization in streamio
--enable-multilib build many library versions (default)
--enable-target-optspace optimize for space
--enable-malloc-debugging indicate malloc debugging requested
@@ -2410,6 +2412,19 @@ else
newlib_nano_malloc=no
fi
+# Check whether --enable-newlib-unbuf-stream-opt was given.
+if test "${enable_newlib_unbuf_stream_opt+set}" = set; then :
+ enableval=$enable_newlib_unbuf_stream_opt; if test "${newlib_unbuf_stream_opt+set}" != set; then
+ case "${enableval}" in
+ yes) newlib_unbuf_stream_opt=yes ;;
+ no) newlib_unbuf_stream_opt=no ;;
+ *) as_fn_error $? "bad value ${enableval} for newlib-unbuf-stream-opt option" "$LINENO" 5 ;;
+ esac
+ fi
+else
+ newlib_unbuf_stream_opt=yes
+fi
+
# Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
@@ -12314,7 +12329,14 @@ fi
if test "${newlib_nano_malloc}" = "yes"; then
cat >>confdefs.h <<_ACEOF
-#define NEWLIB_NANO_MALLOC 1
+#define _NANO_MALLOC 1
+_ACEOF
+
+fi
+
+if test "${newlib_unbuf_stream_opt}" = "yes"; then
+cat >>confdefs.h <<_ACEOF
+#define _UNBUF_STREAM_OPT 1
_ACEOF
fi
diff --git a/newlib/configure.in b/newlib/configure.in
index 5646d64d0..db1c6b1ba 100644
--- a/newlib/configure.in
+++ b/newlib/configure.in
@@ -170,6 +170,17 @@ AC_ARG_ENABLE(newlib-nano-malloc,
esac
fi], [newlib_nano_malloc=no])dnl
+dnl Support --disable-newlib-unbuf-stream-opt
+AC_ARG_ENABLE(newlib-unbuf-stream-opt,
+[ --disable-newlib-unbuf-stream-opt disable unbuffered stream optimization in streamio],
+[if test "${newlib_unbuf_stream_opt+set}" != set; then
+ case "${enableval}" in
+ yes) newlib_unbuf_stream_opt=yes ;;
+ no) newlib_unbuf_stream_opt=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for newlib-unbuf-stream-opt option) ;;
+ esac
+ fi], [newlib_unbuf_stream_opt=yes])dnl
+
NEWLIB_CONFIGURE(.)
dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
@@ -375,6 +386,10 @@ if test "${newlib_nano_malloc}" = "yes"; then
AC_DEFINE_UNQUOTED(_NANO_MALLOC)
fi
+if test "${newlib_unbuf_stream_opt}" = "yes"; then
+AC_DEFINE_UNQUOTED(_UNBUF_STREAM_OPT)
+fi
+
dnl
dnl Parse --enable-newlib-iconv-encodings option argument
dnl
diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c
index e5fcb0331..dd9c22a6d 100644
--- a/newlib/libc/stdio/vfprintf.c
+++ b/newlib/libc/stdio/vfprintf.c
@@ -447,6 +447,7 @@ int __sfputs_r (struct _reent *, FILE *, _CONST char *buf, size_t);
int __sprint_r (struct _reent *, FILE *, register struct __suio *);
#endif /* !INTEGER_ONLY */
+#ifdef _UNBUF_STREAM_OPT
/*
* Helper function for `fprintf to unbuffered unix file': creates a
* temporary buffer. We only work on write-only files; this avoids
@@ -492,6 +493,7 @@ _DEFUN(__sbprintf, (rptr, fp, fmt, ap),
#endif
return (ret);
}
+#endif /* _UNBUF_STREAM_OPT */
#endif /* !STRING_ONLY */
@@ -865,12 +867,14 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap),
return (EOF);
}
+#ifdef _UNBUF_STREAM_OPT
/* optimise fprintf(stderr) (and other unbuffered Unix files) */
if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) &&
fp->_file >= 0) {
_newlib_flockfile_exit (fp);
return (__sbprintf (data, fp, fmt0, ap));
}
+#endif
#else /* STRING_ONLY */
/* Create initial buffer if we are called by asprintf family. */
if (fp->_flags & __SMBF && !fp->_bf._base)
diff --git a/newlib/libc/stdio/vfwprintf.c b/newlib/libc/stdio/vfwprintf.c
index 5860147ec..4788add23 100644
--- a/newlib/libc/stdio/vfwprintf.c
+++ b/newlib/libc/stdio/vfwprintf.c
@@ -166,6 +166,7 @@ int _EXFUN(__SPRINT, (struct _reent *, FILE *, register struct __suio *));
int _EXFUN(__SPRINT, (struct _reent *, FILE *, _CONST char *, size_t));
#endif
#ifndef STRING_ONLY
+#ifdef _UNBUF_STREAM_OPT
/*
* Helper function for `fprintf to unbuffered unix file': creates a
* temporary buffer. We only work on write-only files; this avoids
@@ -209,6 +210,7 @@ _DEFUN(__sbwprintf, (rptr, fp, fmt, ap),
#endif
return (ret);
}
+#endif /* _UNBUF_STREAM_OPT */
#endif /* !STRING_ONLY */
@@ -599,12 +601,14 @@ _DEFUN(_VFWPRINTF_R, (data, fp, fmt0, ap),
return (EOF);
}
+#ifdef _UNBUF_STREAM_OPT
/* optimise fwprintf(stderr) (and other unbuffered Unix files) */
if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) &&
fp->_file >= 0) {
_newlib_flockfile_exit (fp);
return (__sbwprintf (data, fp, fmt0, ap));
}
+#endif
#else /* STRING_ONLY */
/* Create initial buffer if we are called by asprintf family. */
if (fp->_flags & __SMBF && !fp->_bf._base)
diff --git a/newlib/newlib.hin b/newlib/newlib.hin
index 030d51419..c6637cbd4 100644
--- a/newlib/newlib.hin
+++ b/newlib/newlib.hin
@@ -67,6 +67,9 @@
/* Define if wide char orientation is supported. */
#undef _WIDE_ORIENT
+/* Define if unbuffered stream file optimization is supported. */
+#undef _UNBUF_STREAM_OPT
+
/*
* Iconv encodings enabled ("to" direction)
*/