Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

conditional fields of constexpr literal structs - #989

#989
Merged
emilio merged 2 commits into
mozilla:mastermozilla/cbindgen:masterfrom
youknowone:constexpr-conditional-fieldyouknowone/cbindgen:constexpr-conditional-fieldCopy head branch name to clipboard
May 20, 2025
Merged

conditional fields of constexpr literal structs#989
emilio merged 2 commits into
mozilla:mastermozilla/cbindgen:masterfrom
youknowone:constexpr-conditional-fieldyouknowone/cbindgen:constexpr-conditional-fieldCopy head branch name to clipboard

Conversation

@youknowone

Copy link
Copy Markdown
Contributor

Partially fix #955 about constexpr

#988 is included in this PR

Because constexpr and defines require very different approach about this problem, I created another PR for constexpr fix while keeping the other one for define fix.

@youknowone youknowone changed the title Constexpr conditional field conditional fields of constexpr literal structs Aug 10, 2024
@youknowone
youknowone force-pushed the constexpr-conditional-field branch from b890eef to ddd17f7 Compare August 12, 2024 12:47

@emilio emilio left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's do this, just some nits about whitespace, but looks good.

Comment thread src/bindgen/language_backend/clike.rs Outdated
write!(out, "/* .{} = */ ", ordered_key);
self.write_literal(out, &lit.value);
if i + 1 != ordered_fields.len() {
write!(out, ", ");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This adds trailing white-space, please remove the space if is_constexpr?

Comment thread src/bindgen/language_backend/clike.rs Outdated
write!(out, "{}", export_name);
}

write!(out, "{{ ");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same, this space needs to be removed.

@emilio

emilio commented Oct 27, 2024

Copy link
Copy Markdown
Collaborator

Sorry for the lag getting to this btw :(

@youknowone
youknowone force-pushed the constexpr-conditional-field branch from ddd17f7 to df9f46e Compare October 28, 2024 06:57
@youknowone

Copy link
Copy Markdown
Contributor Author

@emilio Thank you for the review! I updated the both PRs

@emilio
emilio force-pushed the constexpr-conditional-field branch from df9f46e to 62c856f Compare October 28, 2024 15:09
@emilio

emilio commented Oct 28, 2024

Copy link
Copy Markdown
Collaborator

Could you rebase this please? Thanks!

@youknowone
youknowone force-pushed the constexpr-conditional-field branch from 62c856f to cea2ef2 Compare October 29, 2024 07:55
@youknowone

Copy link
Copy Markdown
Contributor Author

rebased

@youknowone

Copy link
Copy Markdown
Contributor Author

@emilio Could you check it again?

@youknowone
youknowone marked this pull request as draft November 4, 2024 04:21
@youknowone
youknowone force-pushed the constexpr-conditional-field branch from cea2ef2 to 2ed778c Compare November 4, 2024 04:45
@youknowone
youknowone marked this pull request as ready for review November 4, 2024 04:45
@youknowone

Copy link
Copy Markdown
Contributor Author

I updated my local patch to this branch. It worked well for the project.

@youknowone

Copy link
Copy Markdown
Contributor Author

@emilio is there any blocker?

@youknowone

youknowone commented Mar 6, 2025

Copy link
Copy Markdown
Contributor Author

@emilio reminding

@youknowone
youknowone force-pushed the constexpr-conditional-field branch from 2ed778c to 64c80d2 Compare March 26, 2025 02:15
@youknowone

Copy link
Copy Markdown
Contributor Author

rebased

@youknowone

Copy link
Copy Markdown
Contributor Author

@emilio reminding when you come back

@emilio

emilio commented May 20, 2025

Copy link
Copy Markdown
Collaborator

Thaks for the ping!

@emilio
emilio added this pull request to the merge queue May 20, 2025
Merged via the queue into mozilla:master with commit 14fa2d0 May 20, 2025
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.

defines is not applied for impl const

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.