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>
This commit is contained in:
Corinna Vinschen 2016-03-12 23:25:11 +01:00
parent fcd8a0d4f4
commit 6b97fabf1b
1 changed files with 5 additions and 3 deletions

View File

@ -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