aboutsummaryrefslogblamecommitdiff
path: root/lib/include/common.h
blob: 631c25ff15fd6b0f04363f1507c0278615e74b30 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13




                                     







                                                                                
               
// Copyright (c) 2020 Johannes Stoelp

#pragma once

#include "io.h"
#include "syscalls.h"

#define ERROR_ON(cond, fmt, ...)                                               \
    do {                                                                       \
        if ((cond)) {                                                          \
            efmt("%s:%d " fmt, __FILE__, __LINE__ __VA_OPT__(, ) __VA_ARGS__); \
            _exit(1);                                                          \
        }                                                                      \
    } while (0)