Coverage Report

Created: 2024-05-03 06:05

/builds/xfbs/passgen/include/passgen/assert.h
Line
Count
Source (jump to first uncovered line)
1
/// @file assert.h
2
/// @author Patrick M. Elsen
3
/// @brief Assertions for debug builds.
4
#pragma once
5
#include <passgen/config.h>
6
#include <stddef.h>
7
8
#ifdef PASSGEN_DEBUG
9
/// Assertion, enabled in debug build.
10
#define passgen_assert(cond) \
11
5.19M
    if(!(cond)) 
passgen_assert_fail(#cond, __FILE__, __func__, __LINE__)0
12
#else
13
/// Assertion, disabled in release build.
14
#define passgen_assert(cond) (void) (cond)
15
#endif
16
17
/// Prints assertion failure and optionally backtrace.
18
void passgen_assert_fail(
19
    const char *cond,
20
    const char *file,
21
    const char *func,
22
    size_t line);
23
24
/// Static assertion.
25
#define passgen_static_assert(x) _Static_assert(x)