From 6b97fabf1ba0c13921549ec4a89b6953da881078 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sat, 12 Mar 2016 23:25:11 +0100 Subject: Use __sputc_r inline code when building with gcc Per the preceeding comment this inline code is disabled since 1993(!) because of a bug in GCC at the time. This is long gone and the equivalent inline code is used in the BSDs for quite some time. Enable this code for newlib as well. * libc/include/stdio.h (__sputc_r): Enable GCC inline code. Add handling for targets defining __SCLE. Signed-off-by: Corinna Vinschen --- newlib/libc/include/stdio.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'newlib/libc/include') diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h index b7a934421..becafd694 100644 --- a/newlib/libc/include/stdio.h +++ b/newlib/libc/include/stdio.h @@ -651,10 +651,12 @@ _ELIDABLE_INLINE int __sgetc_r(struct _reent *__ptr, FILE *__p) #define __sgetc_r(__ptr, __p) __sgetc_raw_r(__ptr, __p) #endif -#ifdef _never /* __GNUC__ */ -/* If this inline is actually used, then systems using coff debugging - info get hopelessly confused. 21sept93 rich@cygnus.com. */ +#ifdef __GNUC__ _ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) { +#ifdef __SCLE + if ((_p->_flags & __SCLE) && _c == '\n') + __sputc_r (_ptr, '\r', _p); +#endif if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) return (*_p->_p++ = _c); else -- cgit v1.2.3