Commit 6a9a0f5
Merge #703
703: Fix dangling implicit derives r=Emilgardis a=n8tlarsen
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.
Co-authored-by: Nathan <n8tlarsen@gmail.com>2 files changed
+17
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
859 | 859 | | |
860 | 860 | | |
861 | 861 | | |
862 | | - | |
| 862 | + | |
863 | 863 | | |
864 | 864 | | |
865 | 865 | | |
| |||
913 | 913 | | |
914 | 914 | | |
915 | 915 | | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
916 | 931 | | |
917 | 932 | | |
918 | 933 | | |
| |||
0 commit comments