bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNU make 3.81.90 prerelease available


From: Eli Zaretskii
Subject: Re: GNU make 3.81.90 prerelease available
Date: Mon, 12 Jul 2010 16:33:44 +0300

> From: Paul Smith <address@hidden>
> Cc: address@hidden
> Date: Mon, 12 Jul 2010 09:19:42 -0400
> 
> On Mon, 2010-07-12 at 10:20 +0300, Eli Zaretskii wrote:
> > > This change:
> > > 
> > >     2009-10-03  Paul Smith  <address@hidden>
> > > 
> > >       * make.h: Include <alloca.h> even on systems where __GNUC__ is
> > >       defined.  Not sure why it was done the other way.
> > >       Requested by David Boyce <address@hidden>.
> > > 
> > > Causes multiple warnings on systems that use GCC, but do not use glibc
> > > (glibc has the alloca.h header, which makes it skip all this fragment):
> > > 
> > >  on Windows:
> > >     In file included from arscan.c:19:
> > >     make.h:39: warning: conflicting types for built-in function 'alloca'
> > > 
> > >  on DOS:
> > >     In file included from make.h:202,
> > >                from ar.c:19:
> > >     d:/usr/djgpp/include/stdlib.h:85: error: conflicting types for 
> > > 'alloca'
> > >     make.h:39: error: previous declaration of 'alloca' was here
> > > 
> > > I think that having a declaration for `alloca' in make.h is a bad
> > > idea, because there's no way we can guess the right way of declaring
> > > it.
> > > 
> > > What was the motivation for David's request?
> 
> I poked around but I can't remember and I don't have any email related
> to it.

Too bad.  But since we have David here (CC'ed), maybe he remembers his
motivation?

> > > I suggest the following patch, which should DTRT on GNU/Linux and on
> > > other platforms alike:
> > > 
> > > 2010-07-09  Eli Zaretskii  <address@hidden>
> > > 
> > >   * make.h (alloca) [!__GNUC__]: Don't define prototype.
> > > 
> > > --- make.h~0      2010-07-01 11:43:31.000000000 +0300
> > > +++ make.h        2010-07-09 12:02:02.034125000 +0300
> > > @@ -35,8 +35,10 @@
> > >  # ifdef _AIX
> > >   #pragma alloca
> > >  # else
> > > -#  ifndef alloca /* predefined by HP cc +Olibcalls */
> > > +#  ifndef __GNUC__
> > > +#   ifndef alloca /* predefined by HP cc +Olibcalls */
> > >  char *alloca ();
> > > +#   endif
> > >  #  endif
> > >  # endif
> > >  #endif
> 
> To be honest I'm a little lost as to what the problem is or why this
> fixes it

The problem is that GCC has alloca as a built-in.  On GNU/Linux, glibc
comes with a alloca.h header whose definition of alloca matches the
built-in.  But on systems that don't use glibc, the system headers
don't have a prototype for alloca, and the one provided by make.h has
a 99.9% chance of being in conflict with the GCC built-in.  We could
try to second-guess GCC, but it's not needed: a built-in function does
not need to be declared.  So it's much easier to not define a
prototype when GCC is in use then define it correctly for every
possible version of GCC.

> but if it works I'm OK with it.

Thanks, I will commit that change, unless David objects.

> Is this the right return type though?  Wouldn't it be void*?

I have no idea.  You will see that I didn't touch that line in the
patch, precisely because I don't know what is correct and for which
platform(s).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]