aboutsummaryrefslogtreecommitdiff
path: root/src/std/assert.h
blob: aa62bd187629c17bf69ee830055895ea478bc02c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

#pragma once

#include <stdio.h>
#include <stdlib.h>

#define assert(condition, ...)                                                 \
    do {                                                                       \
        if (!(condition)) {                                                    \
            fprintf(stderr, "Assertion failed: %s:%d in %s(): ", __FILE__,     \
                    __LINE__, __func__);                                       \
            fprintf(stderr, __VA_ARGS__);                                      \
            fprintf(stderr, "\n");                                             \
            abort();                                                           \
        }                                                                      \
    } while (0)