[Mesa-stable] [Mesa-dev] [PATCH 2/3] gallium/nouveau: use std::isfinite in c++ sources

Emil Velikov emil.l.velikov at gmail.com
Sun Oct 19 10:23:12 PDT 2014


On 19/10/14 16:59, Ilia Mirkin wrote:
> On Sun, Oct 19, 2014 at 11:41 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>> On 19/10/14 16:23, Ilia Mirkin wrote:
>>> Can you provide more detail as to why the util/u_math.h include is
>>> insufficient? Perhaps it should be fixed up similarly to how
>>> mesa/main/imports.h does it?
>>>
>> The actual error message is quite explanatory
>> external/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp:421:35:
>> *error: 'isfinite' was not declared in this scope*
>>
>> Whereas which branch of the ifdef spaghetti the compiler takes in order
>> to get there is a good question. I doubt that I'll get the chance to
> 
> Well, u_math.h actually only provides an isfinite for msvc (and
> assumes the rest will have it).
> 
>> look into it any time soon. Yet it makes sense to use C++ headers for
>> C++ code - don't you agree ?
> 
> The current contract is that u_math.h makes isfinite work. There's
> other code in the tree that uses isfinite (admittedly only in vega).
> I'd be perfectly happy with this patch if it also removed isfinite
> references from u_math.h. However as long as u_math.h provides some
> isfinite support, it should be fixed there.
> 
I believe that "contract" was made before any C++ code started using it.
>From my earlier investigation -std=c99 is not set (nor it makes sense as
we're compiling C++ code) so isfinite is not defined.

I would love to investigate and fix it properly but building for Android
is a major pain in the a**. If you have 20GiB of space + extra
processing power to contribute that would be appreciated.

-Emil
>   -ilia
> 
>>> On Sun, Oct 19, 2014 at 11:16 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>>>> From: Mauro Rossi <issor.oruam at gmail.com>
>>>>
>>>> Otherwise the android build will fail.
>>>>
>>>> Cc: "10.2 10.3" <mesa-stable at lists.freedesktop.org>
>>>> ---
>>>>  src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 8 +++-----
>>>>  1 file changed, 3 insertions(+), 5 deletions(-)
>>>>
>>>> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>>> index 719f980..b9744e3 100644
>>>> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>>> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>>> @@ -24,9 +24,7 @@
>>>>  #include "codegen/nv50_ir_target.h"
>>>>  #include "codegen/nv50_ir_build_util.h"
>>>>
>>>> -extern "C" {
>>>> -#include "util/u_math.h"
>>>> -}
>>>> +#include <cmath>
>>>>
>>>>  namespace nv50_ir {
>>>>
>>>> @@ -416,9 +414,9 @@ ConstantFolding::expr(Instruction *i,
>>>>     case OP_FMA:
>>>>     case OP_MUL:
>>>>        if (i->dnz && i->dType == TYPE_F32) {
>>>> -         if (!isfinite(a->data.f32))
>>>> +         if (!std::isfinite(a->data.f32))
>>>>              a->data.f32 = 0.0f;
>>>> -         if (!isfinite(b->data.f32))
>>>> +         if (!std::isfinite(b->data.f32))
>>>>              b->data.f32 = 0.0f;
>>>>        }
>>>>        switch (i->dType) {
>>>> --
>>>> 2.1.0
>>>>
>>>> _______________________________________________
>>>> mesa-dev mailing list
>>>> mesa-dev at lists.freedesktop.org
>>>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>



More information about the mesa-stable mailing list