Skip to content

Commit

Permalink
libspdm: add extern fn type checking
Browse files Browse the repository at this point in the history
We don't generate errors or warnings if the function signatures we implement
don't match the version in libspdm. So far this has been ok as libspdm only
appended arguments, but in the future this could cause breakages.

There doesn't appear to be any reasonable way to assert that our
function matches the bindgen version.

This patch adds a macro that can compare a provided function type, to
it's bindgen generated type upon expansion. When using this macro, the
first argument shall specify the local type, that is, the type of the
function as defined within `spdm-utils`. Upon expansion, the macro will
type check bindgen generated function against the provided type.

All of this shall run only in a `test` context, with no runtime
overhead. CI should catch any future failures if `libspdm` has changed.

Signed-off-by: Alistair Francis <[email protected]>
Signed-off-by: Wilfred Mallawa <[email protected]>
  • Loading branch information
twilfredo committed Jul 24, 2024
1 parent 9ca9cdc commit f5efd59
Showing 1 changed file with 166 additions and 154 deletions.
Loading

0 comments on commit f5efd59

Please sign in to comment.