[PATCH] newlib: Only call _fputwc_r if ELIX_LEVEL >= 4 (nano-)vfprintf.c is enabled for ELIX_LEVEL >= 1. When _WIDE_ORIENT is set, its __sprint_r / __sfputs_r functions unconditionally called _fputwc_r which is only in ELEX_LEVEL >= 4. With this commit, the _WIDE support in (nano-)vfprintf.c is disabled for ELEX_LEVEL < 4. --- newlib/libc/stdio/nano-vfprintf.c | 4 ++-- newlib/libc/stdio/vfprintf.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/newlib/libc/stdio/nano-vfprintf.c b/newlib/libc/stdio/nano-vfprintf.c index bc7ed0743..24472195f 100644 --- a/newlib/libc/stdio/nano-vfprintf.c +++ b/newlib/libc/stdio/nano-vfprintf.c @@ -351,17 +351,17 @@ __sprint_r (struct _reent *ptr, { register int err = 0; if (uio->uio_resid == 0) { uio->uio_iovcnt = 0; return 0; } -#ifdef _WIDE_ORIENT +#if defined _WIDE_ORIENT && (!defined _ELIX_LEVEL || _ELIX_LEVEL >= 4) if (fp->_flags2 & __SWID) { struct __siov *iov; wchar_t *p; int i, len; iov = uio->uio_iov; for (; uio->uio_resid != 0; @@ -402,17 +402,17 @@ __sfputc_r (struct _reent *ptr, int __sfputs_r (struct _reent *ptr, FILE *fp, const char *buf, size_t len) { register int i; -#ifdef _WIDE_ORIENT +#if defined _WIDE_ORIENT && (!defined _ELIX_LEVEL || _ELIX_LEVEL >= 4) if (fp->_flags2 & __SWID) { wchar_t *p; p = (wchar_t *) buf; for (i = 0; i < (len / sizeof (wchar_t)); i++) { if (_fputwc_r (ptr, p[i], fp) == WEOF) diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c index c1483c0ac..6ff5b5686 100644 --- a/newlib/libc/stdio/vfprintf.c +++ b/newlib/libc/stdio/vfprintf.c @@ -365,17 +365,17 @@ int __ssprint_r (struct _reent *, FILE *, register struct __suio *); int __sfputs_r (struct _reent *ptr, FILE *fp, const char *buf, size_t len) { register int i; -#ifdef _WIDE_ORIENT +#if defined _WIDE_ORIENT && (!defined _ELIX_LEVEL || _ELIX_LEVEL >= 4) if (fp->_flags2 & __SWID) { wchar_t *p; p = (wchar_t *) buf; for (i = 0; i < (len / sizeof (wchar_t)); i++) { if (_fputwc_r (ptr, p[i], fp) == WEOF) return -1; } @@ -401,17 +401,17 @@ __sprint_r (struct _reent *ptr, register struct __suio *uio) { register int err = 0; if (uio->uio_resid == 0) { uio->uio_iovcnt = 0; return (0); } -#ifdef _WIDE_ORIENT +#if defined _WIDE_ORIENT && (!defined _ELIX_LEVEL || _ELIX_LEVEL >= 4) if (fp->_flags2 & __SWID) { struct __siov *iov; wchar_t *p; int i, len; iov = uio->uio_iov; for (; uio->uio_resid != 0; uio->uio_resid -= len * sizeof (wchar_t), iov++) {