This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Fix type signature of feof and ferror in c++


On Dec 11 09:08, Jonathan Roelofs wrote:
> This fixes one of the libc++ tests: depr/depr.c.headers/stdio_h.pass.cpp

> diff --git a/ChangeLog b/ChangeLog
> index 5bea065..640bccf 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,7 @@
> +2014-12-11  Jonathan Roelofs  <...>
> +
> +	* libc/include/stdio.h: Fix type signature of feof and ferror in c++
> +

Please don't send ChangeLogs as diffs, always plain.  They won't apply
cleanly most of the time.

>  #ifndef _REENT_SMALL
> -#define	feof(p)		__sfeof(p)
> -#define	ferror(p)	__sferror(p)
> +#define	feof(p)		((int)__sfeof(p))
> +#define	ferror(p)	((int)__sferror(p))
>  #define	clearerr(p)	__sclearerr(p)
>  #endif

Wouldn't it make more sense for all targets to move this into the
definitions of __sfeof/__sferror?

Index: libc/include/stdio.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/stdio.h,v
retrieving revision 1.71
diff -u -p -r1.71 stdio.h
--- libc/include/stdio.h	9 May 2014 14:25:32 -0000	1.71
+++ libc/include/stdio.h	11 Dec 2014 17:03:03 -0000
@@ -649,8 +649,8 @@ _ELIDABLE_INLINE int __sputc_r(struct _r
 #endif
 #endif
 
-#define	__sfeof(p)	(((p)->_flags & __SEOF) != 0)
-#define	__sferror(p)	(((p)->_flags & __SERR) != 0)
+#define	__sfeof(p)	((int)(((p)->_flags & __SEOF) != 0))
+#define	__sferror(p)	((int)(((p)->_flags & __SERR) != 0))
 #define	__sclearerr(p)	((void)((p)->_flags &= ~(__SERR|__SEOF)))
 #define	__sfileno(p)	((p)->_file)
 

Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: pgphhzLQkknoA.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]