Skip to content

cgen: force C struct types which does not implement str() to be passed as ptr - #21054

Merged
spytheman merged 17 commits into
vlang:masterfrom
felipensp:fix_incomplete_c_struct
Mar 20, 2024
Merged

spytheman merged 17 commits into
vlang:masterfrom
felipensp:fix_incomplete_c_struct

Conversation

@felipensp

Copy link
Copy Markdown
Member

Fix #21053

@felipensp felipensp changed the title cgen: fix to_str generation for incomplete C type cgen: force C struct types to be passed as ptr str() Mar 19, 2024
@felipensp felipensp changed the title cgen: force C struct types to be passed as ptr str() cgen: force C struct types to be passed as ptr Mar 19, 2024
@felipensp felipensp changed the title cgen: force C struct types to be passed as ptr cgen: force C struct types which does not implement str() to be passed as ptr Mar 19, 2024
@felipensp
felipensp marked this pull request as ready for review March 20, 2024 11:51

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work.

}

// c_struct_ptr handles the C struct argument for .str() method
@[inline]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imho that does not need to be inline, and it does not need to be pub too. It is only called internally in the cgen module.

@spytheman
spytheman merged commit 24d1572 into vlang:master Mar 20, 2024
@felipensp
felipensp deleted the fix_incomplete_c_struct branch March 20, 2024 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cgen error with gcc, but not with tcc, for a program, printing an incomplete typedef C struct

2 participants