Cower all bases
[llpp.git] / cutils.h
blobf7f49e7c84fa10311ef59a7aa48d5a6c4daac020
1 #ifndef CUTILS_H
2 #define CUTILS_H
4 #if defined __GNUC__
5 #define UNUSED_ATTR __attribute__ ((unused))
6 #if !defined __clang__
7 #define NO_OPTIMIZE_ATTR __attribute__ ((optimize ("O0")))
8 #else
9 #define NO_OPTIMIZE_ATTR __attribute__ ((optnone))
10 #endif
11 #define GCC_FMT_ATTR(a, b) __attribute__ ((format (printf, a, b)))
12 #else
13 #error Stringent C compiler requirements not satisfied
14 #endif
16 extern _Noreturn void GCC_FMT_ATTR (3, 4)
17 err (int errno_val, int exitcode, const char *fmt, ...);
18 extern _Noreturn void GCC_FMT_ATTR (2, 3)
19 errx (int exitcode, const char *fmt, ...);
20 extern void *parse_pointer (const char *cap, const char *s);
21 extern double now (void);
22 extern void fmt_linkn (char *s, const char *c, unsigned int l, int n);
24 #endif