jose: fix build with old compilers
PATCH 1/1 jose: fix build with old compilers
This commit adds two patches to the jose package that fix the build with old compilers such as gcc 4.7.
Fixes:
http://autobuild.buildroot.net/results/00d5a4b809922f8fa42c0de9d461c9754d2f8098
Signed-off-by Thomas Petazzoni <[email protected]>
--- .../0001-lib-hsh.c-rename-hsh-local-variable.patch | 71 +++++++++ ...02-configure-fix-build-with-old-compilers.patch | 165 +++++++++++++++++++++ package/jose/jose.mk | 2 + 3 files changed, 238 insertions(+) create mode 100644 package/jose/0001-lib-hsh.c-rename-hsh-local-variable.patch create mode 100644 package/jose/0002-configure-fix-build-with-old-compilers.patch
package/jose/0001-lib-hsh.c-rename-hsh-local-variable.patch new file +71 -0
@@ -0,0 +1,71 @@ +From 591fc6da944ffc29936e0019b2bc225ddc81dbba Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni <[email protected]> +Date: Mon, 20 Nov 2017 22:48:33 +0100 +Subject: [PATCH] lib/hsh.c: rename hsh local variable + +The hsh local variable name conflicts with the function prototype of +hsh() in hsh.h, causing the following build issues with old compilers +(gcc 4.7): + +hsh.c: In function 'hsh': +hsh.c:28:21: error: declaration of 'hsh' shadows a global declaration [-Werror=shadow] +hsh.c:26:1: error: shadowed declaration is here [-Werror=shadow] +hsh.c: In function 'hsh_buf': +hsh.c:60:21: error: declaration of 'hsh' shadows a global declaration [-Werror=shadow] +hsh.c:26:1: error: shadowed declaration is here [-Werror=shadow] + +Therefore, we rename this local variable to _hsh. + +Submitted-upstream: https://github.com/latchset/jose/pull/51 +Signed-off-by: Thomas Petazzoni <[email protected]> +--- + lib/hsh.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/lib/hsh.c b/lib/hsh.c +index c59a95f..a2a891b 100644 +--- a/lib/hsh.c ++++ b/lib/hsh.c +@@ -25,7 +25,7 @@ + json_t * + hsh(jose_cfg_t *cfg, const char *alg, const void *data, size_t dlen) + { +- jose_io_auto_t *hsh = NULL; ++ jose_io_auto_t *_hsh = NULL; + jose_io_auto_t *enc = NULL; + jose_io_auto_t *buf = NULL; + char b[1024] = {}; +@@ -33,8 +33,8 @@ hsh(jose_cfg_t *cfg, const char *alg, const void *data, size_t dlen) + + buf = jose_io_buffer(cfg, b, &l); + enc = jose_b64_enc_io(buf); +- hsh = hsh_io(cfg, alg, enc); +- if (!buf || !enc || !hsh || !hsh->feed(hsh, data, dlen) || !hsh->done(hsh)) ++ _hsh = hsh_io(cfg, alg, enc); ++ if (!buf || !enc || !_hsh || !_hsh->feed(_hsh, data, dlen) || !_hsh->done(_hsh)) + return NULL; + + return json_stringn(b, l); +@@ -57,7 +57,7 @@ hsh_buf(jose_cfg_t *cfg, const char *alg, + const void *data, size_t dlen, void *hash, size_t hlen) + { + const jose_hook_alg_t *a = NULL; +- jose_io_auto_t *hsh = NULL; ++ jose_io_auto_t *_hsh = NULL; + jose_io_auto_t *buf = NULL; + + a = jose_hook_alg_find(JOSE_HOOK_ALG_KIND_HASH, alg); +@@ -71,8 +71,8 @@ hsh_buf(jose_cfg_t *cfg, const char *alg, + return SIZE_MAX; + + buf = jose_io_buffer(cfg, hash, &hlen); +- hsh = a->hash.hsh(a, cfg, buf); +- if (!buf || !hsh || !hsh->feed(hsh, data, dlen) || !hsh->done(hsh)) ++ _hsh = a->hash.hsh(a, cfg, buf); ++ if (!buf || !_hsh || !_hsh->feed(_hsh, data, dlen) || !_hsh->done(_hsh)) + return SIZE_MAX; + + return hlen; +-- +2.13.6 +
package/jose/0002-configure-fix-build-with-old-compilers.patch new file +165 -0
165 lines not on this page · raw message
package/jose/jose.mk +2 -0
@@ -9,6 +9,8 @@ JOSE_SOURCE = jose-$(JOSE_VERSION).tar.bz2 JOSE_SITE = https://github.com/latchset/jose/releases/download/v$(JOSE_VERSION) JOSE_LICENSE = Apache-2.0 JOSE_LICENSE_FILES = COPYING +# 0002-configure-fix-build-with-old-compilers.patch +JOSE_AUTORECONF = YES JOSE_INSTALL_STAGING = YES JOSE_DEPENDENCIES = host-pkgconf zlib jansson openssl
Signature · 1 line
2.13.6
Thomas Petazzoni
AppliedPATCH 1/1 jose: fix build with old compilers
Hello,
Quoted 7 lines · Thomas Petazzoni
This commit adds two patches to the jose package that fix the build with old compilers such as gcc 4.7.
Fixes:
http://autobuild.buildroot.net/results/00d5a4b809922f8fa42c0de9d461c9754d2f8098
Quoted 8 lines
Signed-off-by Thomas Petazzoni <[email protected]>--- .../0001-lib-hsh.c-rename-hsh-local-variable.patch | 71 +++++++++ ...02-configure-fix-build-with-old-compilers.patch | 165 +++++++++++++++++++++ package/jose/jose.mk | 2 + 3 files changed, 238 insertions(+) create mode 100644 package/jose/0001-lib-hsh.c-rename-hsh-local-variable.patch create mode 100644 package/jose/0002-configure-fix-build-with-old-compilers.patch
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com