aboutsummaryrefslogtreecommitdiff
path: root/include/errors.h
blob: 84840103fd502da308b6ab747ca158ec03a27026 (plain) (blame)
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
#ifndef MLIB_ERRORS_H
#define MLIB_ERRORS_H

#include <stdarg.h>

[[gnu::__format__(printf, 1, 2)]] void warn(const char *, ...);
[[gnu::__format__(printf, 1, 2)]] void warnx(const char *, ...);
void vwarn(const char *, va_list);
void vwarnx(const char *, va_list);

[[__noreturn__, gnu::__format__(printf, 1, 2)]] void err(const char *, ...);
[[__noreturn__, gnu::__format__(printf, 1, 2)]] void errx(const char *, ...);
[[__noreturn__, gnu::__format__(printf, 2, 3)]] void cerr(int, const char *,
                                                          ...);
[[__noreturn__, gnu::__format__(printf, 2, 3)]] void cerrx(int, const char *,
                                                           ...);

extern const char *__mlib_errors_progname;

void mlib_setprogname(const char *);

[[gnu::__always_inline__]] static inline const char *
mlib_progname(void)
{
	return __mlib_errors_progname;
}

#endif /* !MLIB_ERRORS_H */