* [Buildroot] [PATCH 1/1] package/tinycbor: bump to version 0.6.1
@ 2025-08-19 21:32 Florian Larysch
2025-08-22 20:41 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 3+ messages in thread
From: Florian Larysch @ 2025-08-19 21:32 UTC (permalink / raw)
To: buildroot; +Cc: Fabrice Fontaine, Florian Larysch
This is nominally a bugfix release which now also includes the patch we
previously backported, so we can remove it.
However, it also introduced some breakage:
- Builds with older toolchains (like br-arm-full-static, GCC 9) fail
because the introduction of C23 [[fallthrough]] to the code was not
properly gated on compiler support.
- Compiling for x86 without SSE2 support (e.g. with
bootlin-x86-i686-musl) fails because the check for native half-with
float arithmetic support on the target was not strict enough.
Import unreleased upstream patches that fix these issues.
Release notes: https://github.com/intel/tinycbor/releases/tag/v0.6.1
Signed-off-by: Florian Larysch <fl@n621.de>
---
...CC-11-fallthrough-is-supported-but-n.patch | 55 +++++++++++++++++
.../0001-Makefile-add-DISABLE_WERROR.patch | 44 --------------
.../0002-fix-build-on-i386-without-SSE2.patch | 59 +++++++++++++++++++
package/tinycbor/tinycbor.hash | 2 +-
package/tinycbor/tinycbor.mk | 2 +-
5 files changed, 116 insertions(+), 46 deletions(-)
create mode 100644 package/tinycbor/0001-Fix-build-with-GCC-11-fallthrough-is-supported-but-n.patch
delete mode 100644 package/tinycbor/0001-Makefile-add-DISABLE_WERROR.patch
create mode 100644 package/tinycbor/0002-fix-build-on-i386-without-SSE2.patch
diff --git a/package/tinycbor/0001-Fix-build-with-GCC-11-fallthrough-is-supported-but-n.patch b/package/tinycbor/0001-Fix-build-with-GCC-11-fallthrough-is-supported-but-n.patch
new file mode 100644
index 0000000000..e54e8db6e2
--- /dev/null
+++ b/package/tinycbor/0001-Fix-build-with-GCC-11-fallthrough-is-supported-but-n.patch
@@ -0,0 +1,55 @@
+From 45e4641059709862b4e46f3608d140337566334b Mon Sep 17 00:00:00 2001
+From: Thiago Macieira <thiago.macieira@intel.com>
+Date: Wed, 2 Apr 2025 08:39:04 -0700
+Subject: [PATCH] Fix build with GCC < 11: [[fallthrough]] is supported but not
+ allowed in C
+
+I think GCC says `__has_cpp_attribute(fallthrough)` is true because C++
+supports it (it means "has C++ attribute"), but that doesn't apply to
+the C language. This causes a compilation error:
+
+```
+compilersupport_p.h:57:41: error: expected expression before '[' token
+ 57 | # define CBOR_FALLTHROUGH [[fallthrough]]
+ | ^
+cborparser.c:225:13: note: in expansion of macro 'CBOR_FALLTHROUGH'
+ 225 | CBOR_FALLTHROUGH;
+ | ^~~~~~~~~~~~~~~~
+```
+
+Instead, we should use the C23 `__has_c_attribute` to detect the C
+attribute.
+
+Fixes #293.
+
+Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
+
+Upstream: https://github.com/intel/tinycbor/commit/45e4641059709862b4e46f3608d140337566334b
+Signed-off-by: Florian Larysch <fl@n621.de>
+---
+ src/compilersupport_p.h | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/compilersupport_p.h b/src/compilersupport_p.h
+index c91ea93..9251799 100644
+--- a/src/compilersupport_p.h
++++ b/src/compilersupport_p.h
+@@ -52,10 +52,14 @@
+ # define cbor_static_assert(x) ((void)sizeof(char[2*!!(x) - 1]))
+ #endif
+
+-#if defined(__has_cpp_attribute) // C23 and C++17
++#if defined(__has_cpp_attribute) && defined(__cplusplus) // C++17
+ # if __has_cpp_attribute(fallthrough)
+ # define CBOR_FALLTHROUGH [[fallthrough]]
+ # endif
++#elif defined(__has_c_attribute) && !defined(__cplusplus) // C23
++# if __has_c_attribute(fallthrough)
++# define CBOR_FALLTHROUGH [[fallthrough]]
++# endif
+ #endif
+ #ifndef CBOR_FALLTHROUGH
+ # ifdef __GNUC__
+--
+2.50.1
+
diff --git a/package/tinycbor/0001-Makefile-add-DISABLE_WERROR.patch b/package/tinycbor/0001-Makefile-add-DISABLE_WERROR.patch
deleted file mode 100644
index 334bea7eb0..0000000000
--- a/package/tinycbor/0001-Makefile-add-DISABLE_WERROR.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 5f26eaf8d7be760fafe11ef4a6e0f907e7e8c3f0 Mon Sep 17 00:00:00 2001
-From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
-Date: Mon, 10 Jan 2022 23:17:45 +0100
-Subject: [PATCH] Makefile: add DISABLE_WERROR
-
-Allow the user to disable -Werror to avoid the following build failure
-with gcc 4.8 raised since version 0.6.0 and
-https://github.com/intel/tinycbor/commit/e2a4ed135c4d9101c4df83f2dd033cd249b6ef07:
-
-/home/buildroot/autobuild/instance-1/output-1/host/bin/arm-none-linux-gnueabi-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I./src -std=gnu99 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g0 -D_FORTIFY_SOURCE=1 -Werror=incompatible-pointer-types -Werror=implicit-function-declaration -Werror=int-conversion -fPIC -c -o src/cborerrorstrings.pic.o src/cborerrorstrings.c
-cc1: error: -Werror=incompatible-pointer-types: no option -Wincompatible-pointer-types
-cc1: error: -Werror=int-conversion: no option -Wint-conversion
-
-Fixes:
- - http://autobuild.buildroot.org/results/a9f/a9fe64c42bb96f9e7b4af3050464f6570c1c00fa
-
-Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
-[Retrieved from:
-https://github.com/intel/tinycbor/commit/5f26eaf8d7be760fafe11ef4a6e0f907e7e8c3f0]
----
- Makefile | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/Makefile b/Makefile
-index 6492ea16..3cde2b3d 100644
---- a/Makefile
-+++ b/Makefile
-@@ -236,10 +236,15 @@ tag: distcheck
- .SECONDARY:
-
- cflags := $(CPPFLAGS) -I$(SRCDIR)src
--cflags += -std=gnu99 $(CFLAGS) \
-+cflags += -std=gnu99 $(CFLAGS)
-+
-+ifneq ($(DISABLE_WERROR),1)
-+cflags += \
- -Werror=incompatible-pointer-types \
- -Werror=implicit-function-declaration \
- -Werror=int-conversion
-+endif
-+
- %.o: %.c
- @test -d $(@D) || $(MKDIR) $(@D)
- $(CC) $(cflags) $($(basename $(notdir $@))_CCFLAGS) -c -o $@ $<
diff --git a/package/tinycbor/0002-fix-build-on-i386-without-SSE2.patch b/package/tinycbor/0002-fix-build-on-i386-without-SSE2.patch
new file mode 100644
index 0000000000..45611e6f23
--- /dev/null
+++ b/package/tinycbor/0002-fix-build-on-i386-without-SSE2.patch
@@ -0,0 +1,59 @@
+From 48a22bddfcc67b3a433ded695f906cc314a0bd5f Mon Sep 17 00:00:00 2001
+From: Florian Larysch <fl@n621.de>
+Date: Sun, 17 Aug 2025 00:20:57 +0200
+Subject: [PATCH] fix build on i386 without SSE2
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Commit 3cba6b1 ("Use _Float16 for half conversions if available") added
+support for using half-width float support in the compiler to perform
+encoding operations, using the FLT16_MANT_DIG macro to check for
+support on the given target.
+
+However, on x86 GCC only supports this when SSE2 is enabled[1]. Unlike
+clang and the other architectures where support for this is conditional,
+GCC *does* define those macros even without SSE2 support, causing a
+build failure:
+
+ In file included from cborencoder_float.c:29:
+ cborinternal_p.h: In function ‘encode_half’:
+ cborinternal_p.h:56:5: error: invalid conversion to type ‘_Float16’ without option ‘-msse2’
+ 56 | _Float16 f = (_Float16)x;
+ | ^~~~~~~~
+ cborinternal_p.h: In function ‘decode_half’:
+ cborinternal_p.h:65:5: error: invalid conversion from type ‘_Float16’ without option ‘-msse2’
+ 65 | return (float)f;
+ |
+
+Work around this by additionally checking for this specific condition.
+
+[1] https://gcc.gnu.org/onlinedocs/gcc/Half-Precision.html
+
+Upstream: https://github.com/intel/tinycbor/commit/48a22bddfcc67b3a433ded695f906cc314a0bd5f
+Signed-off-by: Florian Larysch <fl@n621.de>
+---
+ src/cborinternal_p.h | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/cborinternal_p.h b/src/cborinternal_p.h
+index 19273ac..ee9c117 100644
+--- a/src/cborinternal_p.h
++++ b/src/cborinternal_p.h
+@@ -48,8 +48,12 @@
+ /* Check for FLT16_MANT_DIG using integer comparison. Clang headers incorrectly
+ * define this macro unconditionally when __STDC_WANT_IEC_60559_TYPES_EXT__
+ * is defined (regardless of actual support for _Float16).
++ *
++ * GCC defines these macros but doesn't support arithmetic including
++ * conversions on x86 without SSE2.
+ */
+-# if FLT16_MANT_DIG > 0 || __FLT16_MANT_DIG__ > 0
++# if (FLT16_MANT_DIG > 0 || __FLT16_MANT_DIG__ > 0) && \
++ !(defined(__i386__) && !defined(__SSE2__))
+ static inline unsigned short encode_half(float x)
+ {
+ unsigned short h;
+--
+2.50.1
+
diff --git a/package/tinycbor/tinycbor.hash b/package/tinycbor/tinycbor.hash
index 0e616d1e9f..dd63822908 100644
--- a/package/tinycbor/tinycbor.hash
+++ b/package/tinycbor/tinycbor.hash
@@ -1,3 +1,3 @@
# Locally computed:
-sha256 512e2c9fce74f60ef9ed3af59161e905f9e19f30a52e433fc55f39f4c70d27e4 tinycbor-0.6.0.tar.gz
+sha256 0f9944496d1143935e9c996bc6233ca0dd5451299def33ef400a409942f8f34b tinycbor-0.6.1.tar.gz
sha256 3c6ba0b5bfa7830505301ffb336a17b0748e0d61c4d34216e9dc98f10e40395e LICENSE
diff --git a/package/tinycbor/tinycbor.mk b/package/tinycbor/tinycbor.mk
index d2fb583e67..03067edbd7 100644
--- a/package/tinycbor/tinycbor.mk
+++ b/package/tinycbor/tinycbor.mk
@@ -4,7 +4,7 @@
#
################################################################################
-TINYCBOR_VERSION = 0.6.0
+TINYCBOR_VERSION = 0.6.1
TINYCBOR_SITE = $(call github,intel,tinycbor,v$(TINYCBOR_VERSION))
TINYCBOR_LICENSE = MIT
TINYCBOR_LICENSE_FILES = LICENSE
--
2.50.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/tinycbor: bump to version 0.6.1
2025-08-19 21:32 [Buildroot] [PATCH 1/1] package/tinycbor: bump to version 0.6.1 Florian Larysch
@ 2025-08-22 20:41 ` Thomas Petazzoni via buildroot
2025-08-22 21:09 ` Florian Larysch
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2025-08-22 20:41 UTC (permalink / raw)
To: Florian Larysch; +Cc: buildroot, Fabrice Fontaine
On Tue, 19 Aug 2025 23:32:59 +0200
Florian Larysch <fl@n621.de> wrote:
> This is nominally a bugfix release which now also includes the patch we
> previously backported, so we can remove it.
>
> However, it also introduced some breakage:
>
> - Builds with older toolchains (like br-arm-full-static, GCC 9) fail
> because the introduction of C23 [[fallthrough]] to the code was not
> properly gated on compiler support.
>
> - Compiling for x86 without SSE2 support (e.g. with
> bootlin-x86-i686-musl) fails because the check for native half-with
> float arithmetic support on the target was not strict enough.
>
> Import unreleased upstream patches that fix these issues.
>
> Release notes: https://github.com/intel/tinycbor/releases/tag/v0.6.1
>
> Signed-off-by: Florian Larysch <fl@n621.de>
> ---
> ...CC-11-fallthrough-is-supported-but-n.patch | 55 +++++++++++++++++
> .../0001-Makefile-add-DISABLE_WERROR.patch | 44 --------------
> .../0002-fix-build-on-i386-without-SSE2.patch | 59 +++++++++++++++++++
> package/tinycbor/tinycbor.hash | 2 +-
> package/tinycbor/tinycbor.mk | 2 +-
> 5 files changed, 116 insertions(+), 46 deletions(-)
> create mode 100644 package/tinycbor/0001-Fix-build-with-GCC-11-fallthrough-is-supported-but-n.patch
> delete mode 100644 package/tinycbor/0001-Makefile-add-DISABLE_WERROR.patch
> create mode 100644 package/tinycbor/0002-fix-build-on-i386-without-SSE2.patch
Thanks for this patch. Even though it's a bug fix only release, it
seems to introduce some potential breakage, and we haven't had any
failures of tinycbor in our autobuilders for the past 3 years, so I
applied to next. Just a minor nit: you hard forgotten to update our
.checkpackageignore file which was ignoring an issue with patch 0001
that you're deleting.
Thanks a lot for this contribution!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/tinycbor: bump to version 0.6.1
2025-08-22 20:41 ` Thomas Petazzoni via buildroot
@ 2025-08-22 21:09 ` Florian Larysch
0 siblings, 0 replies; 3+ messages in thread
From: Florian Larysch @ 2025-08-22 21:09 UTC (permalink / raw)
To: Thomas Petazzoni; +Cc: buildroot, Fabrice Fontaine
On Fri, Aug 22, 2025 at 10:41:37PM +0200, Thomas Petazzoni via buildroot wrote:
> Thanks for this patch. Even though it's a bug fix only release, it
> seems to introduce some potential breakage, and we haven't had any
> failures of tinycbor in our autobuilders for the past 3 years, so I
> applied to next.
Makes sense, I've also been a bit apprehensive about this.
> Just a minor nit: you hard forgotten to update our
> .checkpackageignore file which was ignoring an issue with patch 0001
> that you're deleting.
Oh, I wasn't even aware this existed. Thanks for pointing it out!
Florian
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-08-22 21:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-19 21:32 [Buildroot] [PATCH 1/1] package/tinycbor: bump to version 0.6.1 Florian Larysch
2025-08-22 20:41 ` Thomas Petazzoni via buildroot
2025-08-22 21:09 ` Florian Larysch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox