summaryrefslogtreecommitdiffstats
path: root/src/lisiblestd/assert.h
blob: 9bd998bf04542a494fc4658b4a0c433abf54f45b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef LSTD_ASSERT_H
#define LSTD_ASSERT_H

#include "log.h"

extern void exit(int);

#define LSTD_ASSERT(expr)                                                      \
  do {                                                                         \
    if (!(expr)) {                                                             \
      LOG_ERROR("Assertion failed:\n\t%s", #expr);                             \
      exit(1);                                                                 \
    }                                                                          \
  } while (0)

#define LSTD_UNIMPLEMENTED()                                                   \
  do {                                                                         \
    LOG_ERROR("Unimplemented code reached");                                   \
    exit(1);                                                                   \
  } while (0)

#endif // LSTD_ASSERT_H
Go back to lisible.xyz