Alias ignored when casting
arkanoid87 opened this issue · 1 comments
arkanoid87 commented
Adding this test
talias.h
#define SCARD_S_SUCCESS ((long)0x00000000)
talias.nim
doAssert SCARD_S_SUCCESS == 0
results in
futhark/tests/talias.nim(26, 6) Error: undeclared identifier: 'SCARD_S_SUCCESS'
I've faced this problem while trying to wrap this
PMunch commented
Ah, the notorious C defines. This is essentially caused by macros being a pre-processor thing and as such they don't have a representation in the Clang translation unit output. So Øpir resorts to just parsing the value itself: https://github.com/PMunch/futhark/blob/master/src/opir.nim#L323-L368. So to fix this it's just a matter of improving the capabilities of that parser to support casting to long.