-
Notifications
You must be signed in to change notification settings - Fork 0
/
fail.h
31 lines (24 loc) · 1.17 KB
/
fail.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once
#include <stdio.h>
#include <stdlib.h>
#define str(x) str_(x)
#define str_(x) #x
#define print(msg) do { fputs(msg, stdout); } while (0)
#define eprint(msg) do { fputs(msg, stderr); } while (0)
#define v0(...) do { vx_(__VA_ARGS__); } while (0)
#define v1(...) do { if (verbosity >= 1) vx_(__VA_ARGS__); } while (0)
#define v2(...) do { if (verbosity >= 2) vx_(__VA_ARGS__); } while (0)
#define warning(...) do { warning_(__FILE__, __LINE__, __VA_ARGS__); } \
while (0)
#define warning_e(...) do { warning_e_(__FILE__, __LINE__, __VA_ARGS__); } \
while (0)
#define fatal(rtn, ...) do { fatal_(rtn, __FILE__, __LINE__, \
__VA_ARGS__); } while (0)
#define fatal_e(rtn, ...) do { fatal_e_(rtn, __FILE__, __LINE__, \
__VA_ARGS__); } while (0)
void vx_(const char* format, ...);
void warning_(const char* srcname, int line, const char* format, ...);
void warning_e_(const char* srcname, int line, const char* format, ...);
void fatal_(int rtn, const char* srcname, int line, const char* format, ...);
void fatal_e_(int rtn, const char* srcname, int line,
const char* format, ...);