summaryrefslogtreecommitdiff
path: root/packages/dev-libs/ustr/files/ustr-unused-vars.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packages/dev-libs/ustr/files/ustr-unused-vars.patch')
-rw-r--r--packages/dev-libs/ustr/files/ustr-unused-vars.patch80
1 files changed, 80 insertions, 0 deletions
diff --git a/packages/dev-libs/ustr/files/ustr-unused-vars.patch b/packages/dev-libs/ustr/files/ustr-unused-vars.patch
new file mode 100644
index 0000000..b95852b
--- /dev/null
+++ b/packages/dev-libs/ustr/files/ustr-unused-vars.patch
@@ -0,0 +1,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)