summaryrefslogtreecommitdiffstats
path: root/src/lisiblestd/assert.h
blob: 7a9ce46621a231c14c6ae0f94b6fcfa8c88bdbf8 (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(LogLevel_Error, "Assertion failed:\n\t%s", #expr);                   \
      exit(1);                                                                 \
    }                                                                          \
  } while (0)

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

#endif // LSTD_ASSERT_H
Go back to lisible.xyz