[Mesa-dev] [PATCH] c99_alloca.h: Include stdlib.h on all non-Windows.

Alan Coopersmith alan.coopersmith at oracle.com
Mon Mar 2 21:25:40 PST 2015


On 03/ 2/15 08:20 AM, Brian Paul wrote:
> On 03/01/2015 02:00 PM, Alan Coopersmith wrote:
>> On 03/ 1/15 12:52 PM, Vinson Lee wrote:
>>> Fix build on FreeBSD.
>>>
>>> Bugzilla:
>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D89364&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=T0t4QG7chq2ZwJo6wilkFznRSFy-8uDKartPGbomVj8&m=hAYbphGOl9qk5ZTtilbIV6JTR05VlIItJHubG_2VpBQ&s=R-R_SJeKgYFdNDUJIZ4sVeiM8wE49k5Pq4h5nhO2drk&e=
>>>
>>> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
>>> ---
>>>   include/c99_alloca.h | 6 +-----
>>>   1 file changed, 1 insertion(+), 5 deletions(-)
>>>
>>> diff --git a/include/c99_alloca.h b/include/c99_alloca.h
>>> index 7a81c50..575f719 100644
>>> --- a/include/c99_alloca.h
>>> +++ b/include/c99_alloca.h
>>> @@ -35,13 +35,9 @@
>>>
>>>   #  define alloca _alloca
>>>
>>> -#elif defined(__MINGW32__)
>>> -
>>> -#  include <malloc.h>
>>> -
>>>   #else /* !defined(_MSC_VER) */
>>>
>>> -#  include <alloca.h>
>>> +#  include <stdlib.h>
>>>
>>>   #endif /* !defined(_MSC_VER) */
>>
>> Solaris defines alloca() in <alloca.h>, not <stdlib.h>
>
> Alan, is there an #ifdef we can use on Solaris to pull in the right header?

Because compiler standard #defines last longer than corporations,

#elif defined(__sun)

# include <alloca.h>

should work.   (git grep will show you checks for __sun in a bunch of other
Mesa files already.  All compilers support __sun, gcc also provides __sun__
to fit in with it's normal naming scheme.)

-- 
	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc


More information about the mesa-dev mailing list