summaryrefslogtreecommitdiff
path: root/packages/dev-libs/ustr/files/ustr-unused-vars.patch
blob: b95852bb32abaa97476955496dd0c33897a868b4 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
From: Václav Ovsík <vaclav.ovsik@gmail.com>
Subject: [PATCH] fixes/unused-vars
Upstream: no
Source: Debian
Reason: Fix compilation issues

This patch suppresses warnings about unused variables using variable attribute.

Signed-off-by: Václav Ovsík <vaclav.ovsik@gmail.com>

---
 ustr-compiler.h  | 7 +++++++
 ustr-main-code.h | 4 ++--
 ustr-sc-code.h   | 4 ++--
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/ustr-compiler.h b/ustr-compiler.h
index 9e71276..b9a16ed 100644
--- a/ustr-compiler.h
+++ b/ustr-compiler.h
@@ -194,6 +194,13 @@
 #endif
 
 #if defined(__GNUC__) && !defined(__STRICT_ANSI__) && \
+    USTR_CONF_HAVE_ATTR_UNUSED && USTR_CONF_COMPILE_USE_ATTRIBUTES
+# define USTR__COMPILE_ATTR_MAYBE_UNUSED(x) x __attribute__((unused))
+#else
+# define USTR__COMPILE_ATTR_MAYBE_UNUSED(x) x
+#endif
+
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && \
     USTR_CONF_HAVE_ATTR_DEPRECATED && USTR_CONF_COMPILE_USE_ATTRIBUTES
 # define USTR__COMPILE_ATTR_DEPRECATED() __attribute__ ((__deprecated__))
 #else
diff --git a/ustr-main-code.h b/ustr-main-code.h
index 670be6d..bd37889 100644
--- a/ustr-main-code.h
+++ b/ustr-main-code.h
@@ -673,7 +673,7 @@ struct Ustr *ustrp__dupx_undef(struct Ustr_pool *p, size_t sz, size_t rbytes,
                                int exact, int emem, size_t len)
 {
   struct Ustr *ret = USTR_NULL;
-  struct Ustr *chk = USTR_NULL;
+  struct Ustr *USTR__COMPILE_ATTR_MAYBE_UNUSED(chk) = USTR_NULL;
   size_t rsz = 0;
   
   USTR_ASSERT((rbytes == 0) || (rbytes == 1) || (rbytes == 2) || (rbytes == 4)||
@@ -1052,7 +1052,7 @@ struct Ustr *ustrp__dupx_empty(struct Ustr_pool *p, size_t sz, size_t rbytes,
                                int exact, int emem)
 { /* set the error bit, so we always get malloc()'d data, then clear it */
   struct Ustr *s1 = ustrp__dupx_undef(p, sz, rbytes, exact, USTR_TRUE, 0);
-  int eret = USTR_FALSE;
+  int USTR__COMPILE_ATTR_MAYBE_UNUSED(eret) = USTR_FALSE;
 
   if (!s1 || emem)
     return (s1);
diff --git a/ustr-sc-code.h b/ustr-sc-code.h
index 1bb1366..a596a0f 100644
--- a/ustr-sc-code.h
+++ b/ustr-sc-code.h
@@ -171,7 +171,7 @@ int ustrp_sc_utf8_reverse(struct Ustr_pool *p, struct Ustrp **ps1)
 
 USTR_CONF_i_PROTO int ustrp__sc_tolower(struct Ustr_pool *p, struct Ustr **ps1)
 {
-  size_t clen;
+  size_t USTR__COMPILE_ATTR_MAYBE_UNUSED(clen);
   size_t len;
   char *ptr;
   
@@ -201,7 +201,7 @@ USTR_CONF_I_PROTO int ustrp_sc_tolower(struct Ustr_pool *p, struct Ustrp **ps1)
 
 USTR_CONF_i_PROTO int ustrp__sc_toupper(struct Ustr_pool *p, struct Ustr **ps1)
 {
-  size_t clen;
+  size_t USTR__COMPILE_ATTR_MAYBE_UNUSED(clen);
   size_t len;
   char *ptr;
   
-- 
tg: (b148fb7..) fixes/unused-vars (depends on: upstream)