Skip to content

ctest: detect improper field types #5196

Description

@tgross35

I thought we had a check for this but I guess not, given that #1020 doesn't seem to present any errors. This kind of check would be very helpful there.

E.g. for this input:

struct foo {
    int a;
};

Produce something like this test:

void check_foo_a(struct foo test_foo) {
    long test_foo_a_0 = test_foo.a;
    long *test_foo_a_1 = &test_foo.a;
}

The _1 test comparing pointers is the important bit here since it should catch -Wincompatible-pointer-types. I don't know if the _0 test will catch anything that doesn't, but it doesn't hurt.

This test can be created for both structs and unions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ctestIssues relating to the ctest crate

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions