Skip to content

Commit 0d18c6b

Browse files
authored
Add stddef.h include in C headers (#1031)
`size_t` is used in the generated C headers, but is not guaranteed by the standard to be defined in either the `stdint.h` or `stdbool.h` headers that are unconditionally generated. This patch adds an unconditional include to `stddef.h` to address compile issues on certain standard libraries.
1 parent bec58aa commit 0d18c6b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

crates/c/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ impl WorldGenerator for C {
416416

417417
uwriteln!(h_str, "#include <stdint.h>");
418418
uwriteln!(h_str, "#include <stdbool.h>");
419+
uwriteln!(h_str, "#include <stddef.h>");
419420
for include in self.h_includes.iter() {
420421
uwriteln!(h_str, "#include {include}");
421422
}

0 commit comments

Comments
 (0)