summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-01-11 15:55:08 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2020-01-11 15:55:08 -0500
commit97a03066a174facb1e6944263f30a4c3a877d882 (patch)
tree061cf95e614cf4535682ded3a88133a82794de2f
parentd59df2fad1031728b2b0004327f73f46c3beb56a (diff)
fixed clang warning
-rw-r--r--eval.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index b9604f1..28a8134 100644
--- a/eval.c
+++ b/eval.c
@@ -994,9 +994,16 @@ static Value val_alloc(Allocator *a, Type *t) {
case TYPE_ARR:
val.arr = allocr_calloc(a, t->arr.n, compiler_sizeof(t->arr.of));
break;
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wsometimes-uninitialized"
+#endif
default: break;
}
return val;
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
}
static bool val_is_nonnegative(Value *v, Type *t) {
@@ -1517,8 +1524,8 @@ static bool eval_expr(Evaluator *ev, Expression *e, Value *v) {
err_print(e->where, "Slice index out of bounds (to = %lu, length = %lu).", (unsigned long)to, (unsigned long)n);
return false;
}
- void *ptr1, *ptr2;
if (from < to) {
+ void *ptr1 = NULL, *ptr2 = NULL;
if (!eval_val_ptr_at_index(e->where, &ofv, from, of_type, &ptr1, NULL))
return false;
if (!eval_val_ptr_at_index(e->where, &ofv, to, of_type, &ptr2, NULL))