Nomenclature
[llpp.git] / cutils.h
blob71cf46d4dad6b3ace73f31102202af95ecb7c9b5
1 #ifndef CUTILS_H
2 #define CUTILS_H
4 #define SCN_ptr SCNxPTR
5 #define FMT_ptr PRIxPTR
7 #if defined __GNUC__
8 #define NORETURN_ATTR __attribute__ ((noreturn))
9 #define UNUSED_ATTR __attribute__ ((unused))
10 #if !defined __clang__
11 #define OPTIMIZE_ATTR(n) __attribute__ ((optimize ("O"#n)))
12 #else
13 #define OPTIMIZE_ATTR(n)
14 #endif
15 #define GCC_FMT_ATTR(a, b) __attribute__ ((format (printf, a, b)))
16 #else
17 #define NORETURN_ATTR
18 #define UNUSED_ATTR
19 #define OPTIMIZE_ATTR(n)
20 #define GCC_FMT_ATTR(a, b)
21 #endif
23 extern void NORETURN_ATTR GCC_FMT_ATTR (2, 3)
24 err (int exitcode, const char *fmt, ...);
25 extern void NORETURN_ATTR GCC_FMT_ATTR (2, 3)
26 errx (int exitcode, const char *fmt, ...);
27 extern void *parse_pointer (const char *cap, const char *s);
28 extern double now (void);
29 extern void fmt_linkn (char *s, unsigned int u);
30 extern char *ystrdup (const char *s);
32 #endif