This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [Patch] Fix type signature of feof and ferror in c++
- From: Jonathan Roelofs <jonathan at codesourcery dot com>
- To: <newlib at sourceware dot org>
- Date: Thu, 11 Dec 2014 10:23:57 -0700
- Subject: Re: [Patch] Fix type signature of feof and ferror in c++
- Authentication-results: sourceware.org; auth=none
- References: <5489C182 dot 90407 at codesourcery dot com> <20141211170406 dot GH3810 at calimero dot vinschen dot de>
On 12/11/14 10:04 AM, Corinna Vinschen wrote:
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.
Ok, yeah I could see that being annoying. Didn't know there was an etiquette for
that. Should I be putting them in the body of the email when I send a patch?
Changelogs are a bit foreign to me having worked mostly on projects where that
information is captured in the commit history rather than in a separate file.
#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?
Depends on what the type signature of __sfeof and __sferror are supposed to
be... that I don't know. If those are just internal newlib things, then I don't
think it really matters, either way would work.
Cheers,
Jon
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
--
Jon Roelofs
jonathan@codesourcery.com
CodeSourcery / Mentor Embedded