opr: Flag assertion error handles as noreturn
[openafs.git] / src / opr / opr.h
1 #ifndef OPENAFS_OPR_OPR_H
2 #define OPENAFS_OPR_OPR_H 1
3
4 /* macros */
5
6 #define opr_containerof(ptr, structure, member) \
7    ((structure *)((char *)(ptr)-(char *)(&((structure *)NULL)->member)))
8
9 /* assert.c */
10
11 #ifdef AFS_NT40_ENV
12 # define opr_abort() opr_NTAbort()
13 extern void opr_NTAbort(void);
14 #else
15 # define opr_abort() abort()
16 #endif
17
18 extern void opr_AssertionFailed(char *, int) AFS_NORETURN;
19 extern void opr_AssertFailU(const char *, const char *, int) AFS_NORETURN;
20
21 #define opr_Assert(ex) \
22     do {if (!(ex)) opr_AssertionFailed(__FILE__, __LINE__);} while(0)
23
24 /* casestrcpy.c */
25 #define lcstring opr_lcstring
26 #define ucstring opr_ucstring
27 #define stolower opr_stolower
28 #define stoupper opr_stoupper
29 #define strcompose opr_strcompose
30
31 extern char *opr_lcstring(char *d, char *s, int n);
32 extern char *opr_ucstring(char *d, char *s, int n);
33 extern void opr_stolower(char *s);
34 extern void opr_stoupper(char *s);
35 extern char *opr_strcompose(char *buf, size_t len, ...);
36
37 #endif