Merge pull request 'Document libc wrapper contract' (#30) from 9 into main
All checks were successful
All checks were successful
Reviewed-on: #30
This commit was merged in pull request #30.
This commit is contained in:
@@ -76,6 +76,10 @@ return convention and the `PREPARE_ERROR` / `FAIL_*` / `SUCCEED_RETURN` pattern.
|
||||
Four conventions hold across the whole library, and a new wrapper that breaks one
|
||||
of them is wrong even if it compiles and passes:
|
||||
|
||||
- **Preserve the libc contract unless there is a compelling, documented reason
|
||||
not to.** libc behaviour is the standard to meet. This library changes only
|
||||
the error transport (to `akerror`) and, where libc returns a value, the result
|
||||
shape (through a caller-provided destination pointer).
|
||||
- **A NULL out-param is a caller error**, not "don't care".
|
||||
- **Finding nothing is success** -- searching functions write NULL or zero and
|
||||
return NULL.
|
||||
@@ -93,6 +97,11 @@ The build is `-Wall -Wextra` and CI adds `-Werror`. `-Wpedantic` is deliberately
|
||||
off: libakerror's `FAIL_*` macros trip "ISO C99 requires at least one argument
|
||||
for the ..." on their own expansion, not on anything at the call site.
|
||||
|
||||
**Do not wrap a libc function that cannot fail and provides no failure or
|
||||
operation-status result.** There is no `akerror` context to carry. A value such
|
||||
as `umask()`'s previous mask is not an operation-status result, so `umask()` is
|
||||
not a wrapper candidate.
|
||||
|
||||
## Testing Guidelines
|
||||
|
||||
Add a new test by creating `tests/test_mything.c` and adding `mything` to the
|
||||
|
||||
Reference in New Issue
Block a user