[Mesa-dev] [PATCH 02/10] i965: Silence silly comparison between signed and unsigned integer warnings

Ian Romanick idr at freedesktop.org
Thu Mar 10 18:25:11 UTC 2016


From: Ian Romanick <ian.d.romanick at intel.com>

brw_state_dump.c: In function ‘gen7_dump_sampler_state’:
brw_state_dump.c:405:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int i = 0; i < size / 16; i++) {
                      ^
brw_state_dump.c: In function ‘gen8_dump_blend_state’:
brw_state_dump.c:621:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int i = 1; i < size / 4; i += 2) {
                      ^
brw_state_dump.c: In function ‘dump_vs_constants’:
brw_state_dump.c:677:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < size / 4; i += 4) {
                  ^
brw_state_dump.c: In function ‘dump_wm_constants’:
brw_state_dump.c:693:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < size / 4; i += 4) {
                  ^
brw_state_dump.c: In function ‘dump_binding_table’:
brw_state_dump.c:708:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < size / 4; i++) {
                  ^

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/drivers/dri/i965/brw_state_dump.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_state_dump.c b/src/mesa/drivers/dri/i965/brw_state_dump.c
index 6450f9b..943b2a9 100644
--- a/src/mesa/drivers/dri/i965/brw_state_dump.c
+++ b/src/mesa/drivers/dri/i965/brw_state_dump.c
@@ -403,7 +403,7 @@ static void gen7_dump_sampler_state(struct brw_context *brw,
    const uint32_t *samp = brw->batch.bo->virtual + offset;
    char name[20];
 
-   for (int i = 0; i < size / 16; i++) {
+   for (unsigned i = 0; i < size / 16; i++) {
       sprintf(name, "SAMPLER_STATE %d", i);
       batch_out(brw, name, offset, i,
                 "Disabled = %s, Base Mip: %u.%u, Mip/Mag/Min Filter: %s/%s/%s, LOD Bias: %d.%d\n",
@@ -619,7 +619,7 @@ gen8_dump_blend_state(struct brw_context *brw, uint32_t offset, uint32_t size)
    if (((size) % 2) != 0)
       fprintf(stderr, "Invalid blend state size %d\n", size);
 
-   for (int i = 1; i < size / 4; i += 2) {
+   for (unsigned i = 1; i < size / 4; i += 2) {
       char name[sizeof("BLEND_ENTRYXXX")];
       sprintf(name, "BLEND_ENTRY%02d", (i - 1) / 2);
       if (blend[i + 1] & GEN8_BLEND_LOGIC_OP_ENABLE) {
@@ -673,9 +673,8 @@ dump_vs_constants(struct brw_context *brw, uint32_t offset, uint32_t size)
    const char *name = "VS_CONST";
    uint32_t *as_uint = brw->batch.bo->virtual + offset;
    float *as_float = brw->batch.bo->virtual + offset;
-   int i;
 
-   for (i = 0; i < size / 4; i += 4) {
+   for (unsigned i = 0; i < size / 4; i += 4) {
       batch_out(brw, name, offset, i, "%3d: (% f % f % f % f) (0x%08x 0x%08x 0x%08x 0x%08x)\n",
 		i / 4,
 		as_float[i], as_float[i + 1], as_float[i + 2], as_float[i + 3],
@@ -689,9 +688,8 @@ dump_wm_constants(struct brw_context *brw, uint32_t offset, uint32_t size)
    const char *name = "WM_CONST";
    uint32_t *as_uint = brw->batch.bo->virtual + offset;
    float *as_float = brw->batch.bo->virtual + offset;
-   int i;
 
-   for (i = 0; i < size / 4; i += 4) {
+   for (unsigned i = 0; i < size / 4; i += 4) {
       batch_out(brw, name, offset, i, "%3d: (% f % f % f % f) (0x%08x 0x%08x 0x%08x 0x%08x)\n",
 		i / 4,
 		as_float[i], as_float[i + 1], as_float[i + 2], as_float[i + 3],
@@ -703,10 +701,9 @@ static void dump_binding_table(struct brw_context *brw, uint32_t offset,
 			       uint32_t size)
 {
    char name[20];
-   int i;
    uint32_t *data = brw->batch.bo->virtual + offset;
 
-   for (i = 0; i < size / 4; i++) {
+   for (unsigned i = 0; i < size / 4; i++) {
       if (data[i] == 0)
 	 continue;
 
-- 
2.5.0



More information about the mesa-dev mailing list