rcx 0.4.0 → 0.4.2.alpha1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 422a1c5bd974518c00e3a6c0ca86ac38f6c62ff06dd56acf0971973f215208bc
4
- data.tar.gz: 8ecbbb1e288c7df1ebdb317f64c1c2656faf50044c4e6d06c598a6789d21906d
3
+ metadata.gz: '09c06fa0da1aff96be73d2af7a6b35dd7a85f2d0a47d547473751a5081ecbc7c'
4
+ data.tar.gz: 0da8068ce992ef931b799e546caa9ab11aeafca42b96579ff9c6b84b0163737a
5
5
  SHA512:
6
- metadata.gz: ec21a72b07c85b513459908b61733ee68c61c3116729ed87209a603666ed2396edb0ab140449db0d16185a183215dfb750c5e9ae8f5af5c3652accd63196dad6
7
- data.tar.gz: 4d3bbb65011e6e2649da175130f22cd9bcf4bbbd95830452e06bad119d02b3904e2e514bc4aac05f92e32729bc463faa865ea6d6c4bccbd061a00b39cedb8d7a
6
+ metadata.gz: 7d5ae1c36ad4c16d0c7a5866d18fd4cca1155956afdd25f9d3a4b22600630d8346172d9ff8bf8787c3e7ed6ad0884ba55932715f26720e7f69cddfd6d9fc2450
7
+ data.tar.gz: cec7fabfd12ac2e6cf8cbf013bff1057e88ce02d5722f808541fd8dbd74d94c19a108854992ce082067a39a18e12808e4b3623be66495a3b562eec009ffb7390
data/.bump-version ADDED
@@ -0,0 +1,7 @@
1
+ [bumpVersion]
2
+ scheme = zero
3
+ tagPrefix = v
4
+ path = lib/rcx/version.rb
5
+ pattern = "VERSION = -'(?<version>.+?)'"
6
+ postCommand = bundle lock
7
+ postCommand = "ruby -e 'today = Time.now.strftime(%[%Y-%m-%d]); ARGV.each {|path| File.write(path, File.read(path).sub(/## Unreleased\\n\\K/i, %|\\n## v#{ENV.fetch(%[NEW_VERSION])} (#{today})\\n|)) }' CHANGELOG.md"
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## UNRELEASED
2
2
 
3
+ ## v0.4.2.alpha1 (2026-09-18)
4
+ - Fix UB in `rcx::protect`.
5
+ - Fix conversion of std::optional from/into Ruby Value.
6
+ - Support IO::Buffer version 3 (expected to be shipped with Ruby 4.1)
7
+
8
+ ## v0.4.1 (2025-09-06)
9
+ - Improved the types of the builtin classes to properly relate to the value wrappers.
10
+
3
11
  ## v0.4.0 (2025-09-03)
4
12
  - Renamed `rcx::arg` namespace to `rcx::args` to prevent conflit with `rcx::arg::arg`.
5
13
 
@@ -31,7 +31,7 @@
31
31
  #define RCX_Nonnull
32
32
  #endif
33
33
 
34
- #if RUBY_IO_BUFFER_VERSION == 2
34
+ #if RUBY_IO_BUFFER_VERSION == 2 || RUBY_IO_BUFFER_VERSION == 3
35
35
  #define RCX_IO_BUFFER
36
36
  #endif
37
37
 
@@ -71,14 +71,6 @@ namespace rcx {
71
71
  template <typename T>
72
72
  concept Void = std::is_void_v<T>;
73
73
 
74
- template <typename T>
75
- concept StringLike = requires {
76
- typename std::remove_cvref_t<T>::value_type;
77
- typename std::remove_cvref_t<T>::traits_type;
78
- typename std::basic_string_view<typename std::remove_cvref_t<T>::value_type,
79
- typename std::remove_cvref_t<T>::traits_type>;
80
- };
81
-
82
74
  /// Specifies the types that can be used as Ruby identifiers.
83
75
  ///
84
76
  /// This includes \ref rcx::Id, \ref rcx::value::Symbol and C++ strings.
@@ -410,6 +402,16 @@ namespace rcx {
410
402
  requires CharTraits<::rcx::CharTraits<std::remove_cvref_t<T>>>;
411
403
  typename std::basic_string_view<std::remove_cvref_t<T>>;
412
404
  };
405
+
406
+ /// Specifies the string types that can be mapped to Ruby strings.
407
+ ///
408
+ template <typename T>
409
+ concept StringLike = requires {
410
+ requires CharLike<typename std::remove_cvref_t<T>::value_type>;
411
+ typename std::remove_cvref_t<T>::traits_type;
412
+ typename std::basic_string_view<typename std::remove_cvref_t<T>::value_type,
413
+ typename std::remove_cvref_t<T>::traits_type>;
414
+ };
413
415
  };
414
416
 
415
417
  /// Literals
