PMunch / futhark

Automatic wrapping of C headers in Nim
MIT License
355 stars 19 forks source link

Failure to parse arrays of anonymous structs #83

Closed averne closed 9 months ago

averne commented 9 months ago

futhark fails to parse/generate code for arrays of anonymous structs.

Originally discovered when attempting to import ffnvcodec/dynlink_loader.h. image

Minimal repro:

// test.h
// ----------------
struct Test {
    struct {
        int m;
    } a[10];
};
# test.nim
# ----------------
import futhark

importc:
    "test.h"
PMunch commented 9 months ago

I added a fix in the latest commit to master. I won't bump to a new version yet as I need to add some extra checks to ensure that it doesn't mess something else up. But it should work for you, so you can install Futhark from master and test.

averne commented 9 months ago

Hi, thank you for the quick fix. I can confirm it now successfully parses both the minimal repro and the ffnvcodec header.

PMunch commented 9 months ago

Just pushed a new 0.10.0 version with the improved fix