Skip to content

Commit 703e3f4

Browse files
committed
Merge pull request #2755 from ruby/cpp-warnings
Fix C++ compiler warnings
1 parent 6bd99d9 commit 703e3f4

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 \
@@ -128,7 +128,7 @@ static bool parse_simple(rbs_parser_t *parser, rbs_node_t **type);
128128
static rbs_string_t rbs_parser_peek_current_token(rbs_parser_t *parser) {
129129
rbs_range_t rg = parser->current_token.range;
130130

131-
const char *start = parser->rbs_lexer_t->string.start + rg.start.byte_pos;
131+
const char *start = parser->lexer->string.start + rg.start.byte_pos;
132132
size_t length = rg.end.byte_pos - rg.start.byte_pos;
133133

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

194194
switch (parser->current_token.type) {
195195
case tLIDENT:
@@ -213,7 +213,7 @@ success: {
213213
rbs_location_t *symbolLoc = rbs_location_current_token(parser);
214214
rbs_constant_id_t name = INTERN_TOKEN(parser, parser->current_token);
215215
rbs_ast_symbol_t *symbol = rbs_ast_symbol_new(ALLOCATOR(), symbolLoc, &parser->constant_pool, name);
216-
*type_name = rbs_type_name_new(ALLOCATOR(), rbs_location_new(ALLOCATOR(), *rg), namespace, symbol);
216+
*type_name = rbs_type_name_new(ALLOCATOR(), rbs_location_new(ALLOCATOR(), *rg), ns, symbol);
217217
return true;
218218
}
219219

@@ -317,7 +317,7 @@ static bool parse_function_param(rbs_parser_t *parser, rbs_types_function_param_
317317
return false;
318318
}
319319

320-
rbs_string_t unquoted_str = rbs_unquote_string(ALLOCATOR(), rbs_parser_peek_current_token(parser), parser->rbs_lexer_t->encoding);
320+
rbs_string_t unquoted_str = rbs_unquote_string(ALLOCATOR(), rbs_parser_peek_current_token(parser), parser->lexer->encoding);
321321
rbs_location_t *symbolLoc = rbs_location_current_token(parser);
322322
rbs_constant_id_t constant_id = rbs_constant_pool_insert_string(&parser->constant_pool, unquoted_str);
323323
rbs_ast_symbol_t *name = rbs_ast_symbol_new(ALLOCATOR(), symbolLoc, &parser->constant_pool, constant_id);
@@ -334,9 +334,9 @@ static bool parse_function_param(rbs_parser_t *parser, rbs_types_function_param_
334334
static rbs_constant_id_t intern_token_start_end(rbs_parser_t *parser, rbs_token_t start_token, rbs_token_t end_token) {
335335
return rbs_constant_pool_insert_shared_with_encoding(
336336
&parser->constant_pool,
337-
(const uint8_t *) rbs_peek_token(parser->rbs_lexer_t, start_token),
337+
(const uint8_t *) rbs_peek_token(parser->lexer, start_token),
338338
end_token.range.end.byte_pos - start_token.range.start.byte_pos,
339-
parser->rbs_lexer_t->encoding
339+
parser->lexer->encoding
340340
);
341341
}
342342

@@ -902,7 +902,7 @@ static bool parse_record_attributes(rbs_parser_t *parser, rbs_hash_t **fields) {
902902
*/
903903
NODISCARD
904904
static bool parse_symbol(rbs_parser_t *parser, rbs_location_t *location, rbs_types_literal_t **symbol) {
905-
size_t offset_bytes = parser->rbs_lexer_t->encoding->char_width((const uint8_t *) ":", (size_t) 1);
905+
size_t offset_bytes = parser->lexer->encoding->char_width((const uint8_t *) ":", (size_t) 1);
906906
size_t bytes = rbs_token_bytes(parser->current_token) - offset_bytes;
907907

908908
rbs_ast_symbol_t *literal;
@@ -911,7 +911,7 @@ static bool parse_symbol(rbs_parser_t *parser, rbs_location_t *location, rbs_typ
911911
case tSYMBOL: {
912912
rbs_location_t *symbolLoc = rbs_location_current_token(parser);
913913

914-
char *buffer = rbs_peek_token(parser->rbs_lexer_t, parser->current_token);
914+
char *buffer = rbs_peek_token(parser->lexer, parser->current_token);
915915
rbs_constant_id_t constant_id = rbs_constant_pool_insert_shared(
916916
&parser->constant_pool,
917917
(const uint8_t *) buffer + offset_bytes,
@@ -927,7 +927,7 @@ static bool parse_symbol(rbs_parser_t *parser, rbs_location_t *location, rbs_typ
927927

928928
rbs_string_t symbol = rbs_string_new(current_token.start + offset_bytes, current_token.end);
929929

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

932932
rbs_constant_id_t constant_id = rbs_constant_pool_insert_string(&parser->constant_pool, unquoted_symbol);
933933

@@ -951,9 +951,9 @@ static bool parse_symbol(rbs_parser_t *parser, rbs_location_t *location, rbs_typ
951951
*/
952952
NODISCARD
953953
static bool parse_instance_type(rbs_parser_t *parser, bool parse_alias, rbs_node_t **type) {
954-
TypeNameKind expected_kind = INTERFACE_NAME | CLASS_NAME;
954+
TypeNameKind expected_kind = (TypeNameKind) (INTERFACE_NAME | CLASS_NAME);
955955
if (parse_alias) {
956-
expected_kind |= ALIAS_NAME;
956+
expected_kind = (TypeNameKind) (expected_kind | ALIAS_NAME);
957957
}
958958

959959
rbs_range_t name_range;
@@ -1157,7 +1157,7 @@ static bool parse_simple(rbs_parser_t *parser, rbs_node_t **type) {
11571157
case tDQSTRING: {
11581158
rbs_location_t *loc = rbs_location_current_token(parser);
11591159

1160-
rbs_string_t unquoted_str = rbs_unquote_string(ALLOCATOR(), rbs_parser_peek_current_token(parser), parser->rbs_lexer_t->encoding);
1160+
rbs_string_t unquoted_str = rbs_unquote_string(ALLOCATOR(), rbs_parser_peek_current_token(parser), parser->lexer->encoding);
11611161
rbs_node_t *literal = (rbs_node_t *) rbs_ast_string_new(ALLOCATOR(), loc, unquoted_str);
11621162
*type = (rbs_node_t *) rbs_types_literal_new(ALLOCATOR(), loc, literal);
11631163
return true;
@@ -1172,7 +1172,7 @@ static bool parse_simple(rbs_parser_t *parser, rbs_node_t **type) {
11721172
return true;
11731173
}
11741174
case tUIDENT: {
1175-
const char *name_str = rbs_peek_token(parser->rbs_lexer_t, parser->current_token);
1175+
const char *name_str = rbs_peek_token(parser->lexer, parser->current_token);
11761176
size_t name_len = rbs_token_bytes(parser->current_token);
11771177

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

16081608
size_t offset_bytes =
1609-
parser->rbs_lexer_t->encoding->char_width((const uint8_t *) "%", (size_t) 1) +
1610-
parser->rbs_lexer_t->encoding->char_width((const uint8_t *) "a", (size_t) 1);
1609+
parser->lexer->encoding->char_width((const uint8_t *) "%", (size_t) 1) +
1610+
parser->lexer->encoding->char_width((const uint8_t *) "a", (size_t) 1);
16111611

16121612
rbs_string_t str = rbs_string_new(
1613-
parser->rbs_lexer_t->string.start + rg.start.byte_pos + offset_bytes,
1614-
parser->rbs_lexer_t->string.end
1613+
parser->lexer->string.start + rg.start.byte_pos + offset_bytes,
1614+
parser->lexer->string.end
16151615
);
16161616

16171617
// Assumes the input is ASCII compatible
@@ -1640,8 +1640,8 @@ static bool parse_annotation(rbs_parser_t *parser, rbs_ast_annotation_t **annota
16401640
return false;
16411641
}
16421642

1643-
size_t open_bytes = parser->rbs_lexer_t->encoding->char_width((const uint8_t *) &open_char, (size_t) 1);
1644-
size_t close_bytes = parser->rbs_lexer_t->encoding->char_width((const uint8_t *) &close_char, (size_t) 1);
1643+
size_t open_bytes = parser->lexer->encoding->char_width((const uint8_t *) &open_char, (size_t) 1);
1644+
size_t close_bytes = parser->lexer->encoding->char_width((const uint8_t *) &close_char, (size_t) 1);
16451645

16461646
rbs_string_t current_token = rbs_parser_peek_current_token(parser);
16471647
size_t total_offset = offset_bytes + open_bytes;
@@ -1705,9 +1705,9 @@ static bool parse_method_name(rbs_parser_t *parser, rbs_range_t *range, rbs_ast_
17051705

17061706
rbs_constant_id_t constant_id = rbs_constant_pool_insert_shared_with_encoding(
17071707
&parser->constant_pool,
1708-
(const uint8_t *) parser->rbs_lexer_t->string.start + range->start.byte_pos,
1708+
(const uint8_t *) parser->lexer->string.start + range->start.byte_pos,
17091709
range->end.byte_pos - range->start.byte_pos,
1710-
parser->rbs_lexer_t->encoding
1710+
parser->lexer->encoding
17111711
);
17121712

17131713
rbs_location_t *symbolLoc = rbs_location_new(ALLOCATOR(), *range);
@@ -1728,7 +1728,7 @@ static bool parse_method_name(rbs_parser_t *parser, rbs_range_t *range, rbs_ast_
17281728
}
17291729
case tQIDENT: {
17301730
rbs_string_t string = rbs_parser_peek_current_token(parser);
1731-
rbs_string_t unquoted_str = rbs_unquote_string(ALLOCATOR(), string, parser->rbs_lexer_t->encoding);
1731+
rbs_string_t unquoted_str = rbs_unquote_string(ALLOCATOR(), string, parser->lexer->encoding);
17321732
rbs_constant_id_t constant_id = rbs_constant_pool_insert_string(&parser->constant_pool, unquoted_str);
17331733
rbs_location_t *symbolLoc = rbs_location_current_token(parser);
17341734
*symbol = rbs_ast_symbol_new(ALLOCATOR(), symbolLoc, &parser->constant_pool, constant_id);
@@ -2031,7 +2031,7 @@ static bool parse_mixin_member(rbs_parser_t *parser, bool from_interface, rbs_po
20312031
rbs_type_name_t *name = NULL;
20322032
CHECK_PARSE(class_instance_name(
20332033
parser,
2034-
from_interface ? INTERFACE_NAME : (INTERFACE_NAME | CLASS_NAME),
2034+
from_interface ? INTERFACE_NAME : (TypeNameKind) (INTERFACE_NAME | CLASS_NAME),
20352035
args,
20362036
&name_range,
20372037
&args_range,
@@ -2496,7 +2496,7 @@ static bool parse_module_self_types(rbs_parser_t *parser, rbs_node_list_t *array
24962496

24972497
rbs_range_t name_range;
24982498
rbs_type_name_t *module_name = NULL;
2499-
CHECK_PARSE(parse_type_name(parser, CLASS_NAME | INTERFACE_NAME, &name_range, &module_name));
2499+
CHECK_PARSE(parse_type_name(parser, (TypeNameKind) (CLASS_NAME | INTERFACE_NAME), &name_range, &module_name));
25002500
self_range.end = name_range.end;
25012501

25022502
rbs_node_list_t *args = rbs_node_list_new(ALLOCATOR());
@@ -2959,7 +2959,7 @@ static bool parse_decl(rbs_parser_t *parser, rbs_node_t **decl) {
29592959
| {} <> (empty -- returns empty namespace)
29602960
*/
29612961
NODISCARD
2962-
static bool parse_namespace(rbs_parser_t *parser, rbs_range_t *rg, rbs_namespace_t **namespace) {
2962+
static bool parse_namespace(rbs_parser_t *parser, rbs_range_t *rg, rbs_namespace_t **out_ns) {
29632963
bool is_absolute = false;
29642964

29652965
if (parser->next_token.type == pCOLON2) {
@@ -2990,7 +2990,7 @@ static bool parse_namespace(rbs_parser_t *parser, rbs_range_t *rg, rbs_namespace
29902990
}
29912991
}
29922992

2993-
*namespace = rbs_namespace_new(ALLOCATOR(), rbs_location_new(ALLOCATOR(), *rg), path, is_absolute);
2993+
*out_ns = rbs_namespace_new(ALLOCATOR(), rbs_location_new(ALLOCATOR(), *rg), path, is_absolute);
29942994
return true;
29952995
}
29962996

@@ -3005,8 +3005,8 @@ NODISCARD
30053005
static bool parse_use_clauses(rbs_parser_t *parser, rbs_node_list_t *clauses) {
30063006
while (true) {
30073007
rbs_range_t namespace_range = NULL_RANGE;
3008-
rbs_namespace_t *namespace = NULL;
3009-
CHECK_PARSE(parse_namespace(parser, &namespace_range, &namespace));
3008+
rbs_namespace_t *ns = NULL;
3009+
CHECK_PARSE(parse_namespace(parser, &namespace_range, &ns));
30103010

30113011
switch (parser->next_token.type) {
30123012
case tLIDENT:
@@ -3020,7 +3020,7 @@ static bool parse_use_clauses(rbs_parser_t *parser, rbs_node_list_t *clauses) {
30203020

30213021
rbs_location_t *symbolLoc = rbs_location_current_token(parser);
30223022
rbs_ast_symbol_t *symbol = rbs_ast_symbol_new(ALLOCATOR(), symbolLoc, &parser->constant_pool, INTERN_TOKEN(parser, parser->current_token));
3023-
rbs_type_name_t *type_name = rbs_type_name_new(ALLOCATOR(), rbs_location_new(ALLOCATOR(), type_name_range), namespace, symbol);
3023+
rbs_type_name_t *type_name = rbs_type_name_new(ALLOCATOR(), rbs_location_new(ALLOCATOR(), type_name_range), ns, symbol);
30243024

30253025
rbs_range_t keyword_range = NULL_RANGE;
30263026
rbs_range_t new_name_range = NULL_RANGE;
@@ -3063,7 +3063,7 @@ static bool parse_use_clauses(rbs_parser_t *parser, rbs_node_list_t *clauses) {
30633063
rbs_loc_add_required_child(loc, INTERN("namespace"), namespace_range);
30643064
rbs_loc_add_required_child(loc, INTERN("star"), star_range);
30653065

3066-
rbs_ast_directives_use_wildcard_clause_t *clause = rbs_ast_directives_use_wildcard_clause_new(ALLOCATOR(), loc, namespace);
3066+
rbs_ast_directives_use_wildcard_clause_t *clause = rbs_ast_directives_use_wildcard_clause_new(ALLOCATOR(), loc, ns);
30673067
rbs_node_list_append(clauses, (rbs_node_t *) clause);
30683068

30693069
break;
@@ -3110,21 +3110,21 @@ static bool parse_use_directive(rbs_parser_t *parser, rbs_ast_directives_use_t *
31103110
}
31113111

31123112
static rbs_ast_comment_t *parse_comment_lines(rbs_parser_t *parser, rbs_comment_t *com) {
3113-
size_t hash_bytes = parser->rbs_lexer_t->encoding->char_width((const uint8_t *) "#", (size_t) 1);
3114-
size_t space_bytes = parser->rbs_lexer_t->encoding->char_width((const uint8_t *) " ", (size_t) 1);
3113+
size_t hash_bytes = parser->lexer->encoding->char_width((const uint8_t *) "#", (size_t) 1);
3114+
size_t space_bytes = parser->lexer->encoding->char_width((const uint8_t *) " ", (size_t) 1);
31153115

31163116
rbs_buffer_t rbs_buffer;
31173117
rbs_buffer_init(ALLOCATOR(), &rbs_buffer);
31183118

31193119
for (size_t i = 0; i < com->line_tokens_count; i++) {
31203120
rbs_token_t tok = com->line_tokens[i];
31213121

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

31253125
rbs_string_t str = rbs_string_new(
31263126
comment_start,
3127-
parser->rbs_lexer_t->string.end
3127+
parser->lexer->string.end
31283128
);
31293129

31303130
// Assumes the input is ASCII compatible
@@ -3344,7 +3344,7 @@ void rbs_parser_advance(rbs_parser_t *parser) {
33443344
break;
33453345
}
33463346

3347-
parser->next_token3 = rbs_lexer_next_token(parser->rbs_lexer_t);
3347+
parser->next_token3 = rbs_lexer_next_token(parser->lexer);
33483348

33493349
if (parser->next_token3.type == tCOMMENT) {
33503350
// skip
@@ -3436,7 +3436,7 @@ rbs_parser_t *rbs_parser_new(rbs_string_t string, const rbs_encoding_t *encoding
34363436
rbs_parser_t *parser = rbs_allocator_alloc(allocator, rbs_parser_t);
34373437

34383438
*parser = (rbs_parser_t) {
3439-
.rbs_lexer_t = lexer,
3439+
.lexer = lexer,
34403440

34413441
.current_token = NullToken,
34423442
.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)