envelope-project / laik

Other
9 stars 8 forks source link

src/core.c: Cast the log level to the correct type before storing it. #140

Closed AlexanderKurtz closed 6 years ago

AlexanderKurtz commented 6 years ago

This fixes a warning emitted by ICC about incompatible enums (ICC warning #188).

weidendo commented 6 years ago
            (Laik_DataFlow)((int)LAIK_DF_ReduceOut | (int)LAIK_DF_Sum));

Hm. I do not like this stuff for a C-API. It assumes that enums fit into ints, and the casts throw away any warnings. So we can just use ints in the first place.

twittidai commented 6 years ago

This stuff is tricky, I still have this code to make the MLEM LAIK work. This seems to be the same issue. I don't like this stuff too. Why not declare them as Integer

// C++ additions to LAIK header inline Laik_DataFlow operator|(Laik_DataFlow a, Laik_DataFlow b) { return static_cast(static_cast(a) | static_cast(b)); }

This need to be addressed!

weidendo commented 6 years ago

Yes, this is crazy. Just let's go for "int". I already did this yesterday for the log levels.

AlexanderKurtz commented 6 years ago

Hey, I just saw commit 1e762135f342f8fb8c79c7d34765be8618f21836, sorry about that. With that in place, isn't this PR wrong (and should be reverted now that it has been merged)?

weidendo commented 6 years ago

You are right. I reverted the PR.