Skip to content

Commit a2346d0

Browse files
Abdallahs70keith-packard
authored andcommitted
Promote off_t type when long->4-bytes and size_t->8-bytes
To guarantee that `off_t >= size_t` As required to build fmemopen.c line 117: ` _Static_assert(sizeof(off_t) >= sizeof(size_t), "must avoid truncation");` https://github.com/picolibc/picolibc/blame/d44fa19886bad821f6004583c75bfc202cd4b156/newlib/libc/tinystdio/fmemopen.c#L117C14-L117C14 Signed-off-by: Abdallah Abdelhafeez <abdal@synopsys.com>
1 parent fb36d6c commit a2346d0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

newlib/libc/include/sys/_types.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,12 @@ typedef __uint32_t __fsfilcnt_t;
7878
#endif
7979

8080
#ifndef __machine_off_t_defined
81+
#if __SIZEOF_SIZE_T__ == 8 && __SIZEOF_LONG__ < 8
82+
typedef __uint64_t _off_t;
83+
#else
8184
typedef long _off_t;
8285
#endif
86+
#endif
8387

8488
#if defined(__XMK__)
8589
typedef signed char __pid_t;

0 commit comments

Comments
 (0)