Skip to content

Should we panic on unbound typedefs? #1050

@dschrempf

Description

@dschrempf

Right now, when we get the underlying type of a typedef, we panic if the typedef is not available (i.e., unbound). This happens in the function getUnderlyingType in Translation.hs.

However, there could be situations where this is actually the case. Consider the minimal example

typedef int foo;
extern const foo x;

If we do not select foo, the typedef is unavailable. At the moment, we do not emit the panic because hs-bindgen already fails earlier reporting:

$ cabal run -- hs-bindgen-cli preprocess -I ./ c.h --select-by-decl-name x
...
[Error  ] [HsBindgen] [mangle-names] Missing declaration: 'foo'; did you select the declaration?
An error happend (see above)
...

However, we should still make a conscious decision if we want to keep this panic. There is also a corresponding TODO note in the code.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingongoingIssues currently actively being worked on.priority: mediumrelease-0.1Required for the first public release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions