Skip to content

Commit

Permalink
Fix "non-trivial designated initializers not supported" errors
Browse files Browse the repository at this point in the history
With g++ v7.3.1 (used with Amazon Linux 2), compiling the extension
would fail with these errors:

```
compiling re2.cc
re2.cc:176:1: sorry, unimplemented: non-trivial designated initializers not
supported
 };
 ^
re2.cc:221:1: sorry, unimplemented: non-trivial designated initializers not
supported
 };
 ^
re2.cc:251:1: sorry, unimplemented: non-trivial designated initializers not
supported
 };
 ^
re2.cc:1610:1: sorry, unimplemented: non-trivial designated initializers not
supported
 };
 ^
```

This appears to be happening because the `parent` and `data` fields
in `rb_data_type_struct` were omitted.
  • Loading branch information
stanhu authored and mudge committed Nov 22, 2023
1 parent 5aed5c1 commit 451de2e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ext/re2/re2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ static const rb_data_type_t re2_matchdata_data_type = {
.dsize = re2_matchdata_memsize,
re2_compact_callback(re2_matchdata_compact)
},
.parent = NULL,
.data = NULL,
// IMPORTANT: WB_PROTECTED objects must only use the RB_OBJ_WRITE()
// macro to update VALUE references, as to trigger write barriers.
.flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED
Expand Down Expand Up @@ -215,6 +217,8 @@ static const rb_data_type_t re2_scanner_data_type = {
.dsize = re2_scanner_memsize,
re2_compact_callback(re2_scanner_compact)
},
.parent = NULL,
.data = NULL,
// IMPORTANT: WB_PROTECTED objects must only use the RB_OBJ_WRITE()
// macro to update VALUE references, as to trigger write barriers.
.flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED
Expand Down Expand Up @@ -245,6 +249,8 @@ static const rb_data_type_t re2_regexp_data_type = {
.dfree = re2_regexp_free,
.dsize = re2_regexp_memsize,
},
.parent = NULL,
.data = NULL,
// IMPORTANT: WB_PROTECTED objects must only use the RB_OBJ_WRITE()
// macro to update VALUE references, as to trigger write barriers.
.flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED
Expand Down Expand Up @@ -1604,6 +1610,8 @@ static const rb_data_type_t re2_set_data_type = {
.dfree = re2_set_free,
.dsize = re2_set_memsize,
},
.parent = NULL,
.data = NULL,
// IMPORTANT: WB_PROTECTED objects must only use the RB_OBJ_WRITE()
// macro to update VALUE references, as to trigger write barriers.
.flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED
Expand Down

0 comments on commit 451de2e

Please sign in to comment.