From 577585c2d1580e831e07dcfd1cd0d036583a4422 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 18 Feb 2014 15:17:33 +0100 Subject: [PATCH] Silence scan-build warnings about maybe uninitialized variables. --- jscompile.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/jscompile.c b/jscompile.c index b8a430a..3d0110a 100644 --- a/jscompile.c +++ b/jscompile.c @@ -821,10 +821,12 @@ static void cswitch(JF, js_Ast *ref, js_Ast *head) } } emit(J, F, OP_POP); - if (def) + if (def) { def->casejump = emitjump(J, F, OP_JUMP); - else + end = 0; + } else { end = emitjump(J, F, OP_JUMP); + } /* emit the casue clause bodies */ for (node = head; node; node = node->b) { @@ -836,7 +838,7 @@ static void cswitch(JF, js_Ast *ref, js_Ast *head) cstmlist(J, F, clause->b); } - if (!def) + if (end) label(J, F, end); } @@ -929,6 +931,8 @@ static void cstm(JF, js_Ast *stm) if (stm->b) { cexp(J, F, stm->b); end = emitjump(J, F, OP_JFALSE); + } else { + end = 0; } cstm(J, F, stm->d); cont = here(J, F); @@ -937,7 +941,7 @@ static void cstm(JF, js_Ast *stm) emit(J, F, OP_POP); } emitjumpto(J, F, OP_JUMP, loop); - if (stm->b) + if (end) label(J, F, end); labeljumps(J, F, stm->jumps, here(J,F), cont); break;