LukeMathWalker / LukeMathWalker/cheadergen

Struct typedef is not generated

Open
#26 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
Rust
Stars
34
Forks
4
PR merge metrics
No merged PRs in 30d

Description

After #24, I was able to use cheadergen with CO2 (thanks!), and immediately noticed this:
```
#[repr(C)]
struct Foo {
x: i32,
y: i32,
}
```
Expected output:
```
typedef struct Foo {
int32_t x;
int32_t y;
} Foo;
```
Found:
```
// Empty file with some includes
```
The `Foo` will appear if I use it in a function signature, and will appear as extern struct (`typedef struct Foo Foo`) if I use it behind a pointer in a signature, so it might be intentional, but I would argue that cheadergen should always emit full struct definitions for `#[repr(C)] pub` structs, for public field it should use `name` and for private field it should use `__name`, and for `#[repr(Rust)]` structs it should emit an extern struct. What do you think?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by tracing how cheadergen handles standalone #[repr(C)] structs versus structs used in function signatures; compare the expected Foo typedef, visibility naming, and #[repr(Rust)] extern-struct behavior, then add coverage for the requested outcomes.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, rust
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.