]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
The cmocka.h header MUST be included before isc/util.h gets included
authorOndřej Surý <ondrej@sury.org>
Tue, 1 Dec 2020 14:08:49 +0000 (15:08 +0100)
committerOndřej Surý <ondrej@sury.org>
Wed, 9 Dec 2020 09:46:16 +0000 (10:46 +0100)
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.

(cherry picked from commit 0ba697fe8c3a05fc7723529fa20ea9c7865e5b6c)

lib/isc/tests/task_test.c

index 9cbe1c99c69ebb0de6c439bff1e1eb2a83616af9..f4a44a12c57aeb6e3905925c98c093d8b83c60ad 100644 (file)
@@ -23,6 +23,8 @@
 
 #define UNIT_TESTING
 
+#include <cmocka.h>
+
 #include <isc/atomic.h>
 #include <isc/cmocka.h>
 #include <isc/commandline.h>