[Mesa-dev] [PATCH:mesa 2/4] Avoid fighting with Solaris headers over isnormal()

Ian Romanick idr at freedesktop.org
Tue Feb 17 15:04:49 PST 2015


On 02/17/2015 02:12 PM, Matt Turner wrote:
> On Tue, Feb 17, 2015 at 1:59 PM, Connor Abbott <cwabbott0 at gmail.com> wrote:
>> On Tue, Feb 17, 2015 at 4:41 PM, Alan Coopersmith
>> <alan.coopersmith at oracle.com> wrote:
>>> On 02/17/15 10:21 AM, Emil Velikov wrote:
>>>>
>>>> Hi Alan,
>>>>
>>>> On 16/02/15 02:41, Alan Coopersmith wrote:
>>>>>
>>>>> When compiling in C99 or C++11 modes, Solaris defines isnormal() as
>>>>> a macro via <math.h>, which causes the function definition to become
>>>>> too mangled to compile.
>>>>>
>>>> Is this series sufficient to get mesa working again with Solaris ?
>>>
>>>
>>> No.  There are still two problems in src/glsl/nir/nir.h:
>>>
>>> 1) #pragma once needs to be replaced with a traditional header guard.
>>>    Since gcc listed #pragma once as deprecated, the Solaris Studio
>>>    compiler team decided it wasn't worth supporting, and this header
>>>    causes failures if it's included twice.  (None of the other #pragma
>>>    once headers seem to cause problems in the build.)
>>>
>>> @@ -25,6 +25,9 @@
>>>   *
>>>   */
>>>
>>> +#ifndef __NIR_H__
>>> +#define __NIR_H__
>>> +
>>>  #pragma once
>>
>> Need to actually remove the pragma? I'm fine with this, using the
>> pragma was a silly idea anyways since no one else uses it. I wish it
>> were used more generally though.
> 
> I don't think so. We use #pragma once in lots of other places (it
> typically goes before the #ifndef include guard). I think there was
> some indication that when supported it improves compile speed over an
> include guard.

I think I'm the one that started it... and I think that was the reason.
 Specifically,
https://gcc.gnu.org/onlinedocs/gcc-3.1/cpp/Obsolete-once-only-headers.html
says:

    "If #pragma once is seen when scanning a header file, that file
    will never be read again, no matter what."

Though with small .h files and fast SSDs, I don't know how much
difference it really makes.

> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list