TODO: Find out why _display_get_fmt_n()` is so broken...
TODO: Make `_display_get_fmt()` a function alias instead of macro definition
Fixed `deprecated` macro conflicts with attribute usage. (renamed to `_deprecated`)
Fortune for naka's current commit: Half blessing − 半吉
These bound `dest` and `src`, so will assure no OOB writes *and* no OOB reads.
Functions prototyped only, (not yet implemented.)
Fortune for naka's current commit: Middle blessing − 中吉
#define TRANSMUTE(val, type) ({ union _trans { var(val) input; type output; }; \
_Static_assert(sizeof(var(val))==sizeof(type),"Cannot transmute values of different sizes"); \
_Static_assert(sizeof(union_trans)==sizeof(type),"Cannot transmute values of different sizes"); \
/* XXX: Do we need do check this for equality? Can we re-word it or do we even need it at all? _Static_assert(_Alignof(union _trans) == _Alignof(type), "Cannot transmute values of different alignments");*/ \
//TODO: This probably won't work. Write wrappers for strncpy(), strncat() that return number of bytes written isntead of useless pointer that we already have.
usizew=s_strncpy_n(str,n,fmts[!!matched],n);// SAFETY: Will never read past `fmts[x]` nul-terminator, so setting n as both dest and src length here is safe.
//TODO: Fix this... It isn't working...
#define ADDSTR(s) do { \
debug_assert((s)); \
w=MINv(s_strncat_n(str,n,(s),n),n); \
/* Remove written from `n` */ \
n-=w; \
/* Check if we have written into the limit (if so, w will be equal to n above, since w is high-bounded to n by `MINv()` above. So if n is 0, we have hit the limit. */ \
ifU(!n){ \
/*XXX: Should this be `str[w-1]?` If this assert fails then yes it should. */ \