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

Shaun Jackman sjackman at gmail.com
Mon Jul 25 18:33:31 UTC 2005


When compiling busybox using newlib, some glibc headers need to be
used for Linux kernel specific features such as sys/mount.h -- newlib
is largely kernel agnostic. This means that __NEWLIB_H__ must be
checked before __GLIBC__, since both may be defined.

Thanks,
Shaun

On 4/5/05, Shaun Jackman <sjackman at gmail.com> wrote:
> newlib headers are often mixed with 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