forked from rui314/8cc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patherror.h
29 lines (22 loc) · 854 Bytes
/
error.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
// Copyright 2012 Rui Ueyama <[email protected]>
// This program is free software licensed under the MIT license.
#ifndef EIGHTCC_UTIL_H
#define EIGHTCC_UTIL_H
#define error(...) \
errorf(__FILE__, __LINE__, __VA_ARGS__)
#define warn(...) \
warnf(__FILE__, __LINE__, __VA_ARGS__)
#define assert(expr) \
do { \
if (!(expr)) error("Assertion failed: " #expr); \
} while (0)
#ifndef __8cc__
#define NORETURN __attribute__((noreturn))
#else
#define NORETURN
#endif
extern void errorf(char *file, int line, char *fmt, ...) NORETURN;
extern void warnf(char *file, int line, char *fmt, ...);
extern char *quote_cstring(char *p);
extern char *quote_char(char c);
#endif /* EIGHTCC_UTIL_H */