From bbb3e08647ca106f28f663ae7217b8d1a03e51d4 Mon Sep 17 00:00:00 2001 From: auronandace Date: Wed, 22 Apr 2026 09:56:16 +0100 Subject: [PATCH 1/2] add include guards for stdio bits in cbindgen --- src/header/stdio/cbindgen.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/header/stdio/cbindgen.toml b/src/header/stdio/cbindgen.toml index 540f3775b6..b161ee3d01 100644 --- a/src/header/stdio/cbindgen.toml +++ b/src/header/stdio/cbindgen.toml @@ -1,6 +1,9 @@ sys_includes = ["stdarg.h", "stddef.h", "stdint.h", "sys/types.h", "features.h"] include_guard = "_RELIBC_STDIO_H" trailer = """ +#ifndef _RELIBC_BITS_STDIO_H +#define _RELIBC_BITS_STDIO_H + // XXX: this is only here because cbindgen can't handle string constants #define P_tmpdir "/tmp" @@ -13,6 +16,8 @@ typedef struct FILE FILE; #define stdin stdin #define stdout stdout #define stderr stderr + +#endif // _RELIBC_BITS_STDIO_H """ language = "C" style = "Type" From 5596471e9d1939852b1eb817d027c23681f76d15 Mon Sep 17 00:00:00 2001 From: auronandace Date: Wed, 22 Apr 2026 12:33:07 +0100 Subject: [PATCH 2/2] remove duplicate typedef, silence cbindgen warning --- src/header/stdio/cbindgen.toml | 2 -- src/header/stdio/constants.rs | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/header/stdio/cbindgen.toml b/src/header/stdio/cbindgen.toml index b161ee3d01..dd80d4e7b9 100644 --- a/src/header/stdio/cbindgen.toml +++ b/src/header/stdio/cbindgen.toml @@ -7,8 +7,6 @@ trailer = """ // XXX: this is only here because cbindgen can't handle string constants #define P_tmpdir "/tmp" -typedef struct FILE FILE; - // A typedef doesn't suffice, because libgmp uses this definition to check if // STDIO was loaded. #define FILE FILE diff --git a/src/header/stdio/constants.rs b/src/header/stdio/constants.rs index d8caa0ca34..ff19da78e2 100644 --- a/src/header/stdio/constants.rs +++ b/src/header/stdio/constants.rs @@ -43,6 +43,7 @@ pub const L_tmpnam: c_int = 7; pub const TMP_MAX: int32_t = 2_147_483_647; // XXX: defined manually in cbindgen as well because it can't handle // string constants in any form AFAICT +/// cbindgen:ignore pub const P_tmpdir: &[u8; 5] = b"/tmp\0"; #[allow(non_camel_case_types)]