struct ir3_shader_key key = {};
        struct ir3_shader_variant *v;
        struct fd_ringbuffer *ring = ctx->batch->draw;
-       unsigned i, nglobal = 0;
+       unsigned nglobal = 0;
 
        emit_setup(ctx);
 
 
        struct ir3_shader_key key = {};
        struct ir3_shader_variant *v;
        struct fd_ringbuffer *ring = ctx->batch->draw;
-       unsigned i, nglobal = 0;
+       unsigned nglobal = 0;
 
        fd6_emit_restore(ctx->batch, ring);
 
 
        struct pipe_framebuffer_state *pfb = &ctx->batch->framebuffer;
        const bool has_depth = pfb->zsbuf;
        unsigned color_buffers = buffers >> 2;
-       unsigned i;
 
        /* If we're clearing after draws, fallback to 3D pipe clears.  We could
         * use blitter clears in the draw batch but then we'd have to patch up the
 
        struct fd_context *ctx = fd_context(pctx);
        const struct fd_shaderbuf_stateobj *so = &ctx->shaderbuf[PIPE_SHADER_COMPUTE];
        struct fd_batch *batch, *save_batch = NULL;
-       unsigned i;
 
        batch = fd_bc_alloc_batch(&ctx->screen->batch_cache, ctx, true);
        fd_batch_reference(&save_batch, ctx->batch);
 
        do { __typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
 
 #define foreach_bit(b, mask) \
-       for (uint32_t _m = (mask); _m && ({(b) = u_bit_scan(&_m); 1;});)
+       for (uint32_t _m = (mask), b; _m && ({(b) = u_bit_scan(&_m); (void)(b); 1;});)
 
 
 #define BIT(bit) (1u << bit)