git: b8e169236717 - main - net-p2p/c-lightning: attempt to unbreak on arm64
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 18 Jul 2023 12:12:07 UTC
The branch main has been updated by vd:
URL: https://cgit.FreeBSD.org/ports/commit/?id=b8e16923671765b348a064824656e0cd04809d1b
commit b8e16923671765b348a064824656e0cd04809d1b
Author: Vasil Dimov <vd@FreeBSD.org>
AuthorDate: 2023-07-18 12:08:16 +0000
Commit: Vasil Dimov <vd@FreeBSD.org>
CommitDate: 2023-07-18 12:11:42 +0000
net-p2p/c-lightning: attempt to unbreak on arm64
Since arm64 uses two's complement (char)0xff is the same as -1.
Changing to use the latter should silence this compiler error:
ccan/ccan/base64/base64.c:34:10: error: result of comparison of constant 255 with expression of type 'int8_t' (aka 'signed char') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
if (ret == (char)0xff) {
~~~ ^ ~~~~~~~~~~
---
net-p2p/c-lightning/Makefile | 4 +++
.../files/extra-patch-ccan_ccan_base64_base64.c | 29 ++++++++++++++++++++++
...nal_libwally-core_src_ccan_ccan_base64_base64.c | 29 ++++++++++++++++++++++
3 files changed, 62 insertions(+)
diff --git a/net-p2p/c-lightning/Makefile b/net-p2p/c-lightning/Makefile
index d452d849b054..851ab2407a4e 100644
--- a/net-p2p/c-lightning/Makefile
+++ b/net-p2p/c-lightning/Makefile
@@ -34,6 +34,10 @@ BINARY_ALIAS= python=${PYTHON_CMD} python3=${PYTHON_CMD}
ALL_TARGET= default
SHEBANG_FILES= tools/reckless
+EXTRA_PATCHES_arm64= ${FILESDIR}/extra-patch-ccan_ccan_base64_base64.c \
+ ${FILESDIR}/extra-patch-external_libwally-core_src_ccan_ccan_base64_base64.c
+EXTRA_PATCHES= ${EXTRA_PATCHES_${ARCH}}
+
OPTIONS_DEFINE= COMPATIBILITY DEVELOPER EXPERIMENTAL
OPTIONS_MULTI= STORAGE
OPTIONS_MULTI_STORAGE= POSTGRESQL SQLITE
diff --git a/net-p2p/c-lightning/files/extra-patch-ccan_ccan_base64_base64.c b/net-p2p/c-lightning/files/extra-patch-ccan_ccan_base64_base64.c
new file mode 100644
index 000000000000..c29c8cb458ae
--- /dev/null
+++ b/net-p2p/c-lightning/files/extra-patch-ccan_ccan_base64_base64.c
@@ -0,0 +1,29 @@
+--- ccan/ccan/base64/base64.c.orig 2023-07-18 11:01:33 UTC
++++ ccan/ccan/base64/base64.c
+@@ -31,7 +31,7 @@ static int8_t sixbit_from_b64(const base64_maps_t *map
+ int8_t ret;
+
+ ret = maps->decode_map[(unsigned char)b64letter];
+- if (ret == (char)0xff) {
++ if (ret == -1) {
+ errno = EDOM;
+ return -1;
+ }
+@@ -41,7 +41,7 @@ bool base64_char_in_alphabet(const base64_maps_t *maps
+
+ bool base64_char_in_alphabet(const base64_maps_t *maps, const char b64char)
+ {
+- return (maps->decode_map[(const unsigned char)b64char] != (char)0xff);
++ return (maps->decode_map[(const unsigned char)b64char] != -1);
+ }
+
+ void base64_init_maps(base64_maps_t *dest, const char src[64])
+@@ -49,7 +49,7 @@ void base64_init_maps(base64_maps_t *dest, const char
+ unsigned char i;
+
+ memcpy(dest->encode_map,src,64);
+- memset(dest->decode_map,0xff,256);
++ memset(dest->decode_map,-1,256);
+ for (i=0; i<64; i++) {
+ dest->decode_map[(unsigned char)src[i]] = i;
+ }
diff --git a/net-p2p/c-lightning/files/extra-patch-external_libwally-core_src_ccan_ccan_base64_base64.c b/net-p2p/c-lightning/files/extra-patch-external_libwally-core_src_ccan_ccan_base64_base64.c
new file mode 100644
index 000000000000..d577ba598d09
--- /dev/null
+++ b/net-p2p/c-lightning/files/extra-patch-external_libwally-core_src_ccan_ccan_base64_base64.c
@@ -0,0 +1,29 @@
+--- external/libwally-core/src/ccan/ccan/base64/base64.c.orig 2023-07-18 11:13:39 UTC
++++ external/libwally-core/src/ccan/ccan/base64/base64.c
+@@ -34,7 +34,7 @@ static int8_t sixbit_from_b64(const base64_maps_t *map
+ int8_t ret;
+
+ ret = maps->decode_map[(unsigned char)b64letter];
+- if (ret == (char)0xff) {
++ if (ret == -1) {
+ errno = EDOM;
+ return -1;
+ }
+@@ -44,7 +44,7 @@ bool base64_char_in_alphabet(const base64_maps_t *maps
+
+ bool base64_char_in_alphabet(const base64_maps_t *maps, const char b64char)
+ {
+- return (maps->decode_map[(const unsigned char)b64char] != (char)0xff);
++ return (maps->decode_map[(const unsigned char)b64char] != -1);
+ }
+
+ void base64_init_maps(base64_maps_t *dest, const char src[64])
+@@ -52,7 +52,7 @@ void base64_init_maps(base64_maps_t *dest, const char
+ unsigned char i;
+
+ memcpy(dest->encode_map,src,64);
+- memset(dest->decode_map,0xff,256);
++ memset(dest->decode_map,-1,256);
+ for (i=0; i<64; i++) {
+ dest->decode_map[(unsigned char)src[i]] = i;
+ }