2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 05:28:00 +00:00

The cmocka.h header MUST be included before isc/util.h gets included

The isc/util.h header redefine the DbC checks (REQUIRE, INSIST, ...)  to
be cmocka "fake" assertions.  However that means that cmocka.h needs to
be included after UNIT_TESTING is defined but before isc/util.h is
included.  Because isc/util.h is included in most of the project headers
this means that the sequence MUST be:

    #define UNIT_TESTING
    #include <cmocka.h>

    #include <isc/_anything_.h>

See !2204 for other header requirements for including cmocka.h.
This commit is contained in:
Ondřej Surý 2020-12-01 15:08:49 +01:00
parent c26a2ea134
commit 0ba697fe8c

View File

@ -23,6 +23,8 @@
#define UNIT_TESTING
#include <cmocka.h>
#include <isc/atomic.h>
#include <isc/cmocka.h>
#include <isc/commandline.h>