From f948f4eb3070f5a138aa9d8b21485b746d35fd12 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 23 Jul 2025 13:04:49 -0700 Subject: [PATCH 1/2] Use append_cflags instead of modifying CFLAGS directly This fixes a compilation issue in GCC 15 due `stdbool.h` not being included when `-std=c99` is in use. This occurs because the standard `configure` script shipped with Ruby does not properly test for `stdbool.h` on C23 compilers. It needs to pick up this change: https://cgit.git.savannah.gnu.org/cgit/autoconf.git/commit/?id=6dcecb780a69bd208088d666b299e92aa7ae7e80 The `append_cflags` approach is recommended over modifying CFLAGS since it ensures compatibility across different build environments by checking whether the flag is acceptable. Similar changes: * https://github.com/socketry/io-event/pull/137 * https://github.com/mongodb/bson-ruby/pull/355 Closes #27 --- ext/cbor/extconf.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/cbor/extconf.rb b/ext/cbor/extconf.rb index 38e37fd..3db089d 100644 --- a/ext/cbor/extconf.rb +++ b/ext/cbor/extconf.rb @@ -9,7 +9,7 @@ have_func("rb_str_intern", ["ruby.h"]) have_func("rb_integer_unpack", ["ruby.h"]) -$CFLAGS << %[ -I.. -Wall -O3 -g -std=c99] +append_cflags(%w[-I.. -Wall -O3 -g -std=c99]) #$CFLAGS << %[ -DDISABLE_RMEM] #$CFLAGS << %[ -DDISABLE_RMEM_REUSE_INTERNAL_FRAGMENT] #$CFLAGS << %[ -DDISABLE_BUFFER_READ_REFERENCE_OPTIMIZE] @@ -17,9 +17,9 @@ if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx' # msgpack-ruby doesn't modify data came from RSTRING_PTR(str) - $CFLAGS << %[ -DRSTRING_NOT_MODIFIED] + append_cflags('-DRSTRING_NOT_MODIFIED') # Rubinius C extensions don't grab GVL while rmem is not thread safe - $CFLAGS << %[ -DDISABLE_RMEM] + append_cflags('-DDISABLE_RMEM') end if warnflags = CONFIG['warnflags'] From 3a52587461c8d3c41cfd9ac88025524ca39af01e Mon Sep 17 00:00:00 2001 From: Carsten Bormann Date: Sat, 2 Aug 2025 17:23:43 +0200 Subject: [PATCH 2/2] Merge PR #29 in 0.5.9.9 --- lib/cbor/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cbor/version.rb b/lib/cbor/version.rb index 3156c8e..5f34d6b 100644 --- a/lib/cbor/version.rb +++ b/lib/cbor/version.rb @@ -1,3 +1,3 @@ module CBOR - VERSION = "0.5.9.8" + VERSION = "0.5.9.9" end