comparison utils.h @ 97:83ad94eec98f

don't rely on netbsd cdefs.h
author David A. Holland
date Mon, 10 Jun 2013 23:46:47 -0400
parents f185d1ac4db4
children 33954a07d013
comparison
equal deleted inserted replaced
96:408331be8792 97:83ad94eec98f
30 #include <stdbool.h> 30 #include <stdbool.h>
31 #include <stddef.h> 31 #include <stddef.h>
32 32
33 struct place; 33 struct place;
34 34
35 #if defined(__CLANG__) || defined(__GNUC__)
36 #define PF(a, b) __attribute__((__format__(__printf__, a, b)))
37 #define DEAD __attribute__((__noreturn__))
38 #else
39 #define PF(a, b)
40 #define DEAD
41 #endif
35 42
36 #define HOWMANY(arr) (sizeof(arr)/sizeof((arr)[0])) 43 #define HOWMANY(arr) (sizeof(arr)/sizeof((arr)[0]))
37 44
38 extern const char ws[]; 45 extern const char ws[];
39 extern const char alnum[]; 46 extern const char alnum[];
51 58
52 size_t notrailingws(char *buf, size_t len); 59 size_t notrailingws(char *buf, size_t len);
53 bool is_identifier(const char *str); 60 bool is_identifier(const char *str);
54 61
55 /* in place.c */ 62 /* in place.c */
56 void complain(const struct place *, const char *fmt, ...) __printflike(2, 3); 63 void complain(const struct place *, const char *fmt, ...) PF(2, 3);
57 void complain_fail(void); 64 void complain_fail(void);
58 bool complain_failed(void); 65 bool complain_failed(void);
59 66
60 /* in main.c */ 67 /* in main.c */
61 void freestringlater(char *s); 68 void freestringlater(char *s);
62 __dead void die(void); 69 DEAD void die(void);