mirror of
https://github.com/lvgl/lvgl.git
synced 2026-09-27 18:34:13 +08:00
docs(copilot): add usage of lv_assert for public api contract (#10301)
This commit is contained in:
@@ -15,10 +15,13 @@ Code must be portable, memory-efficient, and bare-metal safe.
|
|||||||
- Test headers included in production source (`#include "lv_test_..."` in `src/`)
|
- Test headers included in production source (`#include "lv_test_..."` in `src/`)
|
||||||
- Missing `LV_CHECK_ARG(...)` on arguments of public API functions
|
- Missing `LV_CHECK_ARG(...)` on arguments of public API functions
|
||||||
- Missing `LV_CHECK_OBJ(obj, cls, action)` for `lv_obj_t *`/`const lv_obj_t *` parameters in public API functions
|
- Missing `LV_CHECK_OBJ(obj, cls, action)` for `lv_obj_t *`/`const lv_obj_t *` parameters in public API functions
|
||||||
|
- `LV_ASSERT*` for public API function arguments. Instead the user must use `LV_CHECK_ARG` or `LV_CHECK_OBJ` based on the points above
|
||||||
|
|
||||||
## Argument Checking Contract
|
## Argument Checking Contract
|
||||||
|
|
||||||
- Public API functions use `LV_CHECK_ARG`/`LV_CHECK_OBJ` as the sole argument-safety mechanism
|
- Public API functions use `LV_CHECK_ARG`/`LV_CHECK_OBJ` as the sole argument-safety mechanism
|
||||||
- When `LV_USE_CHECK_ARG=0` checks compile out by design. Do not flag missing unconditional `NULL` guards; passing invalid args with checks disabled is caller undefined behavior, not a library defect
|
- When `LV_USE_CHECK_ARG=0` checks compile out by design. Do not flag missing unconditional `NULL` guards; passing invalid args with checks disabled is caller undefined behavior, not a library defect
|
||||||
|
- `LV_ASSERT*` must not be used for this purpose
|
||||||
|
|
||||||
## Embedded Performance (flag in hot paths)
|
## Embedded Performance (flag in hot paths)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user