summaryrefslogtreecommitdiff
path: root/pkg/libsignal-protocol-c/patch/0001-Avoid-including-sys-cdefs.h-header.patch
blob: 104f4d4235878794206af1cf9fda1f0d76e363df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
From b77b2265f0a45ebc9ca4734f90f9e12ad2139ba2 Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Thu, 28 Sep 2017 10:40:17 -0700
Subject: [PATCH] Avoid including sys/cdefs.h header

sys/cdefs.h is non-standard, and other headers in the project already just use
`#ifdef __cplusplus` directly. The existing ifdefs and defines are confusing and
broken in some cases (for instance, musl libc does not provide sys/cdefs.h, so
the build fails).
---
 src/vpool.h | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/src/vpool.h b/src/vpool.h
index 04707cb..71b9710 100644
--- a/src/vpool.h
+++ b/src/vpool.h
@@ -21,18 +21,6 @@
 #define _VPOOL_H_
 
 #include <sys/types.h>
-#if !defined(_WINDOWS) && !defined(__sun__)
-#include <sys/cdefs.h>
-#else
-#ifdef __cplusplus
-#define __BEGIN_DECLS extern "C" {
-#define __END_DECLS }
-#else
-#define __BEGIN_DECLS
-#define __END_DECLS
-#endif /* __cplusplus */
-#endif /* _WINDOWS */
-
 #include <limits.h>
 
 struct vpool {
@@ -49,7 +37,9 @@ struct vpool {
 enum vpool_trunc {VPOOL_EXCLUDE, VPOOL_INCLUDE};
 #define VPOOL_TAIL	UINT_MAX
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 void	vpool_init(struct vpool *pool, size_t blksize, size_t limit);
 void	vpool_final(struct vpool *pool);
@@ -71,6 +61,8 @@ int	vpool_truncate(struct vpool *pool,
 
 void	vpool_export(struct vpool *pool, void **buf, size_t *size);
 
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* !_VPOOL_H_ */
-- 
2.14.2