Skip to content

Commit eb7f09e

Browse files
committed
More compiler warning cleanups.
1 parent 7995664 commit eb7f09e

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

src/6model/knowhow_bootstrapper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static void compose(PARROT_INTERP, PMC *nci) {
105105
STABLE(obj)->method_cache = ((KnowHOWREPRInstance *)PMC_data(self))->body.methods;
106106
STABLE(obj)->mode_flags = METHOD_CACHE_AUTHORITATIVE;
107107
STABLE(obj)->type_check_cache_length = 1;
108-
STABLE(obj)->type_check_cache = mem_sys_allocate(sizeof(PMC *));
108+
STABLE(obj)->type_check_cache = (PMC **)mem_sys_allocate(sizeof(PMC *));
109109
STABLE(obj)->type_check_cache[0] = obj;
110110
unused = Parrot_pcc_build_call_from_c_args(interp, capture, "P", obj);
111111
}

src/6model/repr_registry.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ static void register_repr(PARROT_INTERP, STRING *name, REPROps *repr) {
156156
INTVAL ID = num_reprs;
157157
num_reprs++;
158158
if (repr_registry)
159-
repr_registry = mem_sys_realloc(repr_registry, num_reprs * sizeof(REPROps *));
159+
repr_registry = (REPROps **)mem_sys_realloc(repr_registry, num_reprs * sizeof(REPROps *));
160160
else
161-
repr_registry = mem_sys_allocate(num_reprs * sizeof(REPROps *));
161+
repr_registry = (REPROps **)mem_sys_allocate(num_reprs * sizeof(REPROps *));
162162
repr_registry[ID] = repr;
163163
VTABLE_set_integer_keyed_str(interp, repr_name_to_id_map, name, ID);
164164
repr->ID = ID;
@@ -173,7 +173,7 @@ static void register_repr(PARROT_INTERP, STRING *name, REPROps *repr) {
173173

174174
/* Dynamically registers a representation (that is, one defined outside of
175175
* the 6model core). */
176-
INTVAL REPR_register_dynamic(PARROT_INTERP, STRING *name, REPROps * (*reg) (PARROT_INTERP, void *, void *)) {
176+
static INTVAL REPR_register_dynamic(PARROT_INTERP, STRING *name, REPROps * (*reg) (PARROT_INTERP, void *, void *)) {
177177
REPROps *repr = reg(interp, wrap_object, create_stable);
178178
register_repr(interp, name, repr);
179179
return repr->ID;

src/6model/reprs/P6opaque.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -979,12 +979,12 @@ static void serialize_repr_data(PARROT_INTERP, STable *st, SerializationWriter *
979979

980980
/* Deserializes the data. */
981981
static void deserialize_repr_data(PARROT_INTERP, STable *st, SerializationReader *reader) {
982-
P6opaqueREPRData *repr_data = st->REPR_data = mem_sys_allocate_zeroed(sizeof(P6opaqueREPRData));
982+
P6opaqueREPRData *repr_data = (P6opaqueREPRData *) (st->REPR_data = mem_sys_allocate_zeroed(sizeof(P6opaqueREPRData)));
983983
INTVAL i, num_classes, cur_offset, cur_initialize_slot, cur_gc_mark_slot, cur_gc_cleanup_slot;
984984

985985
repr_data->num_attributes = reader->read_int(interp, reader);
986986

987-
repr_data->flattened_stables = mem_sys_allocate(MAX(repr_data->num_attributes, 1) * sizeof(STable *));
987+
repr_data->flattened_stables = (STable **)mem_sys_allocate(MAX(repr_data->num_attributes, 1) * sizeof(STable *));
988988
for (i = 0; i < repr_data->num_attributes; i++)
989989
if (reader->read_int(interp, reader))
990990
repr_data->flattened_stables[i] = reader->read_stable_ref(interp, reader);
@@ -994,7 +994,7 @@ static void deserialize_repr_data(PARROT_INTERP, STable *st, SerializationReader
994994
repr_data->mi = reader->read_int(interp, reader);
995995

996996
if (reader->read_int(interp, reader)) {
997-
repr_data->auto_viv_values = mem_sys_allocate(MAX(repr_data->num_attributes, 1) * sizeof(PMC *));
997+
repr_data->auto_viv_values = (PMC **)mem_sys_allocate(MAX(repr_data->num_attributes, 1) * sizeof(PMC *));
998998
for (i = 0; i < repr_data->num_attributes; i++)
999999
repr_data->auto_viv_values[i] = reader->read_ref(interp, reader);
10001000
}
@@ -1004,27 +1004,27 @@ static void deserialize_repr_data(PARROT_INTERP, STable *st, SerializationReader
10041004
repr_data->unbox_str_slot = reader->read_int(interp, reader);
10051005

10061006
if (reader->read_int(interp, reader)) {
1007-
repr_data->unbox_slots = mem_sys_allocate(MAX(repr_data->num_attributes, 1) * sizeof(P6opaqueBoxedTypeMap));
1007+
repr_data->unbox_slots = (P6opaqueBoxedTypeMap *)mem_sys_allocate(MAX(repr_data->num_attributes, 1) * sizeof(P6opaqueBoxedTypeMap));
10081008
for (i = 0; i < repr_data->num_attributes; i++) {
10091009
repr_data->unbox_slots[i].repr_id = reader->read_int(interp, reader);
10101010
repr_data->unbox_slots[i].slot = reader->read_int(interp, reader);
10111011
}
10121012
}
10131013

10141014
num_classes = reader->read_int(interp, reader);
1015-
repr_data->name_to_index_mapping = mem_sys_allocate_zeroed((num_classes + 1) * sizeof(P6opaqueNameMap));
1015+
repr_data->name_to_index_mapping = (P6opaqueNameMap *)mem_sys_allocate_zeroed((num_classes + 1) * sizeof(P6opaqueNameMap));
10161016
for (i = 0; i < num_classes; i++) {
10171017
repr_data->name_to_index_mapping[i].class_key = reader->read_ref(interp, reader);
10181018
repr_data->name_to_index_mapping[i].name_map = reader->read_ref(interp, reader);
10191019
}
10201020

10211021
/* Re-calculate the remaining info, which is platform specific or
10221022
* derived information. */
1023-
repr_data->attribute_offsets = mem_sys_allocate(MAX(repr_data->num_attributes, 1) * sizeof(INTVAL));
1024-
repr_data->gc_pmc_mark_offsets = mem_sys_allocate(MAX(repr_data->num_attributes, 1) * sizeof(INTVAL));
1025-
repr_data->initialize_slots = mem_sys_allocate((repr_data->num_attributes + 1) * sizeof(INTVAL));
1026-
repr_data->gc_mark_slots = mem_sys_allocate((repr_data->num_attributes + 1) * sizeof(INTVAL));
1027-
repr_data->gc_cleanup_slots = mem_sys_allocate((repr_data->num_attributes + 1) * sizeof(INTVAL));
1023+
repr_data->attribute_offsets = (INTVAL *)mem_sys_allocate(MAX(repr_data->num_attributes, 1) * sizeof(INTVAL));
1024+
repr_data->gc_pmc_mark_offsets = (INTVAL *)mem_sys_allocate(MAX(repr_data->num_attributes, 1) * sizeof(INTVAL));
1025+
repr_data->initialize_slots = (INTVAL *)mem_sys_allocate((repr_data->num_attributes + 1) * sizeof(INTVAL));
1026+
repr_data->gc_mark_slots = (INTVAL *)mem_sys_allocate((repr_data->num_attributes + 1) * sizeof(INTVAL));
1027+
repr_data->gc_cleanup_slots = (INTVAL *)mem_sys_allocate((repr_data->num_attributes + 1) * sizeof(INTVAL));
10281028
repr_data->gc_pmc_mark_offsets_count = 0;
10291029
cur_offset = 0;
10301030
cur_initialize_slot = 0;

src/6model/serialization.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ static void get_stable_ref_info(PARROT_INTERP, SerializationWriter *writer,
182182
}
183183

184184
/* Expands current target storage as needed. */
185-
void expand_storage_if_needed(PARROT_INTERP, SerializationWriter *writer, INTVAL need) {
185+
static void expand_storage_if_needed(PARROT_INTERP, SerializationWriter *writer, INTVAL need) {
186186
if (*(writer->cur_write_offset) + need > *(writer->cur_write_limit)) {
187187
*(writer->cur_write_limit) *= 2;
188188
*(writer->cur_write_buffer) = (char *)mem_sys_realloc(*(writer->cur_write_buffer),
@@ -191,29 +191,29 @@ void expand_storage_if_needed(PARROT_INTERP, SerializationWriter *writer, INTVAL
191191
}
192192

193193
/* Writing function for native integers. */
194-
void write_int_func(PARROT_INTERP, SerializationWriter *writer, INTVAL value) {
194+
static void write_int_func(PARROT_INTERP, SerializationWriter *writer, INTVAL value) {
195195
expand_storage_if_needed(interp, writer, 8);
196196
write_int64(*(writer->cur_write_buffer), *(writer->cur_write_offset), value);
197197
*(writer->cur_write_offset) += 8;
198198
}
199199

200200
/* Writing function for native numbers. */
201-
void write_num_func(PARROT_INTERP, SerializationWriter *writer, FLOATVAL value) {
201+
static void write_num_func(PARROT_INTERP, SerializationWriter *writer, FLOATVAL value) {
202202
expand_storage_if_needed(interp, writer, 8);
203203
write_double(*(writer->cur_write_buffer), *(writer->cur_write_offset), value);
204204
*(writer->cur_write_offset) += 8;
205205
}
206206

207207
/* Writing function for native strings. */
208-
void write_str_func(PARROT_INTERP, SerializationWriter *writer, STRING *value) {
208+
static void write_str_func(PARROT_INTERP, SerializationWriter *writer, STRING *value) {
209209
Parrot_Int4 heap_loc = add_string_to_heap(interp, writer, value);
210210
expand_storage_if_needed(interp, writer, 4);
211211
write_int32(*(writer->cur_write_buffer), *(writer->cur_write_offset), heap_loc);
212212
*(writer->cur_write_offset) += 4;
213213
}
214214

215215
/* Writes an object reference. */
216-
void write_obj_ref(PARROT_INTERP, SerializationWriter *writer, PMC *ref) {
216+
static void write_obj_ref(PARROT_INTERP, SerializationWriter *writer, PMC *ref) {
217217
Parrot_Int4 sc_id, idx;
218218

219219
if (PMC_IS_NULL(SC_PMC(ref))) {
@@ -578,7 +578,7 @@ void write_ref_func(PARROT_INTERP, SerializationWriter *writer, PMC *ref) {
578578
}
579579

580580
/* Writing function for references to STables. */
581-
void write_stable_ref_func(PARROT_INTERP, SerializationWriter *writer, STable *st) {
581+
static void write_stable_ref_func(PARROT_INTERP, SerializationWriter *writer, STable *st) {
582582
Parrot_Int4 sc_id, idx;
583583
get_stable_ref_info(interp, writer, st->stable_pmc, &sc_id, &idx);
584584
expand_storage_if_needed(interp, writer, 8);
@@ -1111,15 +1111,15 @@ static PMC * lookup_stable(PARROT_INTERP, SerializationReader *reader, Parrot_In
11111111
}
11121112

11131113
/* Ensure that we aren't going to read off the end of the buffer. */
1114-
void assert_can_read(PARROT_INTERP, SerializationReader *reader, INTVAL amount) {
1114+
static void assert_can_read(PARROT_INTERP, SerializationReader *reader, INTVAL amount) {
11151115
char *read_end = *(reader->cur_read_buffer) + *(reader->cur_read_offset) + amount;
11161116
if (read_end > *(reader->cur_read_end))
11171117
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
11181118
"Read past end of serialization data buffer");
11191119
}
11201120

11211121
/* Reading function for native integers. */
1122-
INTVAL read_int_func(PARROT_INTERP, SerializationReader *reader) {
1122+
static INTVAL read_int_func(PARROT_INTERP, SerializationReader *reader) {
11231123
INTVAL result;
11241124
assert_can_read(interp, reader, 8);
11251125
result = read_int64(*(reader->cur_read_buffer), *(reader->cur_read_offset));
@@ -1128,7 +1128,7 @@ INTVAL read_int_func(PARROT_INTERP, SerializationReader *reader) {
11281128
}
11291129

11301130
/* Reading function for native numbers. */
1131-
FLOATVAL read_num_func(PARROT_INTERP, SerializationReader *reader) {
1131+
static FLOATVAL read_num_func(PARROT_INTERP, SerializationReader *reader) {
11321132
FLOATVAL result;
11331133
assert_can_read(interp, reader, 8);
11341134
result = read_double(*(reader->cur_read_buffer), *(reader->cur_read_offset));
@@ -1137,7 +1137,7 @@ FLOATVAL read_num_func(PARROT_INTERP, SerializationReader *reader) {
11371137
}
11381138

11391139
/* Reading function for native strings. */
1140-
STRING * read_str_func(PARROT_INTERP, SerializationReader *reader) {
1140+
static STRING * read_str_func(PARROT_INTERP, SerializationReader *reader) {
11411141
STRING *result;
11421142
assert_can_read(interp, reader, 4);
11431143
result = read_string_from_heap(interp, reader,
@@ -1147,7 +1147,7 @@ STRING * read_str_func(PARROT_INTERP, SerializationReader *reader) {
11471147
}
11481148

11491149
/* Reads in and resolves an object references. */
1150-
PMC * read_obj_ref(PARROT_INTERP, SerializationReader *reader) {
1150+
static PMC * read_obj_ref(PARROT_INTERP, SerializationReader *reader) {
11511151
Parrot_Int4 sc_id, idx;
11521152

11531153
assert_can_read(interp, reader, 8);
@@ -1237,7 +1237,7 @@ static PMC * read_hash_str_var(PARROT_INTERP, SerializationReader *reader) {
12371237
}
12381238

12391239
/* Reads in a code reference. */
1240-
PMC * read_code_ref(PARROT_INTERP, SerializationReader *reader) {
1240+
static PMC * read_code_ref(PARROT_INTERP, SerializationReader *reader) {
12411241
Parrot_Int4 sc_id, idx;
12421242

12431243
assert_can_read(interp, reader, 8);
@@ -1297,7 +1297,7 @@ PMC * read_ref_func(PARROT_INTERP, SerializationReader *reader) {
12971297
}
12981298

12991299
/* Reading function for STable references. */
1300-
STable * read_stable_ref_func(PARROT_INTERP, SerializationReader *reader) {
1300+
static STable * read_stable_ref_func(PARROT_INTERP, SerializationReader *reader) {
13011301
Parrot_Int4 sc_id, idx;
13021302

13031303
assert_can_read(interp, reader, 8);
@@ -1684,7 +1684,7 @@ static void deserialize_object(PARROT_INTERP, SerializationReader *reader, INTVA
16841684
}
16851685

16861686
/* Repossess an object or STable. */
1687-
void repossess(PARROT_INTERP, SerializationReader *reader, INTVAL i) {
1687+
static void repossess(PARROT_INTERP, SerializationReader *reader, INTVAL i) {
16881688
/* Calculate location of table row. */
16891689
char *table_row = reader->root.repos_table + i * REPOS_TABLE_ENTRY_SIZE;
16901690

0 commit comments

Comments
 (0)