Skip to content

Conversation

@romancardenas
Copy link
Contributor

This PR is part of the rework for procedural macros of the RISC-V crates. Basically, it migrates riscv_rt_macros::post_init to riscv_macros::post_init.

The behavior of the macro remains mainly identical. However, I worked on a more modular implementation, with the idea of reusing as much code as possible once this PR is merged and we move entry, exception, etc. Hopefully, it will be easier in the future to maintain all the riscv-rt macros :)

I also modified the multi-hart QEMU example to illustrate how the macro works (and assert that it works properly).

Let me know what you think!

@romancardenas romancardenas requested a review from a team as a code owner January 11, 2026 17:58
@romancardenas romancardenas force-pushed the riscv-macros branch 6 times, most recently from 679bfff to 9f1b655 Compare January 16, 2026 11:16
);

#[entry]
fn main(hartid: usize) -> ! {
Copy link
Contributor

@rmsyn rmsyn Jan 16, 2026

Choose a reason for hiding this comment

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

Thanks for adding this test case to the QEMU test suite.

Maybe add cases for positive/negative results for each of the check_* functions to the test-trybuild suite?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! There are already a few, but I am also thinking on a new error handling mechanism for these macros that stores multiple errors and throws them in batch. In this way, developers will able to see all the errors with just one attempt

@romancardenas
Copy link
Contributor Author

@rmsyn check it out, I think the new error handling is way better than in previous versions!

@romancardenas
Copy link
Contributor Author

(of course Rust 1.93 came with new clippy lints and compile error messages that broke our CI...)

@romancardenas romancardenas force-pushed the riscv-macros branch 2 times, most recently from d08b712 to 79c47a6 Compare January 23, 2026 20:02
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.

3 participants