add _Noreturn function attribute, with fallback for pre-C11 GNUC
[musl] / include / regex.h
1 #ifndef _REGEX_H
2 #define _REGEX_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 #if __STDC_VERSION__ >= 199901L
9 #define __restrict restrict
10 #elif !defined(__GNUC__)
11 #define __restrict
12 #endif
13
14 #define __NEED_size_t
15
16 #include <bits/alltypes.h>
17
18 typedef long regoff_t;
19
20 typedef struct {
21         size_t re_nsub;
22         void *__opaque, *__padding[4];
23         size_t __nsub2;
24 } regex_t;
25
26 typedef struct {
27         regoff_t rm_so;
28         regoff_t rm_eo;
29 } regmatch_t;
30
31 #define REG_EXTENDED    1
32 #define REG_ICASE       2
33 #define REG_NEWLINE     4
34 #define REG_NOSUB       8
35
36 #define REG_NOTBOL      1
37 #define REG_NOTEOL      2
38
39 #define REG_OK          0
40 #define REG_NOMATCH     1
41 #define REG_BADPAT      2
42 #define REG_ECOLLATE    3
43 #define REG_ECTYPE      4
44 #define REG_EESCAPE     5
45 #define REG_ESUBREG     6
46 #define REG_EBRACK      7
47 #define REG_EPAREN      8
48 #define REG_EBRACE      9
49 #define REG_BADBR       10
50 #define REG_ERANGE      11
51 #define REG_ESPACE      12
52 #define REG_BADRPT      13
53
54 #define REG_ENOSYS      -1
55
56 int regcomp(regex_t *__restrict, const char *__restrict, int);
57 int regexec(const regex_t *__restrict, const char *__restrict, size_t, regmatch_t *__restrict, int);
58 void regfree(regex_t *);
59
60 size_t regerror(int, const regex_t *__restrict, char *__restrict, size_t);
61
62 #ifdef __cplusplus
63 }
64 #endif
65
66 #endif