[BusyBox] newlib's libbb/printf.c [PATCH]

Shaun Jackman sjackman at gmail.com
Tue Apr 5 17:53:16 UTC 2005


newlib headers are often mixed glibc headers, in which case both
__NEWLIB_H__ and __GLIBC__ will be defined. If __NEWLIB_H__ is defined
though, it's more likely newlib stdio is being used than glibc stdio,
so check for newlib first.

Cheers,
Shaun

2005-04-05  Shaun Jackman  <sjackman at gmail.com>

	* libbb/printf.c: Check for __NEWLIB_H__ before __GLIBC__.

Index: libbb/printf.c
===================================================================
--- libbb/printf.c	(revision 10071)
+++ libbb/printf.c	(working copy)
@@ -74,6 +74,15 @@
 #error unknown uClibc stdio implemenation!
 # endif
 
+#elif defined(__NEWLIB_H__)
+/* I honestly don't know if there are different versions of stdio in
+ * newlibs history.  Anyway, here's what's current.
+ * #define __sfeof(p)      (((p)->_flags & __SEOF) != 0)
+ * #define __sferror(p)    (((p)->_flags & __SERR) != 0)
+ * #define __sclearerr(p)  ((void)((p)->_flags &= ~(__SERR|__SEOF)))
+ */
+#define SET_FERROR_UNLOCKED(S)    ((S)->_flags |= __SERR)
+
 #elif defined(__GLIBC__)
 
 # if defined(_STDIO_USES_IOSTREAM)
@@ -94,15 +103,6 @@
 
 # endif
 
-#elif defined(__NEWLIB_H__)
-/* I honestly don't know if there are different versions of stdio in
- * newlibs history.  Anyway, here's what's current.
- * #define __sfeof(p)      (((p)->_flags & __SEOF) != 0)
- * #define __sferror(p)    (((p)->_flags & __SERR) != 0)
- * #define __sclearerr(p)  ((void)((p)->_flags &= ~(__SERR|__SEOF)))
- */
-#define SET_FERROR_UNLOCKED(S)    ((S)->_flags |= __SERR)
-
 #elif defined(__dietlibc__)
 /*
  *     WARNING!!!  dietlibc is quite buggy.  WARNING!!!



More information about the busybox mailing list