From 105c63e8cd8e7e1d803b33839658420f89cc7a7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Wed, 11 Mar 2009 11:21:52 +0000 Subject: [PATCH] To avoid problems of reversed meaning of "extern inline" in GCC 4.3 and above (conforming to the standard when compiled with -std=c99 or -std=gnu99), define the inline functions as "static inline". I've had another patch that maintains the previous behavior, but as titer pointed out, we have no code in our repo that overrides the inlined functions with their own version, and doing so for any other code would be problematic, since for example Linux libio.h #defines these as macros. In any case, I don't really know what I am doing, so please correct me if I did something stupid! :-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29471 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/posix/libio.h | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/headers/posix/libio.h b/headers/posix/libio.h index 83caf1d45e..bb346419b1 100644 --- a/headers/posix/libio.h +++ b/headers/posix/libio.h @@ -174,10 +174,10 @@ extern int _IO_feof_unlocked(_IO_FILE *stream); extern int _IO_ferror(_IO_FILE *stream); extern int _IO_ferror_unlocked(_IO_FILE *stream); extern int _IO_putc(int c, _IO_FILE *stream); -extern int _IO_putc_unlocked(int c, _IO_FILE *stream); +static int _IO_putc_unlocked(int c, _IO_FILE *stream); extern int _IO_getc(_IO_FILE *stream); -extern int _IO_getc_unlocked(_IO_FILE *stream); -extern int _IO_peekc_unlocked(_IO_FILE *stream); +static int _IO_getc_unlocked(_IO_FILE *stream); +static int _IO_peekc_unlocked(_IO_FILE *stream); extern int __underflow(_IO_FILE *stream); extern int __uflow(_IO_FILE *stream); @@ -214,13 +214,8 @@ extern _IO_fpos64_t _IO_seekpos(_IO_FILE *, _IO_fpos64_t, int); extern void _IO_free_backup_area(_IO_FILE *); -#ifdef __cplusplus -# define __INLINE inline -#else -# define __INLINE extern __inline -#endif -__INLINE int +static inline int _IO_getc_unlocked(_IO_FILE *stream) { if (stream->_IO_read_ptr >= stream->_IO_read_end) @@ -230,17 +225,18 @@ _IO_getc_unlocked(_IO_FILE *stream) } -__INLINE int +static inline int _IO_peekc_unlocked(_IO_FILE *stream) { - if (stream->_IO_read_ptr >= stream->_IO_read_end && __underflow(stream) == EOF) + if (stream->_IO_read_ptr >= stream->_IO_read_end + && __underflow(stream) == EOF) return EOF; return *(unsigned char *)stream->_IO_read_ptr; } -__INLINE int +static inline int _IO_putc_unlocked(int c, _IO_FILE *stream) { if (stream->_IO_write_ptr >= stream->_IO_write_end) @@ -249,8 +245,6 @@ _IO_putc_unlocked(int c, _IO_FILE *stream) return (unsigned char)(*stream->_IO_write_ptr++ = c); } -#undef __INLINE - #ifdef __cplusplus } #endif