Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce internal includes section to avoid potential implicit decla…
…ration warnings (#219) During the integration of the `libcanard` into a project based on [ChibiOS](https://www.chibios.org) I want to change `CANARD_ASSERT` from the default `assert` to ChibiOS `osalDbgCheck`. It is done with the next C defines `-DCANARD_ASSERT=osalDbgCheck -DCANARD_CONFIG_HEADER=\"${BINDINGS_DIR}/canard/canard_config.h\"`, there to prevent implicit declaration warnings I unutilized `CANARD_CONFIG_HEADER` by providing a `canard_config.h` file with the following content: ``` #include "osal.h" ``` But because of `#include "_canard_cavl.h"` and `# include CANARD_CONFIG_HEADER` order in `canard.c` I still get implicit declaration warnings: ``` Compiling canard.c ../../ext/OpenCyphal/libcanard/libcanard/_canard_cavl.h: In function 'cavlPrivateRotate': <command-line>: warning: implicit declaration of function 'osalDbgCheck' [-Wimplicit-function-declaration] ../../ext/OpenCyphal/libcanard/libcanard/_canard_cavl.h:30:25: note: in expansion of macro 'CANARD_ASSERT' 30 | # define CAVL_ASSERT CANARD_ASSERT | ^~~~~~~~~~~~~ ../../ext/OpenCyphal/libcanard/libcanard/_canard_cavl.h:98:5: note: in expansion of macro 'CAVL_ASSERT' 98 | CAVL_ASSERT((x != NULL) && (x->lr[!r] != NULL) && ((x->bf >= -1) && (x->bf <= +1))); | ^~~~~~~~~~~ ``` To resolve this issue `# include CANARD_CONFIG_HEADER` must be placed before `#include "_canard_cavl.h"`.
- Loading branch information