Skip to content

Commit c5b5226

Browse files
committed
test: add regression test for issue #3319
Add test verifying structs with unknown attributes (CXCursor_UnexposedAttr) do not generate layout tests that could fail at compile time on some platforms.
1 parent 5ae4b31 commit c5b5226

3 files changed

Lines changed: 28 additions & 0 deletions

File tree

bindgen-tests/tests/expectations/tests/issue-3319-unknown-attr.rs

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/libclang-16/issue-3319-unknown-attr.rs

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// This test verifies that structs with unknown attributes (CXCursor_UnexposedAttr)
2+
// do not generate incorrect layout assertions that would fail at compile time.
3+
//
4+
// The found_unknown_attr flag is set when bindgen encounters attributes it cannot
5+
// fully interpret, which may affect layout in ways bindgen cannot predict.
6+
//
7+
// See: https://github.com/rust-lang/rust-bindgen/issues/3319
8+
9+
// __ms_struct__ is an attribute that triggers CXCursor_UnexposedAttr
10+
// and sets found_unknown_attr = true
11+
struct __attribute__((__ms_struct__)) StructWithUnknownAttr {
12+
int x;
13+
double y;
14+
};

0 commit comments

Comments
 (0)