During the integration of the libcanard into a project based on ChibiOS 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".
During the integration of the
libcanard
into a project based on ChibiOS I want to changeCANARD_ASSERT
from the defaultassert
to ChibiOSosalDbgCheck
. 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 unutilizedCANARD_CONFIG_HEADER
by providing acanard_config.h
file with the following content:But because of
#include "_canard_cavl.h"
and# include CANARD_CONFIG_HEADER
order incanard.c
I still get implicit declaration warnings:To resolve this issue
# include CANARD_CONFIG_HEADER
must be placed before#include "_canard_cavl.h"
.