This introduces the CMOCKA_NORETURN macro which adds the
__attribute__((noreturn)) attribute to non-returning functions. In
Windows, __declspec(noreturn) is added instead.
Functions that don't return but are not marked with the attribute can
confuse static analysers, making them to report false positives.
Add CMOCKA_NORETURN attribute to _fail(), _skip(), and to the internal
exception_handler().
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Removes a undefined behaviour (uint underflow) happening when freeing a
value. Fortunately this undefined behaviour has no effect on the
program. It only manifests itself when cmocka is compiled using
clangs undefined behaviour sanitizer.
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
The internal targets use 'target_link_libraries' with cmocka::cmocka and
so should external users of the lib.
Fixes: e4c51ce ("cmake: Export cmake config for cmocka")
Signed-off-by: Alexander Dahl <post@lespocky.de>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Add a call to check_type_size in ConfigureChecks.cmake and use it in
include/cmocka.h to avoid the following redefinition error on riscv64:
In file included from /data/buildroot/buildroot-test/instance-0/output/build/cmocka-1.1.5/src/cmocka.c:62:
/data/buildroot/buildroot-test/instance-0/output/build/cmocka-1.1.5/include/cmocka.h:132:28: error: conflicting types for 'uintptr_t'
typedef unsigned int uintptr_t;
^~~~~~~~~
In file included from /data/buildroot/buildroot-test/instance-0/output/host/riscv64-buildroot-linux-musl/sysroot/usr/include/stdint.h:20,
from /data/buildroot/buildroot-test/instance-0/output/host/riscv64-buildroot-linux-musl/sysroot/usr/include/inttypes.h:9,
from /data/buildroot/buildroot-test/instance-0/output/build/cmocka-1.1.5/src/cmocka.c:27:
/data/buildroot/buildroot-test/instance-0/output/host/riscv64-buildroot-linux-musl/sysroot/usr/include/bits/alltypes.h:104:24: note: previous declaration of 'uintptr_t' was here
typedef unsigned _Addr uintptr_t;
^~~~~~~~~
Fixes:
- http://autobuild.buildroot.org/results/30922c18150ea62aefe123d1b7cd1444efab963f
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Fixes the following MSVC warning:
warning C4244: '=': conversion from 'time_t' to 'double',
possible loss of data
Signed-off-by: Paolo Teti <paolo.teti@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Fixes the following warning:
warning C4267: 'return': conversion from 'size_t' to 'int',
possible loss of data
Signed-off-by: Paolo Teti <paolo.teti@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Attemp to fix 'Exit code 0xc0000139' (DLL not found) when running tests.
Signed-off-by: Paolo Teti <paolo.teti@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Some compilers already define this macro in standard
libary headers, for example GCC for Xtensa
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
The introduced cmocka_set_skip_filter() allows setting a filter for
tests to be skipped. It supports the same wildcards allowed for
cmocka_set_test_filter() (i.e. '*' or '?').
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>