This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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] #undef __GLIBC__


On Tue, Nov 15, 2005 at 03:45:40PM +0100, Robert Millan wrote:
> On Tue, Nov 15, 2005 at 01:59:38PM +0000, Mike Frysinger wrote:
> > On Tue, Nov 15, 2005 at 11:38:39AM +0100, Robert Millan wrote:
> > > On Tue, Nov 15, 2005 at 10:56:03AM +0100, Jakub Jelinek wrote:
> > > > On Tue, Nov 15, 2005 at 10:44:37AM +0100, Robert Millan wrote:
> > > > > On GNU/kFreeBSD, __GLIBC__ is a pre-processor macro.  This patch fixes
> > > > > features.h to #undef it before re-defining it to its proper value.
> > > > > 
> > > > > 2005-11-15  Robert Millan  <robertmh@gnu.org>
> > > > > 
> > > > >         * include/features.h: #undef __GLIBC__ before #define.
> > > > 
> > > > That's IMNSHO the wrong fix.  You should change GCC, so that it doesn't
> > > > define __GLIBC__ as a preprocessor macro
> > > 
> > > We added this to GCC on purpose, because otherwise there's no way to identify
> > > Glibc.
> > 
> > whats wrong with just letting glibc define it ?  we let features.h
> > define __GLIBC__ for us in uClibc systems rather than mucking around in
> > in gcc and we have yet to hit a spot where this didnt work
> 
> Now you'll say that __linux__ should only be used for kernel checks (and I
> agree), but we have to adhere to the facts, which are that because there's no
> other way to check for Glibc using pre-processor only, lots of programs use
> __linux__ instead.

as you hint at, those programs are broken.  if they want linux, then
they should use __linux__.  if they want glibc, then they should include
features.h and use __GLIBC__.  i dont know how you're handling the
FreeBSD/glibc porting effort, but if it's typical BSD fashion, you
should try sending patches to upstream maintainers instead of keeping
them all local.  people like patches ;)

>  When we port such programs, we usualy change them like:
> 
>   -#ifdef __linux__
>   +#if defined(__linux__) || defined(__GLIBC__) || defined(__GNU__)
> 
>   /* __GNU__ is for GNU/Hurd, which doesn't define __GLIBC__ either */

why not change it to
#include <features.h>
#if defined(__linux__) || defined(__GLIBC__) || defined(__GNU__)

if you're already patching code to use a diff preprocessor, then 
throwing another line into the mix isnt that big of a deal imho.
-mike


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