Skip to content

Commit 6612142

Browse files
authored
Merge pull request #2755 from ruby/cpp-warnings
Fix C++ compiler warnings
2 parents 34c1c6c + 9cbf9e4 commit 6612142

File tree

8 files changed

+55
-59
lines changed

8 files changed

+55
-59
lines changed

ext/rbs_extension/class_constants.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
#include "rbs_extension.h"
99

10-
VALUE RBS_Parser;
11-
1210
VALUE RBS;
1311
VALUE RBS_AST;
1412
VALUE RBS_AST_Declarations;

ext/rbs_extension/legacy_location.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void rbs_loc_legacy_alloc_children(rbs_loc *loc, unsigned short cap) {
3333
check_children_max(cap);
3434

3535
size_t s = RBS_LOC_CHILDREN_SIZE(cap);
36-
loc->children = malloc(s);
36+
loc->children = (rbs_loc_children *) malloc(s);
3737

3838
*loc->children = (rbs_loc_children) {
3939
.len = 0,
@@ -50,7 +50,7 @@ static void check_children_cap(rbs_loc *loc) {
5050
if (loc->children->len == loc->children->cap) {
5151
check_children_max(loc->children->cap + 1);
5252
size_t s = RBS_LOC_CHILDREN_SIZE(++loc->children->cap);
53-
loc->children = realloc(loc->children, s);
53+
loc->children = (rbs_loc_children *) realloc(loc->children, s);
5454
}
5555
}
5656
}
@@ -86,12 +86,12 @@ void rbs_loc_free(rbs_loc *loc) {
8686
}
8787

8888
static void rbs_loc_mark(void *ptr) {
89-
rbs_loc *loc = ptr;
89+
rbs_loc *loc = (rbs_loc *) ptr;
9090
rb_gc_mark(loc->buffer);
9191
}
9292

9393
static size_t rbs_loc_memsize(const void *ptr) {
94-
const rbs_loc *loc = ptr;
94+
const rbs_loc *loc = (const rbs_loc *) ptr;
9595
if (loc->children == NULL) {
9696
return sizeof(rbs_loc);
9797
} else {
@@ -117,7 +117,7 @@ static VALUE location_s_allocate(VALUE klass) {
117117
}
118118

119119
rbs_loc *rbs_check_location(VALUE obj) {
120-
return rb_check_typeddata(obj, &location_type);
120+
return (rbs_loc *) rb_check_typeddata(obj, &location_type);
121121
}
122122

123123
static VALUE location_initialize(VALUE self, VALUE buffer, VALUE start_pos, VALUE end_pos) {

include/rbs/parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ typedef struct rbs_error_t {
4444
* An RBS parser is a LL(3) parser.
4545
* */
4646
typedef struct {
47-
rbs_lexer_t *rbs_lexer_t;
47+
rbs_lexer_t *lexer;
4848

4949
rbs_token_t current_token;
5050
rbs_token_t next_token; /* The first lookahead token */

src/location.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
void rbs_loc_alloc_children(rbs_allocator_t *allocator, rbs_location_t *loc, size_t capacity) {
99
RBS_ASSERT(capacity <= sizeof(rbs_loc_entry_bitmap) * 8, "Capacity %zu is too large. Max is %zu", capacity, sizeof(rbs_loc_entry_bitmap) * 8);
1010

11-
loc->children = rbs_allocator_malloc_impl(allocator, RBS_LOC_CHILDREN_SIZE(capacity), rbs_alignof(rbs_loc_children));
11+
loc->children = (rbs_loc_children *) rbs_allocator_malloc_impl(allocator, RBS_LOC_CHILDREN_SIZE(capacity), rbs_alignof(rbs_loc_children));
1212

1313
loc->children->len = 0;
1414
loc->children->required_p = 0;

src/parser.c

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
strlen(str) \
2121
)
2222

23-
#define INTERN_TOKEN(parser, tok) \
24-
rbs_constant_pool_insert_shared_with_encoding( \
25-
&parser->constant_pool, \
26-
(const uint8_t *) rbs_peek_token(parser->rbs_lexer_t, tok), \
27-
rbs_token_bytes(tok), \
28-
(void *) parser->rbs_lexer_t->encoding \
23+
#define INTERN_TOKEN(parser, tok) \
24+
rbs_constant_pool_insert_shared_with_encoding( \
25+
&parser->constant_pool, \
26+
(const uint8_t *) rbs_peek_token(parser->lexer, tok), \
27+
rbs_token_bytes(tok), \
28+
parser->lexer->encoding \
2929
)
3030

3131
#define KEYWORD_CASES \
@@ -130,7 +130,7 @@ static bool parse_simple(rbs_parser_t *parser, rbs_node_t **type, bool void_allo
130130
static rbs_string_t rbs_parser_peek_current_token(rbs_parser_t *parser) {
131131
rbs_range_t rg = parser->current_token.range;
132132

133-
const char *start = parser->rbs_lexer_t->string.start + rg.start.byte_pos;
133+
const char *start = parser->lexer->string.start + rg.start.byte_pos;
134134
size_t length = rg.end.byte_pos - rg.start.byte_pos;
135135

136136
return rbs_string_new(start, start + length);
@@ -191,7 +191,7 @@ static bool parse_type_name(rbs_parser_t *parser, TypeNameKind kind, rbs_range_t
191191
.end = parser->current_token.range.end
192192
};
193193
rbs_location_t *loc = rbs_location_new(ALLOCATOR(), namespace_range);
194-
rbs_namespace_t *namespace = rbs_namespace_new(ALLOCATOR(), loc, path, absolute);
194+
rbs_namespace_t *ns = rbs_namespace_new(ALLOCATOR(), loc, path, absolute);
195195

196196
switch (parser->current_token.type) {
197197
case tLIDENT:
@@ -217,7 +217,7 @@ success: {
217217
rbs_location_t *symbolLoc = rbs_location_current_token(parser);
218218
rbs_constant_id_t name = INTERN_TOKEN(parser, parser->current_token);
219219
rbs_ast_symbol_t *symbol = rbs_ast_symbol_new(ALLOCATOR(), symbolLoc, &parser->constant_pool, name);
220-
*type_name = rbs_type_name_new(ALLOCATOR(), rbs_location_new(ALLOCATOR(), *rg), namespace, symbol);
220+
*type_name = rbs_type_name_new(ALLOCATOR(), rbs_location_new(ALLOCATOR(), *rg), ns, symbol);
221221
return true;
222222
}
223223

@@ -358,7 +358,7 @@ static bool parse_function_param(rbs_parser_t *parser, rbs_types_function_param_
358358
return false;
359359
}
360360

361-
rbs_string_t unquoted_str = rbs_unquote_string(ALLOCATOR(), rbs_parser_peek_current_token(parser), parser->rbs_lexer_t->encoding);
361+
rbs_string_t unquoted_str = rbs_unquote_string(ALLOCATOR(), rbs_parser_peek_current_token(parser), parser->lexer->encoding);
362362
rbs_location_t *symbolLoc = rbs_location_current_token(parser);
363363
rbs_constant_id_t constant_id = rbs_constant_pool_insert_string(&parser->constant_pool, unquoted_str);
364364
rbs_ast_symbol_t *name = rbs_ast_symbol_new(ALLOCATOR(), symbolLoc, &parser->constant_pool, constant_id);
@@ -375,9 +375,9 @@ static bool parse_function_param(rbs_parser_t *parser, rbs_types_function_param_
375375
static rbs_constant_id_t intern_token_start_end(rbs_parser_t *parser, rbs_token_t start_token, rbs_token_t end_token) {
376376
return rbs_constant_pool_insert_shared_with_encoding(
377377
&parser->constant_pool,
378-
(const uint8_t *) rbs_peek_token(parser->rbs_lexer_t, start_token),
378+
(const uint8_t *) rbs_peek_token(parser->lexer, start_token),
379379
end_token.range.end.byte_pos - start_token.range.start.byte_pos,
380-
parser->rbs_lexer_t->encoding
380+
parser->lexer->encoding
381381
);
382382
}
383383

@@ -948,7 +948,7 @@ static bool parse_record_attributes(rbs_parser_t *parser, rbs_hash_t **fields, b
948948
*/
949949
NODISCARD
950950
static bool parse_symbol(rbs_parser_t *parser, rbs_location_t *location, rbs_types_literal_t **symbol) {
951-
size_t offset_bytes = parser->rbs_lexer_t->encoding->char_width((const uint8_t *) ":", (size_t) 1);
951+
size_t offset_bytes = parser->lexer->encoding->char_width((const uint8_t *) ":", (size_t) 1);
952952
size_t bytes = rbs_token_bytes(parser->current_token) - offset_bytes;
953953

954954
rbs_ast_symbol_t *literal;
@@ -957,7 +957,7 @@ static bool parse_symbol(rbs_parser_t *parser, rbs_location_t *location, rbs_typ
957957
case tSYMBOL: {
958958
rbs_location_t *symbolLoc = rbs_location_current_token(parser);
959959

960-
char *buffer = rbs_peek_token(parser->rbs_lexer_t, parser->current_token);
960+
char *buffer = rbs_peek_token(parser->lexer, parser->current_token);
961961
rbs_constant_id_t constant_id = rbs_constant_pool_insert_shared(
962962
&parser->constant_pool,
963963
(const uint8_t *) buffer + offset_bytes,
@@ -973,7 +973,7 @@ static bool parse_symbol(rbs_parser_t *parser, rbs_location_t *location, rbs_typ
973973

974974
rbs_string_t symbol = rbs_string_new(current_token.start + offset_bytes, current_token.end);
975975

976-
rbs_string_t unquoted_symbol = rbs_unquote_string(ALLOCATOR(), symbol, parser->rbs_lexer_t->encoding);
976+
rbs_string_t unquoted_symbol = rbs_unquote_string(ALLOCATOR(), symbol, parser->lexer->encoding);
977977

978978
rbs_constant_id_t constant_id = rbs_constant_pool_insert_string(&parser->constant_pool, unquoted_symbol);
979979

@@ -997,9 +997,9 @@ static bool parse_symbol(rbs_parser_t *parser, rbs_location_t *location, rbs_typ
997997
*/
998998
NODISCARD
999999
static bool parse_instance_type(rbs_parser_t *parser, bool parse_alias, rbs_node_t **type) {
1000-
TypeNameKind expected_kind = INTERFACE_NAME | CLASS_NAME;
1000+
TypeNameKind expected_kind = (TypeNameKind) (INTERFACE_NAME | CLASS_NAME);
10011001
if (parse_alias) {
1002-
expected_kind |= ALIAS_NAME;
1002+
expected_kind = (TypeNameKind) (expected_kind | ALIAS_NAME);
10031003
}
10041004

10051005
rbs_range_t name_range;
@@ -1215,7 +1215,7 @@ static bool parse_simple(rbs_parser_t *parser, rbs_node_t **type, bool void_allo
12151215
case tDQSTRING: {
12161216
rbs_location_t *loc = rbs_location_current_token(parser);
12171217

1218-
rbs_string_t unquoted_str = rbs_unquote_string(ALLOCATOR(), rbs_parser_peek_current_token(parser), parser->rbs_lexer_t->encoding);
1218+
rbs_string_t unquoted_str = rbs_unquote_string(ALLOCATOR(), rbs_parser_peek_current_token(parser), parser->lexer->encoding);
12191219
rbs_node_t *literal = (rbs_node_t *) rbs_ast_string_new(ALLOCATOR(), loc, unquoted_str);
12201220
*type = (rbs_node_t *) rbs_types_literal_new(ALLOCATOR(), loc, literal);
12211221
return true;
@@ -1230,7 +1230,7 @@ static bool parse_simple(rbs_parser_t *parser, rbs_node_t **type, bool void_allo
12301230
return true;
12311231
}
12321232
case tUIDENT: {
1233-
const char *name_str = rbs_peek_token(parser->rbs_lexer_t, parser->current_token);
1233+
const char *name_str = rbs_peek_token(parser->lexer, parser->current_token);
12341234
size_t name_len = rbs_token_bytes(parser->current_token);
12351235

12361236
rbs_constant_id_t name = rbs_constant_pool_find(&parser->constant_pool, (const uint8_t *) name_str, name_len);
@@ -1705,12 +1705,12 @@ static bool parse_annotation(rbs_parser_t *parser, rbs_ast_annotation_t **annota
17051705
rbs_range_t rg = parser->current_token.range;
17061706

17071707
size_t offset_bytes =
1708-
parser->rbs_lexer_t->encoding->char_width((const uint8_t *) "%", (size_t) 1) +
1709-
parser->rbs_lexer_t->encoding->char_width((const uint8_t *) "a", (size_t) 1);
1708+
parser->lexer->encoding->char_width((const uint8_t *) "%", (size_t) 1) +
1709+
parser->lexer->encoding->char_width((const uint8_t *) "a", (size_t) 1);
17101710

17111711
rbs_string_t str = rbs_string_new(
1712-
parser->rbs_lexer_t->string.start + rg.start.byte_pos + offset_bytes,
1713-
parser->rbs_lexer_t->string.end
1712+
parser->lexer->string.start + rg.start.byte_pos + offset_bytes,
1713+
parser->lexer->string.end
17141714
);
17151715

17161716
// Assumes the input is ASCII compatible
@@ -1739,8 +1739,8 @@ static bool parse_annotation(rbs_parser_t *parser, rbs_ast_annotation_t **annota
17391739
return false;
17401740
}
17411741

1742-
size_t open_bytes = parser->rbs_lexer_t->encoding->char_width((const uint8_t *) &open_char, (size_t) 1);
1743-
size_t close_bytes = parser->rbs_lexer_t->encoding->char_width((const uint8_t *) &close_char, (size_t) 1);
1742+
size_t open_bytes = parser->lexer->encoding->char_width((const uint8_t *) &open_char, (size_t) 1);
1743+
size_t close_bytes = parser->lexer->encoding->char_width((const uint8_t *) &close_char, (size_t) 1);
17441744

17451745
rbs_string_t current_token = rbs_parser_peek_current_token(parser);
17461746
size_t total_offset = offset_bytes + open_bytes;
@@ -1804,9 +1804,9 @@ static bool parse_method_name(rbs_parser_t *parser, rbs_range_t *range, rbs_ast_
18041804

18051805
rbs_constant_id_t constant_id = rbs_constant_pool_insert_shared_with_encoding(
18061806
&parser->constant_pool,
1807-
(const uint8_t *) parser->rbs_lexer_t->string.start + range->start.byte_pos,
1807+
(const uint8_t *) parser->lexer->string.start + range->start.byte_pos,
18081808
range->end.byte_pos - range->start.byte_pos,
1809-
parser->rbs_lexer_t->encoding
1809+
parser->lexer->encoding
18101810
);
18111811

18121812
rbs_location_t *symbolLoc = rbs_location_new(ALLOCATOR(), *range);
@@ -1827,7 +1827,7 @@ static bool parse_method_name(rbs_parser_t *parser, rbs_range_t *range, rbs_ast_
18271827
}
18281828
case tQIDENT: {
18291829
rbs_string_t string = rbs_parser_peek_current_token(parser);
1830-
rbs_string_t unquoted_str = rbs_unquote_string(ALLOCATOR(), string, parser->rbs_lexer_t->encoding);
1830+
rbs_string_t unquoted_str = rbs_unquote_string(ALLOCATOR(), string, parser->lexer->encoding);
18311831
rbs_constant_id_t constant_id = rbs_constant_pool_insert_string(&parser->constant_pool, unquoted_str);
18321832
rbs_location_t *symbolLoc = rbs_location_current_token(parser);
18331833
*symbol = rbs_ast_symbol_new(ALLOCATOR(), symbolLoc, &parser->constant_pool, constant_id);
@@ -2131,7 +2131,7 @@ static bool parse_mixin_member(rbs_parser_t *parser, bool from_interface, rbs_po
21312131
rbs_type_name_t *name = NULL;
21322132
CHECK_PARSE(class_instance_name(
21332133
parser,
2134-
from_interface ? INTERFACE_NAME : (INTERFACE_NAME | CLASS_NAME),
2134+
from_interface ? INTERFACE_NAME : (TypeNameKind) (INTERFACE_NAME | CLASS_NAME),
21352135
args,
21362136
&name_range,
21372137
&args_range,
@@ -2597,7 +2597,7 @@ static bool parse_module_self_types(rbs_parser_t *parser, rbs_node_list_t *array
25972597

25982598
rbs_range_t name_range;
25992599
rbs_type_name_t *module_name = NULL;
2600-
CHECK_PARSE(parse_type_name(parser, CLASS_NAME | INTERFACE_NAME, &name_range, &module_name));
2600+
CHECK_PARSE(parse_type_name(parser, (TypeNameKind) (CLASS_NAME | INTERFACE_NAME), &name_range, &module_name));
26012601
self_range.end = name_range.end;
26022602

26032603
rbs_node_list_t *args = rbs_node_list_new(ALLOCATOR());
@@ -3061,7 +3061,7 @@ static bool parse_decl(rbs_parser_t *parser, rbs_node_t **decl) {
30613061
| {} <> (empty -- returns empty namespace)
30623062
*/
30633063
NODISCARD
3064-
static bool parse_namespace(rbs_parser_t *parser, rbs_range_t *rg, rbs_namespace_t **namespace) {
3064+
static bool parse_namespace(rbs_parser_t *parser, rbs_range_t *rg, rbs_namespace_t **out_ns) {
30653065
bool is_absolute = false;
30663066

30673067
if (parser->next_token.type == pCOLON2) {
@@ -3092,7 +3092,7 @@ static bool parse_namespace(rbs_parser_t *parser, rbs_range_t *rg, rbs_namespace
30923092
}
30933093
}
30943094

3095-
*namespace = rbs_namespace_new(ALLOCATOR(), rbs_location_new(ALLOCATOR(), *rg), path, is_absolute);
3095+
*out_ns = rbs_namespace_new(ALLOCATOR(), rbs_location_new(ALLOCATOR(), *rg), path, is_absolute);
30963096
return true;
30973097
}
30983098

@@ -3107,8 +3107,8 @@ NODISCARD
31073107
static bool parse_use_clauses(rbs_parser_t *parser, rbs_node_list_t *clauses) {
31083108
while (true) {
31093109
rbs_range_t namespace_range = NULL_RANGE;
3110-
rbs_namespace_t *namespace = NULL;
3111-
CHECK_PARSE(parse_namespace(parser, &namespace_range, &namespace));
3110+
rbs_namespace_t *ns = NULL;
3111+
CHECK_PARSE(parse_namespace(parser, &namespace_range, &ns));
31123112

31133113
switch (parser->next_token.type) {
31143114
case tLIDENT:
@@ -3122,7 +3122,7 @@ static bool parse_use_clauses(rbs_parser_t *parser, rbs_node_list_t *clauses) {
31223122

31233123
rbs_location_t *symbolLoc = rbs_location_current_token(parser);
31243124
rbs_ast_symbol_t *symbol = rbs_ast_symbol_new(ALLOCATOR(), symbolLoc, &parser->constant_pool, INTERN_TOKEN(parser, parser->current_token));
3125-
rbs_type_name_t *type_name = rbs_type_name_new(ALLOCATOR(), rbs_location_new(ALLOCATOR(), type_name_range), namespace, symbol);
3125+
rbs_type_name_t *type_name = rbs_type_name_new(ALLOCATOR(), rbs_location_new(ALLOCATOR(), type_name_range), ns, symbol);
31263126

31273127
rbs_range_t keyword_range = NULL_RANGE;
31283128
rbs_range_t new_name_range = NULL_RANGE;
@@ -3165,7 +3165,7 @@ static bool parse_use_clauses(rbs_parser_t *parser, rbs_node_list_t *clauses) {
31653165
rbs_loc_add_required_child(loc, INTERN("namespace"), namespace_range);
31663166
rbs_loc_add_required_child(loc, INTERN("star"), star_range);
31673167

3168-
rbs_ast_directives_use_wildcard_clause_t *clause = rbs_ast_directives_use_wildcard_clause_new(ALLOCATOR(), loc, namespace);
3168+
rbs_ast_directives_use_wildcard_clause_t *clause = rbs_ast_directives_use_wildcard_clause_new(ALLOCATOR(), loc, ns);
31693169
rbs_node_list_append(clauses, (rbs_node_t *) clause);
31703170

31713171
break;
@@ -3212,21 +3212,21 @@ static bool parse_use_directive(rbs_parser_t *parser, rbs_ast_directives_use_t *
32123212
}
32133213

32143214
static rbs_ast_comment_t *parse_comment_lines(rbs_parser_t *parser, rbs_comment_t *com) {
3215-
size_t hash_bytes = parser->rbs_lexer_t->encoding->char_width((const uint8_t *) "#", (size_t) 1);
3216-
size_t space_bytes = parser->rbs_lexer_t->encoding->char_width((const uint8_t *) " ", (size_t) 1);
3215+
size_t hash_bytes = parser->lexer->encoding->char_width((const uint8_t *) "#", (size_t) 1);
3216+
size_t space_bytes = parser->lexer->encoding->char_width((const uint8_t *) " ", (size_t) 1);
32173217

32183218
rbs_buffer_t rbs_buffer;
32193219
rbs_buffer_init(ALLOCATOR(), &rbs_buffer);
32203220

32213221
for (size_t i = 0; i < com->line_tokens_count; i++) {
32223222
rbs_token_t tok = com->line_tokens[i];
32233223

3224-
const char *comment_start = parser->rbs_lexer_t->string.start + tok.range.start.byte_pos + hash_bytes;
3224+
const char *comment_start = parser->lexer->string.start + tok.range.start.byte_pos + hash_bytes;
32253225
size_t comment_bytes = RBS_RANGE_BYTES(tok.range) - hash_bytes;
32263226

32273227
rbs_string_t str = rbs_string_new(
32283228
comment_start,
3229-
parser->rbs_lexer_t->string.end
3229+
parser->lexer->string.end
32303230
);
32313231

32323232
// Assumes the input is ASCII compatible
@@ -3446,7 +3446,7 @@ void rbs_parser_advance(rbs_parser_t *parser) {
34463446
break;
34473447
}
34483448

3449-
parser->next_token3 = rbs_lexer_next_token(parser->rbs_lexer_t);
3449+
parser->next_token3 = rbs_lexer_next_token(parser->lexer);
34503450

34513451
if (parser->next_token3.type == tCOMMENT) {
34523452
// skip
@@ -3538,7 +3538,7 @@ rbs_parser_t *rbs_parser_new(rbs_string_t string, const rbs_encoding_t *encoding
35383538
rbs_parser_t *parser = rbs_allocator_alloc(allocator, rbs_parser_t);
35393539

35403540
*parser = (rbs_parser_t) {
3541-
.rbs_lexer_t = lexer,
3541+
.lexer = lexer,
35423542

35433543
.current_token = NullToken,
35443544
.next_token = NullToken,

src/util/rbs_allocator.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ static size_t get_system_page_size(void) {
5757
static rbs_allocator_page_t *rbs_allocator_page_new(size_t payload_size) {
5858
const size_t page_header_size = sizeof(rbs_allocator_page_t);
5959

60-
rbs_allocator_page_t *page = malloc(page_header_size + payload_size);
60+
rbs_allocator_page_t *page = (rbs_allocator_page_t *) malloc(page_header_size + payload_size);
6161
page->size = payload_size;
6262
page->used = 0;
6363

6464
return page;
6565
}
6666

6767
rbs_allocator_t *rbs_allocator_init(void) {
68-
rbs_allocator_t *allocator = malloc(sizeof(rbs_allocator_t));
68+
rbs_allocator_t *allocator = (rbs_allocator_t *) malloc(sizeof(rbs_allocator_t));
6969

7070
const size_t system_page_size = get_system_page_size();
7171

src/util/rbs_constant_pool.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ rbs_constant_pool_resize(rbs_constant_pool_t *pool) {
5757
void *next = calloc(next_capacity, element_size);
5858
if (next == NULL) return false;
5959

60-
rbs_constant_pool_bucket_t *next_buckets = next;
61-
rbs_constant_t *next_constants = (void *) (((char *) next) + next_capacity * sizeof(rbs_constant_pool_bucket_t));
60+
rbs_constant_pool_bucket_t *next_buckets = (rbs_constant_pool_bucket_t *) next;
61+
rbs_constant_t *next_constants = (rbs_constant_t *) (((char *) next) + next_capacity * sizeof(rbs_constant_pool_bucket_t));
6262

6363
// For each bucket in the current constant pool, find the index in the
6464
// next constant pool, and insert it.
@@ -111,8 +111,8 @@ bool rbs_constant_pool_init(rbs_constant_pool_t *pool, uint32_t capacity) {
111111
void *memory = calloc(capacity, element_size);
112112
if (memory == NULL) return false;
113113

114-
pool->buckets = memory;
115-
pool->constants = (void *) (((char *) memory) + capacity * sizeof(rbs_constant_pool_bucket_t));
114+
pool->buckets = (rbs_constant_pool_bucket_t *) memory;
115+
pool->constants = (rbs_constant_t *) (((char *) memory) + capacity * sizeof(rbs_constant_pool_bucket_t));
116116
pool->size = 0;
117117
pool->capacity = capacity;
118118
return true;

templates/ext/rbs_extension/class_constants.c.erb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#include "rbs_extension.h"
22

3-
VALUE RBS_Parser;
4-
53
VALUE RBS;
64
VALUE RBS_AST;
75
VALUE RBS_AST_Declarations;

0 commit comments

Comments
 (0)