1From 11ec8f1e5dfa1c10e0c9fb94879b6f5b96ba52dd Mon Sep 17 00:00:00 2001
2From: Guillem Jover <guillem@hadrons.org>
3Date: Tue, 6 Mar 2018 01:41:35 +0100
4Subject: Handle systems missing <sys/cdefs.h>
5
6This is a non-portable header, and we cannot expect it to be provided by
7the system libc (e.g. musl). We just need and rely on declaration that
8we have defined ourselves in our own <bsd/sys/cdefs.h>. So we switch to
9only ever assume that.
10
11Fixes: 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
27diff --git a/include/bsd/libutil.h b/include/bsd/libutil.h
28index 45b3b15..ccca29a 100644
29--- a/include/bsd/libutil.h
30+++ b/include/bsd/libutil.h
31@@ -40,7 +40,11 @@
32 #define LIBBSD_LIBUTIL_H
33
34 #include <features.h>
35+#ifdef LIBBSD_OVERLAY
36 #include <sys/cdefs.h>
37+#else
38+#include <bsd/sys/cdefs.h>
39+#endif
40 #include <sys/types.h>
41 #include <stdint.h>
42 #include <stdio.h>
43diff --git a/include/bsd/md5.h b/include/bsd/md5.h
44index 5f3ae46..bf36a30 100644
45--- a/include/bsd/md5.h
46+++ b/include/bsd/md5.h
47@@ -27,7 +27,11 @@ typedef struct MD5Context {
48 uint8_t buffer[MD5_BLOCK_LENGTH]; /* input buffer */
49 } MD5_CTX;
50
51+#ifdef LIBBSD_OVERLAY
52 #include <sys/cdefs.h>
53+#else
54+#include <bsd/sys/cdefs.h>
55+#endif
56 #include <sys/types.h>
57
58 __BEGIN_DECLS
59diff --git a/include/bsd/nlist.h b/include/bsd/nlist.h
60index cb297e8..8767117 100644
61--- a/include/bsd/nlist.h
62+++ b/include/bsd/nlist.h
63@@ -27,7 +27,11 @@
64 #ifndef LIBBSD_NLIST_H
65 #define LIBBSD_NLIST_H
66
67+#ifdef LIBBSD_OVERLAY
68 #include <sys/cdefs.h>
69+#else
70+#include <bsd/sys/cdefs.h>
71+#endif
72
73 struct nlist {
74 union {
75diff --git a/include/bsd/readpassphrase.h b/include/bsd/readpassphrase.h
76index 14744b8..5eb8021 100644
77--- a/include/bsd/readpassphrase.h
78+++ b/include/bsd/readpassphrase.h
79@@ -31,7 +31,11 @@
80 #define RPP_SEVENBIT 0x10 /* Strip the high bit from input. */
81 #define RPP_STDIN 0x20 /* Read from stdin, not /dev/tty */
82
83+#ifdef LIBBSD_OVERLAY
84 #include <sys/cdefs.h>
85+#else
86+#include <bsd/sys/cdefs.h>
87+#endif
88 #include <sys/types.h>
89
90 __BEGIN_DECLS
91diff --git a/include/bsd/stdlib.h b/include/bsd/stdlib.h
92index ebc9638..8d33d1f 100644
93--- a/include/bsd/stdlib.h
94+++ b/include/bsd/stdlib.h
95@@ -42,7 +42,11 @@
96 #ifndef LIBBSD_STDLIB_H
97 #define LIBBSD_STDLIB_H
98
99+#ifdef LIBBSD_OVERLAY
100 #include <sys/cdefs.h>
101+#else
102+#include <bsd/sys/cdefs.h>
103+#endif
104 #include <sys/stat.h>
105 #include <stdint.h>
106
107diff --git a/include/bsd/string.h b/include/bsd/string.h
108index 6798bf6..29097f6 100644
109--- a/include/bsd/string.h
110+++ b/include/bsd/string.h
111@@ -33,7 +33,11 @@
112 #ifndef LIBBSD_STRING_H
113 #define LIBBSD_STRING_H
114
115+#ifdef LIBBSD_OVERLAY
116 #include <sys/cdefs.h>
117+#else
118+#include <bsd/sys/cdefs.h>
119+#endif
120 #include <sys/types.h>
121
122 __BEGIN_DECLS
123diff --git a/include/bsd/stringlist.h b/include/bsd/stringlist.h
124index ff30cac..dd71496 100644
125--- a/include/bsd/stringlist.h
126+++ b/include/bsd/stringlist.h
127@@ -31,7 +31,12 @@
128
129 #ifndef LIBBSD_STRINGLIST_H
130 #define LIBBSD_STRINGLIST_H
131+
132+#ifdef LIBBSD_OVERLAY
133 #include <sys/cdefs.h>
134+#else
135+#include <bsd/sys/cdefs.h>
136+#endif
137 #include <sys/types.h>
138
139 /*
140diff --git a/include/bsd/sys/queue.h b/include/bsd/sys/queue.h
141index 4a94ea7..ac00026 100644
142--- a/include/bsd/sys/queue.h
143+++ b/include/bsd/sys/queue.h
144@@ -33,7 +33,11 @@
145 #ifndef LIBBSD_SYS_QUEUE_H
146 #define LIBBSD_SYS_QUEUE_H
147
148+#ifdef LIBBSD_OVERLAY
149 #include <sys/cdefs.h>
150+#else
151+#include <bsd/sys/cdefs.h>
152+#endif
153
154 /*
155 * This file defines four types of data structures: singly-linked lists,
156diff --git a/include/bsd/sys/tree.h b/include/bsd/sys/tree.h
157index 628bec0..325b382 100644
158--- a/include/bsd/sys/tree.h
159+++ b/include/bsd/sys/tree.h
160@@ -30,7 +30,11 @@
161 #ifndef LIBBSD_SYS_TREE_H
162 #define LIBBSD_SYS_TREE_H
163
164+#ifdef LIBBSD_OVERLAY
165 #include <sys/cdefs.h>
166+#else
167+#include <bsd/sys/cdefs.h>
168+#endif
169
170 /*
171 * This file defines data structures for different types of trees:
172diff --git a/include/bsd/timeconv.h b/include/bsd/timeconv.h
173index e2a2c55..a426bd3 100644
174--- a/include/bsd/timeconv.h
175+++ b/include/bsd/timeconv.h
176@@ -41,7 +41,11 @@
177 #ifndef LIBBSD_TIMECONV_H
178 #define LIBBSD_TIMECONV_H
179
180+#ifdef LIBBSD_OVERLAY
181 #include <sys/cdefs.h>
182+#else
183+#include <bsd/sys/cdefs.h>
184+#endif
185 #include <stdint.h>
186 #include <time.h>
187
188diff --git a/include/bsd/vis.h b/include/bsd/vis.h
189index 970dfdd..ab5430c 100644
190--- a/include/bsd/vis.h
191+++ b/include/bsd/vis.h
192@@ -72,7 +72,11 @@
193 */
194 #define UNVIS_END 1 /* no more characters */
195
196+#ifdef LIBBSD_OVERLAY
197 #include <sys/cdefs.h>
198+#else
199+#include <bsd/sys/cdefs.h>
200+#endif
201
202 __BEGIN_DECLS
203 char *vis(char *, int, int, int);
204diff --git a/include/bsd/wchar.h b/include/bsd/wchar.h
205index 33a500e..7216503 100644
206--- a/include/bsd/wchar.h
207+++ b/include/bsd/wchar.h
208@@ -40,7 +40,11 @@
209 #define LIBBSD_WCHAR_H
210
211 #include <stddef.h>
212+#ifdef LIBBSD_OVERLAY
213 #include <sys/cdefs.h>
214+#else
215+#include <bsd/sys/cdefs.h>
216+#endif
217 #include <sys/types.h>
218
219 __BEGIN_DECLS
220--
221cgit v1.1
222