Skip to content

How do I mark a struct variable volatile? #960

Open
@flaviojs

Description

@flaviojs

I am converting code from C to rust.
There is too much code so the transition must be done in steps.
Some struct variables have the volatile modifier, so I have to find a way to generate struct variables with volatile to ensure the C code behaves the same during the transition and everything can be tested.

On the rust side volatile behavior is achieved by using read_volatile/write_volatile manually or with a wrapper.
On the C side the variables must have the volatile modifier or I must cast every singe use of the variable to a volatile type (untested).

I am looking for a solution that avoids having to modify the original C code.
The ideal solution would be cbindgen generating the volatile modifier in specific struct variables, which allows me to change the structure at a later stage while ensuring the remaining C code behaves the same.

So, how do I mark a struct variable volatile?

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