From 97a03066a174facb1e6944263f30a4c3a877d882 Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Sat, 11 Jan 2020 15:55:08 -0500 Subject: fixed clang warning --- eval.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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)) -- cgit v1.2.3