20#ifndef WG14_RESULT_STATUS_CODE_SYSTEM_H
21#define WG14_RESULT_STATUS_CODE_SYSTEM_H
34 typedef struct WG14_RESULT_PREFIX(status_code_system_s)
42 WG14_RESULT_PREFIX(status_code_system_empty);
54 if(dstinfo.total_size >
sizeof(ret))
57 "status_code_with_payload_system_make cannot make a system code sized "
58 "%zu from an input status code sized %zu.",
59 sizeof(ret), dstinfo.total_size);
61 if(dstinfo.total_alignment > __alignof(ret))
64 "status_code_with_payload_system_make cannot make a system code aligned "
65 "%zu from an input status code aligned %zu.",
66 __alignof(ret), dstinfo.total_alignment);
68 memcpy(&ret, src, dstinfo.total_size);
74 WG14_RESULT_PREFIX(status_code_system_make_from_errc)(
81 } ret = {WG14_RESULT_PREFIX(status_code_generic_make)(errc)};
85#define STATUS_CODE_SYSTEM_MAKE_IMPL2(src, payload_size, total_size, \
87 WG14_RESULT_PREFIX(status_code_system_make) \
88 (WG14_RESULT_STATIC_ASSERT_WITHIN_EXPR( \
89 (total_size) <= sizeof(WG14_RESULT_PREFIX(status_code_system)), \
90 "cannot make a system code from a larger sized input", \
91 WG14_RESULT_STATIC_ASSERT_WITHIN_EXPR( \
92 (total_alignment) <= __alignof(WG14_RESULT_PREFIX(status_code_system)), \
93 "cannot make a system code from a more over aligned input", (src))), \
94 WG14_RESULT_PREFIX(status_code_domain_payload_info_make)( \
95 (payload_size), (total_size), (total_alignment)))
96#define STATUS_CODE_SYSTEM_MAKE_IMPL(src, ...) \
97 STATUS_CODE_SYSTEM_MAKE_IMPL2((src), __VA_ARGS__)
102#define status_code_system_make(...) \
103 STATUS_CODE_SYSTEM_MAKE_IMPL( \
104 &(__VA_ARGS__).base, STATUS_CODE_DOMAIN_PAYLOAD_INFO_INIT_INNARDS( \
105 WG14_RESULT_TYPEOF_UNQUAL((__VA_ARGS__).value)))
#define WG14_RESULT_INLINE
#define WG14_RESULT_CONSTEXPR_OR_CONST
#define WG14_RESULT_ABORTF(...)
status_code_errc
The generic error coding (POSIX)
#define status_code_system_make(...)
Make a system code from a typed input status code, this will fail if the input status cannot fit into...
Type of a payload info of a domain.
A status_code guaranteed to be able to hold any system error code in full. The payload is always an i...
Type of an untyped status code.