Skip to content

Fix dangling implicit derives #703

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

Merged
merged 1 commit into from
Dec 29, 2022
Merged

Conversation

n8tlarsen
Copy link
Contributor

While working on R7FA6M5BH.svd I found that the generated code does not compile because P0%sPFS_BY got thrown away while implicitly deriving registers. Looking through the debug log I found this:

[DEBUG svd2rust::generate::device] Rendering peripheral PFS
[DEBUG svd2rust::generate::peripheral] Checking derivation information
[DEBUG svd2rust::generate::peripheral] register P009PFS_BY implicitly derives from P00%sPFS_BY
[DEBUG svd2rust::generate::peripheral] register P010PFS implicitly derives from P0%sPFS
[DEBUG svd2rust::generate::peripheral] register P010PFS_HA implicitly derives from P0%sPFS_HA
[DEBUG svd2rust::generate::peripheral] register P010PFS_BY implicitly derives from P0%sPFS_BY
[DEBUG svd2rust::generate::peripheral] register P0%sPFS_BY implicitly derives from P00%sPFS_BY
[DEBUG svd2rust::generate::peripheral] register P200PFS implicitly derives from P20%sPFS
[DEBUG svd2rust::generate::peripheral] register P200PFS_HA implicitly derives from P20%sPFS_HA
[DEBUG svd2rust::generate::peripheral] register P200PFS_BY implicitly derives from P20%sPFS_BY
[DEBUG svd2rust::generate::peripheral] register P2%sPFS implicitly derives from P20%sPFS
[DEBUG svd2rust::generate::peripheral] register P2%sPFS_HA implicitly derives from P20%sPFS_HA
[DEBUG svd2rust::generate::peripheral] register P2%sPFS_BY implicitly derives from P20%sPFS_BY
[DEBUG svd2rust::generate::peripheral] register P70%sPFS implicitly derives from P70%sPFS
[DEBUG svd2rust::generate::peripheral] register P70%sPFS_HA implicitly derives from P70%sPFS_HA
[DEBUG svd2rust::generate::peripheral] register P70%sPFS_BY implicitly derives from P70%sPFS_BY
[DEBUG svd2rust::generate::peripheral] register P90%sPFS implicitly derives from P90%sPFS
[DEBUG svd2rust::generate::peripheral] register P90%sPFS_HA implicitly derives from P90%sPFS_HA
[DEBUG svd2rust::generate::peripheral] register P90%sPFS_BY implicitly derives from P90%sPFS_BY
[DEBUG svd2rust::generate::peripheral] register PA0%sPFS implicitly derives from PA0%sPFS
[DEBUG svd2rust::generate::peripheral] register PA0%sPFS_HA implicitly derives from PA0%sPFS_HA
[DEBUG svd2rust::generate::peripheral] register PA0%sPFS_BY implicitly derives from PA0%sPFS_BY
[DEBUG svd2rust::generate::peripheral] register P%sSAR implicitly derives from P%sSAR
[DEBUG svd2rust::generate::peripheral] Pushing cluster & register information into output
[DEBUG svd2rust::generate::peripheral] Pushing 95 register or cluster blocks into output

P010PFS_BY implicitly derives from P0%sPFS_BY and P0%sPFS_BY implicitly derives from P00%sPFS_BY, which leaves P0%sPFS_BY dangling (P0%sPFS_BY regex matched to P009PFS_BY and implicitly derived from the root P00%sPFS_BY). The fix checks for would-be dangling derives while checking previous names against the "P0%sPFS_BY" regex, and replaces the derive with the new root.

@n8tlarsen n8tlarsen requested a review from a team as a code owner December 28, 2022 22:23
@n8tlarsen
Copy link
Contributor Author

r? @Emilgardis

Copy link
Member

@Emilgardis Emilgardis left a comment

Choose a reason for hiding this comment

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

bors r+

thanks!

@bors
Copy link
Contributor

bors bot commented Dec 29, 2022

Build succeeded:

@bors bors bot merged commit 6a9a0f5 into rust-embedded:master Dec 29, 2022
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.

2 participants