Index: newlib/libc/include/stdio.h =================================================================== RCS file: /cvs/src/src/newlib/libc/include/stdio.h,v retrieving revision 1.40 diff -p -u -r1.40 stdio.h --- newlib/libc/include/stdio.h 20 Feb 2007 20:53:35 -0000 1.40 +++ newlib/libc/include/stdio.h 28 Mar 2007 14:47:03 -0000 @@ -397,6 +397,25 @@ FILE *_EXFUN(funopen,(const _PTR _cookie #endif #ifndef __CUSTOM_FILE_IO__ + +/* The traditional meaning of 'extern inline' to gcc is to omit + to emit the function body unless the address is explicitly + taken. However this behaviour is changing to match the C99 + standard, which uses 'extern inline' to indicate that the + function body *must* be emitted. If we are using gcc, but do + not have the new behaviour, we need to use extern inline; if + we are using a new gcc with the c99-compatible behaviour, or + a non-gcc compiler (which we will have to hope is c99, since + there is no other way to achieve the effect of omitting the + function if it isn't referenced) we just use straight 'inline', + which c99 defines to mean more-or-less the same as the Gnu C + 'extern inline'. */ +#if defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__) +#define ELIDABLE_INLINE extern inline +#else +#define ELIDABLE_INLINE inline +#endif + /* * The __sfoo macros are here so that we can * define function versions in the C library. @@ -404,7 +423,7 @@ FILE *_EXFUN(funopen,(const _PTR _cookie #define __sgetc_raw_r(__ptr, __f) (--(__f)->_r < 0 ? __srget_r(__ptr, __f) : (int)(*(__f)->_p++)) #ifdef __SCLE -static __inline__ int __sgetc_r(struct _reent *__ptr, FILE *__p) +ELIDABLE_INLINE int __sgetc_r(struct _reent *__ptr, FILE *__p) { int __c = __sgetc_raw_r(__ptr, __p); if ((__p->_flags & __SCLE) && (__c == '\r')) @@ -424,7 +443,7 @@ static __inline__ int __sgetc_r(struct _ #ifdef _never /* __GNUC__ */ /* If this inline is actually used, then systems using coff debugging info get hopelessly confused. 21sept93 rich@cygnus.com. */ -static __inline int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) { +ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) { if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) return (*_p->_p++ = _c); else