Skip to content

Commit 3b33217

Browse files
committed
Fix c++-compat warnings
Do not use `new` in C code and explicitly cast pointers.
1 parent d80ad6e commit 3b33217

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/dump.c

+16-16
Original file line numberDiff line numberDiff line change
@@ -1715,7 +1715,7 @@ static jl_value_t *jl_deserialize_value_singleton(jl_serializer_state *s, jl_val
17151715
arraylist_push(&flagref_list, (void*)pos);
17161716
}
17171717
}
1718-
jl_datatype_t *dt = (jl_datatype_t*)jl_deserialize_value(s, HT_NOTFOUND); // no loc, since if dt is replaced, then dt->instance would be also
1718+
jl_datatype_t *dt = (jl_datatype_t*)jl_deserialize_value(s, (jl_value_t**)HT_NOTFOUND); // no loc, since if dt is replaced, then dt->instance would be also
17191719
jl_set_typeof(v, dt);
17201720
return v;
17211721
}
@@ -2540,7 +2540,7 @@ static jl_datatype_t *jl_recache_type(jl_datatype_t *dt, size_t start, jl_value_
25402540
return t;
25412541
}
25422542

2543-
static void jl_update_backref_list(jl_value_t *old, jl_value_t *new, size_t start)
2543+
static void jl_update_backref_list(jl_value_t *old, jl_value_t *_new, size_t start)
25442544
{
25452545
// update the backref list
25462546
size_t j = start;
@@ -2550,9 +2550,9 @@ static void jl_update_backref_list(jl_value_t *old, jl_value_t *new, size_t star
25502550
jl_value_t *v = loc ? *loc : (jl_value_t*)backref_list.items[offs];
25512551
if ((jl_value_t*)v == old) { // same item, update this entry
25522552
if (loc)
2553-
*loc = (jl_value_t*)new;
2553+
*loc = (jl_value_t*)_new;
25542554
if (offs > 0)
2555-
backref_list.items[offs] = new;
2555+
backref_list.items[offs] = _new;
25562556
// delete this item from the flagref list, so it won't be re-encountered later
25572557
flagref_list.len -= 2;
25582558
if (j >= flagref_list.len)
@@ -2572,10 +2572,10 @@ jl_method_t *jl_recache_method(jl_method_t *m, size_t start)
25722572
jl_datatype_t *ftype = jl_first_argument_datatype((jl_value_t*)sig);
25732573
jl_methtable_t *mt = ftype->name->mt;
25742574
jl_set_typeof(m, (void*)(intptr_t)0x30); // invalidate the old value to help catch errors
2575-
jl_method_t *new = (jl_method_t*)jl_methtable_lookup(mt, sig);
2576-
assert(new && jl_is_method(new));
2577-
jl_update_backref_list((jl_value_t*)m, (jl_value_t*)new, start);
2578-
return new;
2575+
jl_method_t *_new = (jl_method_t*)jl_methtable_lookup(mt, sig);
2576+
assert(_new && jl_is_method(_new));
2577+
jl_update_backref_list((jl_value_t*)m, (jl_value_t*)_new, start);
2578+
return _new;
25792579
}
25802580

25812581
jl_method_instance_t *jl_recache_method_instance(jl_method_instance_t *li, size_t start)
@@ -2592,9 +2592,9 @@ jl_method_instance_t *jl_recache_method_instance(jl_method_instance_t *li, size_
25922592
jl_svec_t *env = jl_emptysvec;
25932593
jl_value_t *ti = jl_type_intersection_matching((jl_value_t*)m->sig, (jl_value_t*)argtypes, &env, m->tvars);
25942594
assert(ti != jl_bottom_type); (void)ti;
2595-
jl_method_instance_t *new = jl_specializations_get_linfo(m, argtypes, env);
2596-
jl_update_backref_list((jl_value_t*)li, (jl_value_t*)new, start);
2597-
return new;
2595+
jl_method_instance_t *_new = jl_specializations_get_linfo(m, argtypes, env);
2596+
jl_update_backref_list((jl_value_t*)li, (jl_value_t*)_new, start);
2597+
return _new;
25982598
}
25992599

26002600
static void jl_recache_types(void)
@@ -2603,14 +2603,14 @@ static void jl_recache_types(void)
26032603
while (i < flagref_list.len) {
26042604
jl_value_t **loc = (jl_value_t**)flagref_list.items[i++];
26052605
int offs = (int)(intptr_t)flagref_list.items[i++];
2606-
jl_value_t *new, *o = loc ? *loc : (jl_value_t*)backref_list.items[offs];
2606+
jl_value_t *_new, *o = loc ? *loc : (jl_value_t*)backref_list.items[offs];
26072607
if (jl_is_method(o)) {
26082608
// lookup the real Method based on the placeholder sig
2609-
new = (jl_value_t*)jl_recache_method((jl_method_t*)o, i);
2609+
_new = (jl_value_t*)jl_recache_method((jl_method_t*)o, i);
26102610
}
26112611
else if (jl_is_method_instance(o)) {
26122612
// lookup the real MethodInstance based on the placeholder specTypes
2613-
new = (jl_value_t*)jl_recache_method_instance((jl_method_instance_t*)o, i);
2613+
_new = (jl_value_t*)jl_recache_method_instance((jl_method_instance_t*)o, i);
26142614
}
26152615
else {
26162616
jl_value_t *v;
@@ -2648,9 +2648,9 @@ static void jl_recache_types(void)
26482648
continue;
26492649
}
26502650
if (loc)
2651-
*loc = new;
2651+
*loc = _new;
26522652
if (offs > 0)
2653-
backref_list.items[offs] = new;
2653+
backref_list.items[offs] = _new;
26542654
}
26552655
}
26562656

0 commit comments

Comments
 (0)