3515
|
|
|
tg |
5 months ago
|
|
|
3514
|
|
|
tg |
5 months ago
|
|
|
3513
|
|
|
tg |
5 months ago
|
|
|
3512
|
|
|
tg |
6 months ago
|
|
|
3511
|
|
|
tg |
5 months ago
|
|
|
3510
|
|
FAM overhaul, prodded by Jens Gustedt
via: https://digitalcourage.social/@JensGustedt/111186421403499035
mbsdint.h: • assign mbiSIZE_MAX to mbccSIZE_MAX once we have determined it (note loading mbsdint.h is also good near mbsdcc.h top)
mbsdcc.h: • move offsetof monkey-fix here from mksh/sh.h (for old klibc/dietlibc on GCC or NWCC (Nils Weller’s) where it’s broken and we can just redirect to the compiler builtin); safe since <stddef.h> was just read • introduce mbccSIZE_MAX and document at the beginning that including <basetsd.h> or <limits.h> first is useful • introduce mbccABEND(msg) which users are supposed to provide/override, not call, but which we can call from within our “run-time” macros • introduce mbccChkExpr(x) which is a sort of compile-time check that works within an expression / function-like cpp macro, even on CFrustFrust (boy t̲h̲a̲t̲ was hard) and evaluates to 0 • add mbccCEX(x) which ensures its argument is compile-time constant (and which itself also is); we do not need the Linux __is_constexpr but a compile error here • rename mbccFAM to mbccFAMslot • add mbccFAMSZ (compile-time) and mbccFAMsz (run-time) to calculate the minimum length of an object for a struct with a FAM of the given size ‣ arguments: struct foo, member, size-in-chars ‣ size-in-chars is mbccCEX’d by mbccFAMSZ so it’s usable in definitions like a storage union itself ‣ the return value of mbccFAMSZ/mbccFAMsz, size_t, is roughly the same as the offsetof method recommended before, but (by Jens) has a lower bound of sizeof(struc), so its trailing padding will be guaranteed to be present if the FAM is tiny enough ‣ also, check that sizeof(struc) + size-in-chars fits mbccSIZE_MAX → compile-time for mbccFAMSZ → run-time with mbccABEND for mbccFAMsz this also came from mksh (checkoktoadd etm.) • add more FAM examples: ‣ nōn-char type, with sizeof(type[cnt]) which while feeling unnatural has a lower chance of corner cases than sizeof(type) * (size_t)cnt… ‣ storage union
mkt-int.sh (testsuite): extend accordingly where plausible ‣ at some point we’ll want to add “negative tests”, i.e. tests for where compilation must error out…
mksh: • change most offsetof to mbccFAMSZ where possible else mbccFAMsz ‣ 1 → 1U etc. while here ‣ also, alloc1 → alloc where suitable, given mbccFAMsz also checks now • tempfile pathname template string cleanup while here • follow mbccFAMslot renaming • provide kerrf-based mbccABEND
|
tg |
5 months ago
|
|
|
3509
|
|
|
tg |
6 months ago
|
|
|
3508
|
|
|
tg |
6 months ago
|
|
|
3507
|
|
|
tg |
6 months ago
|
|
|
3506
|
|
|
tg |
6 months ago
|
|
|
3505
|
|
|
tg |
6 months ago
|
|
|
3504
|
|
|
tg |
6 months ago
|
|
|
3503
|
|
|
tg |
6 months ago
|
|
|
3502
|
|
|
tg |
6 months ago
|
|
|
3501
|
|
|
tg |
6 months ago
|
|
|
3500
|
|
|
tg |
6 months ago
|
|
|
3499
|
|
|
tg |
6 months ago
|
|
|
3498
|
|
|
tg |
6 months ago
|
|
|
3497
|
|
|
tg |
6 months ago
|
|
|
3496
|
|
|
tg |
7 months ago
|
|
|