@@ -1152,7 +1154,8 @@ namespace rcx {
1152
1154
  inline value::Class const Encoding = detail::unsafe_coerce<value::Class>(::rb_cEncoding);
1153
1155
  /// `Symbol` class
1154
1156
  ///
1155
- inline value::Class const Symbol = detail::unsafe_coerce<value::Class>(::rb_cSymbol);
1157
+ inline value::ClassT<value::Symbol> const Symbol =
1158
+ detail::unsafe_coerce<value::ClassT<value::Symbol>>(::rb_cSymbol);
1156
1159
  /// `Regexp` class
1157
1160
  ///
1158
1161
  inline value::Class const Regexp = detail::unsafe_coerce<value::Class>(::rb_cRegexp);
@@ -1192,10 +1195,12 @@ namespace rcx {
1192
1195
  inline value::Class const Range = detail::unsafe_coerce<value::Class>(::rb_cRange);
1193
1196
  /// `IO` class
1194
1197
  ///
1195
- inline value::Class const IO = detail::unsafe_coerce<value::Class>(::rb_cIO);
1198
+ inline value::ClassT<value::IO> const IO =
1199
+ detail::unsafe_coerce<value::ClassT<value::IO>>(::rb_cIO);
1196
1200
  /// `File` class
1197
1201
  ///
1198
- inline value::Class const File = detail::unsafe_coerce<value::Class>(::rb_cFile);
1202
+ inline value::ClassT<value::IO> const File =
1203
+ detail::unsafe_coerce<value::ClassT<value::IO>>(::rb_cFile);
1199
1204
  /// `Thread` class
1200
1205
  ///
1201
1206
  inline value::Class const Thread = detail::unsafe_coerce<value::Class>(::rb_cThread);
@@ -1344,7 +1349,8 @@ namespace rcx {
1344
1349
  #ifdef RCX_IO_BUFFER
1345
1350
  /// `IO::Buffer` class
1346
1351
  ///
1347
- inline value::Class const IOBuffer = detail::unsafe_coerce<value::Class>(::rb_cIOBuffer);
1352
+ inline value::ClassT<value::IOBuffer> const IOBuffer =
1353
+ detail::unsafe_coerce<value::ClassT<value::IOBuffer>>(::rb_cIOBuffer);
1348
1354
  #endif
1349
1355
  };
1350
1356
 
@@ -170,7 +170,7 @@ namespace rcx {
170
170
  return;
171
171
  } else {
172
172
  std::optional<Result> result;
173
- auto callback = [&functor, &result]() { *result = functor(); };
173
+ auto callback = [&functor, &result]() { result = functor(); };
174
174
  using Callback = decltype(callback);
175
175
 
176
176
  ::rb_protect(
@@ -1245,12 +1245,12 @@ namespace rcx {
1245
1245
 
1246
1246
  template <concepts::ConvertibleFromValue T>
1247
1247
  decltype(auto) FromValue<std::optional<T>>::convert(Value v) {
1248
- return v.is_nil() ? std::nullopt : from_Value<T>(v);
1248
+ return v.is_nil() ? std::optional<T>{} : from_Value<T>(v);
1249
1249
  }
1250
1250
 
1251
1251
  template <concepts::ConvertibleIntoValue T>
1252
1252
  Value IntoValue<std::optional<T>>::convert(std::optional<T> value) {
1253
- return value ? Value::qnil : into_Value(*value);
1253
+ return value ? into_Value(*value) : Value::qnil;
1254
1254
  }
1255
1255
 
1256
1256
  template <concepts::ConvertibleFromValue... T>
data/lib/rcx/mkmf.rb CHANGED
@@ -9,6 +9,8 @@ module RCX
9
9
  'c++23' => %w[--std=c++23 --std=c++2b].freeze,
10
10
  'c++26' => %w[--std=c++26 --std=c++2c].freeze,
11
11
  }.freeze
12
+ # Ruby < 3.4.2 includes <cstdbool>, which warns with newer libstdc++.
13
+ CXX_FLAG_PROBE_WERROR = (RUBY_VERSION.split('.').map(&:to_i) <=> [3, 4, 2]) >= 0
12
14
 
13
15
  root = File.join(__dir__, '../..')
14
16
  INCDIR = File.join(root, 'include').shellescape
@@ -19,7 +21,9 @@ module RCX
19
21
 
20
22
  def setup_rcx(cxx_standard: 'c++20')
21
23
  CXX_STANDARD_FLAGS.fetch(cxx_standard).find do |flag|
22
- if checking_for("whether #{flag} is accepted as CXXFLAGS") { try_cflags(flag) }
24
+ if checking_for("whether #{flag} is accepted as CXXFLAGS") {
25
+ try_cflags(flag, werror: CXX_FLAG_PROBE_WERROR)
26
+ }
23
27
  $CXXFLAGS << " " << flag
24
28
  true
25
29
  else
data/lib/rcx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RCX
2
- VERSION = -'0.4.0'
2
+ VERSION = -'0.4.2.alpha1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rcx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.2.alpha1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kasumi Hanazuki
@@ -30,6 +30,7 @@ executables: []
30
30
  extensions: []
31
31
  extra_rdoc_files: []
32
32
  files:
33
+ - ".bump-version"
33
34
  - ".clang-format"
34
35
  - ".rspec"
35
36
  - ".yarnrc.yml"
@@ -69,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
70
  - !ruby/object:Gem::Version
70
71
  version: '0'
71
72
  requirements: []
72
- rubygems_version: 3.6.7
73
+ rubygems_version: 4.0.20
73
74
  specification_version: 4
74
75
  summary: Write Ruby extension in modern C++
75
76
  test_files: []