summaryrefslogtreecommitdiffstats
path: root/newlib/libc/include/stdio.h
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2016-03-12 23:25:11 +0100
committerCorinna Vinschen <corinna@vinschen.de>2016-03-12 23:25:11 +0100
commit6b97fabf1ba0c13921549ec4a89b6953da881078 (patch)
tree0f35789556073faf90f937f6c3a268930ed92065 /newlib/libc/include/stdio.h
parentfcd8a0d4f4e9750ab2ddccb64318bf7a495af4ef (diff)
downloadcygnal-6b97fabf1ba0c13921549ec4a89b6953da881078.tar.gz
cygnal-6b97fabf1ba0c13921549ec4a89b6953da881078.tar.bz2
cygnal-6b97fabf1ba0c13921549ec4a89b6953da881078.zip
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 <corinna@vinschen.de>
Diffstat (limited to 'newlib/libc/include/stdio.h')
-rw-r--r--newlib/libc/include/stdio.h8
1 files changed, 5 insertions, 3 deletions
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