Avoid GCC warnings when for loop variable is unused
@@ -960,7 +960,6 @@ generate_stat = function(stat, ctx)
ctx:end_scope()
return util.render([[
- {
${START_STAT}
${START_DECL} = ${START_VALUE};
${FINISH_STAT}
@@ -968,11 +967,11 @@ generate_stat = function(stat, ctx)
${INC_STAT}
${INC_DECL} = ${INC_VALUE};
while (${LOOP_COND}) {
- ${LOOP_DECL} = ${START};
+ ${LOOPVAR_DECL} = ${START};
+ (void) ${LOOPVAR};
${BLOCK}
${LOOP_STEP}
}
- }
]], {
START = start.name,
START_STAT = start_cstats,
@@ -986,7 +985,8 @@ generate_stat = function(stat, ctx)
INC_DECL = c_declaration(inc),
LOOP_COND = loop_cond,
LOOP_STEP = loop_step,
- LOOP_DECL = c_declaration(stat.decl._cvar),
+ LOOPVAR = stat.decl._cvar.name,
+ LOOPVAR_DECL = c_declaration(stat.decl._cvar),
BLOCK = block_cstats,
})
