Skip to content

RemoveUselessEnums explodes with useless enum that has no 0 variant. #54

Open
@i509VCB

Description

@i509VCB

From the MSPM0C110x SVD files, with the SYSCTL peripheral, the following enum causes a panic in !RemoveUselessEnums with the latest chiptool (57953f5)

Yes this enum is some internal testing or undefined register which TI left in their SVD files...

enum/FLBANK_SWAP:
  bit_size: 1
  variants:
  - name: YES
    description: System has a CSC.
    value: 1
  - name: NO
    description: No, system does not have a CSC.
    value: 2

I suspect the issue is that YES has a value of 1 and NO has a value of 2, which causes the transform to explode since there is no variant with a value of 0.

thread 'main' panicked at src/transform/delete_useless_enums.rs:76:69:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: core::option::unwrap_failed
   4: chiptool::transform::delete_useless_enums::DeleteUselessEnums::run
   5: chiptool::apply_transform
   6: chiptool::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions