Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a style guideline for conditional compilation #10144

Merged

Conversation

alexcrichton
Copy link
Member

I've been doing a fair amount of work recently that's touched on #[cfg] in many ways throughout Wasmtime. I've personally got opinions about how to structure everything as well, and these opinions are not always obvious to others or discerned from just reading snippets. To assist with this I figured it would be nice to have a style guideline for Wasmtime's conditionally compiled code explaining at least at a high level what's going on and some rough basic principles.

I've attempted to give this a stab and have added a page to the contributing documentation about the style guidelines for conditional compilation. I'm sure I've forgotten something here but my hope is that we can evolve this over time.

I've been doing a fair amount of work recently that's touched on
`#[cfg]` in many ways throughout Wasmtime. I've personally got opinions
about how to structure everything as well, and these opinions are not
always obvious to others or discerned from just reading snippets. To
assist with this I figured it would be nice to have a style guideline
for Wasmtime's conditionally compiled code explaining at least at a high
level what's going on and some rough basic principles.

I've attempted to give this a stab and have added a page to the
contributing documentation about the style guidelines for conditional
compilation. I'm sure I've forgotten something here but my hope is that
we can evolve this over time.
@alexcrichton alexcrichton requested a review from a team as a code owner January 28, 2025 23:00
@alexcrichton alexcrichton requested review from cfallin and removed request for a team January 28, 2025 23:00
Copy link
Member

@cfallin cfallin left a comment

Choose a reason for hiding this comment

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

Thanks for writing this up!

docs/contributing-conditional-compilation.md Outdated Show resolved Hide resolved
@alexcrichton alexcrichton added this pull request to the merge queue Jan 28, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 28, 2025
@github-actions github-actions bot added the wasmtime:docs Issues related to Wasmtime's documentation label Jan 29, 2025
@alexcrichton alexcrichton added this pull request to the merge queue Jan 29, 2025
Merged via the queue into bytecodealliance:main with commit 7ebb78a Jan 29, 2025
39 checks passed
@alexcrichton alexcrichton deleted the doc-conditional-compilation branch January 29, 2025 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasmtime:docs Issues related to Wasmtime's documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants