libbsd: Update to 0.8.7
[openwrt/openwrt.git] / package / libs / libbsd / patches / 001-handle-systems-missing-sys_cdefs.h.patch
1 From 11ec8f1e5dfa1c10e0c9fb94879b6f5b96ba52dd Mon Sep 17 00:00:00 2001
2 From: Guillem Jover <guillem@hadrons.org>
3 Date: Tue, 6 Mar 2018 01:41:35 +0100
4 Subject: Handle systems missing <sys/cdefs.h>
5
6 This is a non-portable header, and we cannot expect it to be provided by
7 the system libc (e.g. musl). We just need and rely on declaration that
8 we have defined ourselves in our own <bsd/sys/cdefs.h>. So we switch to
9 only ever assume that.
10
11 Fixes: https://bugs.freedesktop.org/105281
12 ---
13 include/bsd/libutil.h | 4 ++++
14 include/bsd/md5.h | 4 ++++
15 include/bsd/nlist.h | 4 ++++
16 include/bsd/readpassphrase.h | 4 ++++
17 include/bsd/stdlib.h | 4 ++++
18 include/bsd/string.h | 4 ++++
19 include/bsd/stringlist.h | 5 +++++
20 include/bsd/sys/queue.h | 4 ++++
21 include/bsd/sys/tree.h | 4 ++++
22 include/bsd/timeconv.h | 4 ++++
23 include/bsd/vis.h | 4 ++++
24 include/bsd/wchar.h | 4 ++++
25 12 files changed, 49 insertions(+)
26
27 --- a/include/bsd/libutil.h
28 +++ b/include/bsd/libutil.h
29 @@ -40,7 +40,11 @@
30 #define LIBBSD_LIBUTIL_H
31
32 #include <features.h>
33 +#ifdef LIBBSD_OVERLAY
34 #include <sys/cdefs.h>
35 +#else
36 +#include <bsd/sys/cdefs.h>
37 +#endif
38 #include <sys/types.h>
39 #include <stdint.h>
40 #include <stdio.h>
41 --- a/include/bsd/md5.h
42 +++ b/include/bsd/md5.h
43 @@ -27,7 +27,11 @@ typedef struct MD5Context {
44 uint8_t buffer[MD5_BLOCK_LENGTH]; /* input buffer */
45 } MD5_CTX;
46
47 +#ifdef LIBBSD_OVERLAY
48 #include <sys/cdefs.h>
49 +#else
50 +#include <bsd/sys/cdefs.h>
51 +#endif
52 #include <sys/types.h>
53
54 __BEGIN_DECLS
55 --- a/include/bsd/nlist.h
56 +++ b/include/bsd/nlist.h
57 @@ -27,7 +27,11 @@
58 #ifndef LIBBSD_NLIST_H
59 #define LIBBSD_NLIST_H
60
61 +#ifdef LIBBSD_OVERLAY
62 #include <sys/cdefs.h>
63 +#else
64 +#include <bsd/sys/cdefs.h>
65 +#endif
66
67 struct nlist {
68 union {
69 --- a/include/bsd/readpassphrase.h
70 +++ b/include/bsd/readpassphrase.h
71 @@ -31,7 +31,11 @@
72 #define RPP_SEVENBIT 0x10 /* Strip the high bit from input. */
73 #define RPP_STDIN 0x20 /* Read from stdin, not /dev/tty */
74
75 +#ifdef LIBBSD_OVERLAY
76 #include <sys/cdefs.h>
77 +#else
78 +#include <bsd/sys/cdefs.h>
79 +#endif
80 #include <sys/types.h>
81
82 __BEGIN_DECLS
83 --- a/include/bsd/stdlib.h
84 +++ b/include/bsd/stdlib.h
85 @@ -42,7 +42,11 @@
86 #ifndef LIBBSD_STDLIB_H
87 #define LIBBSD_STDLIB_H
88
89 +#ifdef LIBBSD_OVERLAY
90 #include <sys/cdefs.h>
91 +#else
92 +#include <bsd/sys/cdefs.h>
93 +#endif
94 #include <sys/stat.h>
95 #include <stdint.h>
96
97 --- a/include/bsd/string.h
98 +++ b/include/bsd/string.h
99 @@ -33,7 +33,11 @@
100 #ifndef LIBBSD_STRING_H
101 #define LIBBSD_STRING_H
102
103 +#ifdef LIBBSD_OVERLAY
104 #include <sys/cdefs.h>
105 +#else
106 +#include <bsd/sys/cdefs.h>
107 +#endif
108 #include <sys/types.h>
109
110 __BEGIN_DECLS
111 --- a/include/bsd/stringlist.h
112 +++ b/include/bsd/stringlist.h
113 @@ -31,7 +31,12 @@
114
115 #ifndef LIBBSD_STRINGLIST_H
116 #define LIBBSD_STRINGLIST_H
117 +
118 +#ifdef LIBBSD_OVERLAY
119 #include <sys/cdefs.h>
120 +#else
121 +#include <bsd/sys/cdefs.h>
122 +#endif
123 #include <sys/types.h>
124
125 /*
126 --- a/include/bsd/sys/queue.h
127 +++ b/include/bsd/sys/queue.h
128 @@ -33,7 +33,11 @@
129 #ifndef LIBBSD_SYS_QUEUE_H
130 #define LIBBSD_SYS_QUEUE_H
131
132 +#ifdef LIBBSD_OVERLAY
133 #include <sys/cdefs.h>
134 +#else
135 +#include <bsd/sys/cdefs.h>
136 +#endif
137
138 /*
139 * This file defines four types of data structures: singly-linked lists,
140 --- a/include/bsd/sys/tree.h
141 +++ b/include/bsd/sys/tree.h
142 @@ -30,7 +30,11 @@
143 #ifndef LIBBSD_SYS_TREE_H
144 #define LIBBSD_SYS_TREE_H
145
146 +#ifdef LIBBSD_OVERLAY
147 #include <sys/cdefs.h>
148 +#else
149 +#include <bsd/sys/cdefs.h>
150 +#endif
151
152 /*
153 * This file defines data structures for different types of trees:
154 --- a/include/bsd/timeconv.h
155 +++ b/include/bsd/timeconv.h
156 @@ -41,7 +41,11 @@
157 #ifndef LIBBSD_TIMECONV_H
158 #define LIBBSD_TIMECONV_H
159
160 +#ifdef LIBBSD_OVERLAY
161 #include <sys/cdefs.h>
162 +#else
163 +#include <bsd/sys/cdefs.h>
164 +#endif
165 #include <stdint.h>
166 #include <time.h>
167
168 --- a/include/bsd/vis.h
169 +++ b/include/bsd/vis.h
170 @@ -72,7 +72,11 @@
171 */
172 #define UNVIS_END 1 /* no more characters */
173
174 +#ifdef LIBBSD_OVERLAY
175 #include <sys/cdefs.h>
176 +#else
177 +#include <bsd/sys/cdefs.h>
178 +#endif
179
180 __BEGIN_DECLS
181 char *vis(char *, int, int, int);
182 --- a/include/bsd/wchar.h
183 +++ b/include/bsd/wchar.h
184 @@ -40,7 +40,11 @@
185 #define LIBBSD_WCHAR_H
186
187 #include <stddef.h>
188 +#ifdef LIBBSD_OVERLAY
189 #include <sys/cdefs.h>
190 +#else
191 +#include <bsd/sys/cdefs.h>
192 +#endif
193 #include <sys/types.h>
194
195 __BEGIN_DECLS