[Piglit] [PATCH 1/5] piglit: silence piglit_report_subtest_result() format warnings

Brian Paul brianp at vmware.com
Fri Sep 27 17:13:26 PDT 2013


silences a bunch of warnings such as:
"tests/fbo/fbo-alphatest-formats.c:184:3: warning: format not
a string literal and no format arguments [-Wformat-security]"
---
 tests/fbo/fbo-alphatest-formats.c                        |    6 +++---
 tests/fbo/fbo-blending-formats.c                         |    6 +++---
 tests/fbo/fbo-clear-formats.c                            |    2 +-
 tests/fbo/fbo-colormask-formats.c                        |    2 +-
 tests/fbo/fbo-incomplete.cpp                             |    2 +-
 tests/fbo/fbo-readpixels-depth-formats.c                 |    2 +-
 tests/fbo/fbo-storage-formats.c                          |    6 +++---
 tests/general/linestipple.c                              |    4 ++--
 tests/spec/amd_performance_monitor/measure.c             |   14 +++++++-------
 tests/spec/arb_texture_buffer_object/formats.c           |    2 +-
 tests/spec/arb_texture_multisample/fb-completeness.c     |    2 +-
 .../spec/arb_texture_multisample/negative-max-samples.c  |    2 +-
 tests/spec/arb_texture_storage_multisample/tex-param.c   |   10 +++++-----
 tests/spec/gl-1.0/beginend-coverage.c                    |    2 +-
 tests/spec/gl-1.0/rendermode-feedback.c                  |    4 ++--
 15 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/tests/fbo/fbo-alphatest-formats.c b/tests/fbo/fbo-alphatest-formats.c
index e3c3827..59881c2 100644
--- a/tests/fbo/fbo-alphatest-formats.c
+++ b/tests/fbo/fbo-alphatest-formats.c
@@ -181,7 +181,7 @@ static enum piglit_result test_format(const struct format_desc *format)
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
 		printf("- fbo incomplete (status = %s)\n",
 		       piglit_get_gl_enum_name(status));
-		piglit_report_subtest_result(PIGLIT_SKIP, format->name);
+		piglit_report_subtest_result(PIGLIT_SKIP, "%s", format->name);
 		return PIGLIT_SKIP;
 	}
         printf("\n");
@@ -254,7 +254,7 @@ static enum piglit_result test_format(const struct format_desc *format)
 
 	if (!pass) {
 		piglit_present_results();
-		piglit_report_subtest_result(PIGLIT_FAIL, format->name);
+		piglit_report_subtest_result(PIGLIT_FAIL, "%s", format->name);
 		return PIGLIT_FAIL;
 	}
 
@@ -316,7 +316,7 @@ static enum piglit_result test_format(const struct format_desc *format)
 	piglit_present_results();
 
 	piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
-				     format->name);
+				     "%s", format->name);
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
diff --git a/tests/fbo/fbo-blending-formats.c b/tests/fbo/fbo-blending-formats.c
index 37c32ef..50b2d0a 100644
--- a/tests/fbo/fbo-blending-formats.c
+++ b/tests/fbo/fbo-blending-formats.c
@@ -289,7 +289,7 @@ static enum piglit_result test_format(const struct format_desc *format)
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
 		printf(" - fbo incomplete (status = %s)\n",
 		       piglit_get_gl_enum_name(status));
-		piglit_report_subtest_result(PIGLIT_SKIP, format->name);
+		piglit_report_subtest_result(PIGLIT_SKIP, "%s", format->name);
 		return PIGLIT_SKIP;
 	}
         printf("\n");
@@ -350,7 +350,7 @@ static enum piglit_result test_format(const struct format_desc *format)
 
 	if (!pass) {
 		piglit_present_results();
-		piglit_report_subtest_result(PIGLIT_FAIL, format->name);
+		piglit_report_subtest_result(PIGLIT_FAIL, "%s", format->name);
 		return PIGLIT_FAIL;
 	}
 
@@ -403,7 +403,7 @@ static enum piglit_result test_format(const struct format_desc *format)
 	piglit_present_results();
 
 	piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
-				     format->name);
+				     "%s", format->name);
 
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
diff --git a/tests/fbo/fbo-clear-formats.c b/tests/fbo/fbo-clear-formats.c
index 8ee8e97..7a68f23 100644
--- a/tests/fbo/fbo-clear-formats.c
+++ b/tests/fbo/fbo-clear-formats.c
@@ -565,7 +565,7 @@ test_format(const struct format_desc *format)
 	glDeleteTextures(1, &tex);
 
 	piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
-				     format->name);
+				     "%s", format->name);
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
diff --git a/tests/fbo/fbo-colormask-formats.c b/tests/fbo/fbo-colormask-formats.c
index d842e4f..f6a951d 100644
--- a/tests/fbo/fbo-colormask-formats.c
+++ b/tests/fbo/fbo-colormask-formats.c
@@ -218,7 +218,7 @@ static enum piglit_result test_format(const struct format_desc *format)
 	piglit_present_results();
 
 	piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
-				     format->name);
+				     "%s", format->name);
 
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
diff --git a/tests/fbo/fbo-incomplete.cpp b/tests/fbo/fbo-incomplete.cpp
index 576b45d..d4f4f9d 100644
--- a/tests/fbo/fbo-incomplete.cpp
+++ b/tests/fbo/fbo-incomplete.cpp
@@ -75,7 +75,7 @@ public:
 		glDeleteFramebuffers(1, &fbo);
 
 		piglit_report_subtest_result(_pass ? PIGLIT_PASS : PIGLIT_FAIL,
-					     name);
+					     "%s", name);
 	}
 
 	bool check_fbo_status(GLenum expect)
diff --git a/tests/fbo/fbo-readpixels-depth-formats.c b/tests/fbo/fbo-readpixels-depth-formats.c
index b627878..f43b1d4 100644
--- a/tests/fbo/fbo-readpixels-depth-formats.c
+++ b/tests/fbo/fbo-readpixels-depth-formats.c
@@ -202,7 +202,7 @@ test_with_format(GLenum internal_format, const char *name)
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
 		fprintf(stderr, "framebuffer incomplete\n");
-		piglit_report_subtest_result(PIGLIT_SKIP, name);
+		piglit_report_subtest_result(PIGLIT_SKIP, "%s", name);
 		goto done;
 	}
 
diff --git a/tests/fbo/fbo-storage-formats.c b/tests/fbo/fbo-storage-formats.c
index bbe286c..3b6b709 100644
--- a/tests/fbo/fbo-storage-formats.c
+++ b/tests/fbo/fbo-storage-formats.c
@@ -195,7 +195,7 @@ test(void)
 		glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, formats[i].format,
 					 piglit_width, piglit_height);
 		if (!piglit_check_gl_error(GL_NO_ERROR)) {
-			piglit_report_subtest_result(PIGLIT_FAIL, name);
+			piglit_report_subtest_result(PIGLIT_FAIL, "%s", name);
 			pass = GL_FALSE;
 		} else {
 			GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
@@ -215,10 +215,10 @@ test(void)
 					 invalid_formats[i],
 					 piglit_width, piglit_height);
 		if (!piglit_check_gl_error(GL_INVALID_ENUM)) {
-			piglit_report_subtest_result(PIGLIT_FAIL, name);
+			piglit_report_subtest_result(PIGLIT_FAIL, "%s", name);
 			pass = GL_FALSE;
 		} else {
-			piglit_report_subtest_result(PIGLIT_PASS, name);
+			piglit_report_subtest_result(PIGLIT_PASS, "%s", name);
 		}
 	}
 
diff --git a/tests/general/linestipple.c b/tests/general/linestipple.c
index 21d689c..98ecf58 100644
--- a/tests/general/linestipple.c
+++ b/tests/general/linestipple.c
@@ -219,9 +219,9 @@ piglit_display(void)
 	for (i = 0; i < ARRAY_SIZE(Lines); ++i) {
 		printf("Testing %s:\n", Lines[i].name);
 		if (test_line(&Lines[i])) {
-			piglit_report_subtest_result(PIGLIT_PASS, Lines[i].name);
+			piglit_report_subtest_result(PIGLIT_PASS, "%s", Lines[i].name);
 		} else {
-			piglit_report_subtest_result(PIGLIT_FAIL, Lines[i].name);
+			piglit_report_subtest_result(PIGLIT_FAIL, "%s", Lines[i].name);
 			pass = false;
 		}
 	}
diff --git a/tests/spec/amd_performance_monitor/measure.c b/tests/spec/amd_performance_monitor/measure.c
index 61c98b1..1cc01e8 100644
--- a/tests/spec/amd_performance_monitor/measure.c
+++ b/tests/spec/amd_performance_monitor/measure.c
@@ -64,10 +64,10 @@ get_counters(unsigned group, unsigned **counters, int *num_counters,
 				    *num_counters, *counters);
 }
 
-#define verify(x)                                                     \
-	if (!(x)) {                                                   \
-		piglit_report_subtest_result(PIGLIT_FAIL, test_name); \
-		return;                                               \
+#define verify(x)                                                           \
+	if (!(x)) {                                                         \
+		piglit_report_subtest_result(PIGLIT_FAIL, "%s", test_name); \
+		return;                                                     \
 	}
 
 /******************************************************************************/
@@ -180,7 +180,7 @@ test_basic_measurement(unsigned group)
 
 	verify(bytes_written == result_size);
 
-	piglit_report_subtest_result(PIGLIT_PASS, test_name);
+	piglit_report_subtest_result(PIGLIT_PASS, "%s", test_name);
 
 	/**
 	 * Test #2: Verify counter results against specified range.
@@ -275,7 +275,7 @@ test_basic_measurement(unsigned group)
 	verify(piglit_check_gl_error(GL_NO_ERROR));
 	verify(value == 0);
 
-	piglit_report_subtest_result(PIGLIT_PASS, test_name);
+	piglit_report_subtest_result(PIGLIT_PASS, "%s", test_name);
 
 	glDeletePerfMonitorsAMD(1, &monitor);
 }
@@ -351,7 +351,7 @@ test_change_counters_while_active(unsigned group)
 	glDeletePerfMonitorsAMD(1, &monitor);
 	verify(piglit_check_gl_error(GL_NO_ERROR));
 
-	piglit_report_subtest_result(PIGLIT_PASS, test_name);
+	piglit_report_subtest_result(PIGLIT_PASS, "%s", test_name);
 }
 
 
diff --git a/tests/spec/arb_texture_buffer_object/formats.c b/tests/spec/arb_texture_buffer_object/formats.c
index 6e54b4e..ed73cc1 100644
--- a/tests/spec/arb_texture_buffer_object/formats.c
+++ b/tests/spec/arb_texture_buffer_object/formats.c
@@ -536,7 +536,7 @@ test_format(int format_index)
 	y_index++;
 
 	piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
-				     piglit_get_gl_enum_name(format->format));
+				     "%s", piglit_get_gl_enum_name(format->format));
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
diff --git a/tests/spec/arb_texture_multisample/fb-completeness.c b/tests/spec/arb_texture_multisample/fb-completeness.c
index 55c621b..676ac61 100644
--- a/tests/spec/arb_texture_multisample/fb-completeness.c
+++ b/tests/spec/arb_texture_multisample/fb-completeness.c
@@ -320,7 +320,7 @@ piglit_init(int argc, char **argv)
     }
 
     for (info = tests; info->name; info++)
-        piglit_report_subtest_result(exec_test(info, sample_count), info->name);
+        piglit_report_subtest_result(exec_test(info, sample_count), "%s", info->name);
 
     piglit_report_result(result);
 }
diff --git a/tests/spec/arb_texture_multisample/negative-max-samples.c b/tests/spec/arb_texture_multisample/negative-max-samples.c
index 2deb9c9..38a30eb 100644
--- a/tests/spec/arb_texture_multisample/negative-max-samples.c
+++ b/tests/spec/arb_texture_multisample/negative-max-samples.c
@@ -106,7 +106,7 @@ check_subtest(struct subtest *t)
 
     piglit_report_subtest_result(
             piglit_check_gl_error(t->error) ? PIGLIT_PASS : PIGLIT_FAIL,
-            t->name);
+            "%s", t->name);
 }
 
 void
diff --git a/tests/spec/arb_texture_storage_multisample/tex-param.c b/tests/spec/arb_texture_storage_multisample/tex-param.c
index 11e7d78..55864f5 100644
--- a/tests/spec/arb_texture_storage_multisample/tex-param.c
+++ b/tests/spec/arb_texture_storage_multisample/tex-param.c
@@ -83,7 +83,7 @@ check_subtest(struct subtest *t)
 
 	if (!piglit_check_gl_error(GL_NO_ERROR)) {
 		printf("GetTexParameteriv failed\n");
-		piglit_report_subtest_result(PIGLIT_FAIL, test_name);
+		piglit_report_subtest_result(PIGLIT_FAIL, "%s", test_name);
 		return;
 	}
 
@@ -92,7 +92,7 @@ check_subtest(struct subtest *t)
 		       piglit_get_gl_enum_name(t->param),
 		       t->initial_value,
 		       val);
-		piglit_report_subtest_result(PIGLIT_FAIL, test_name);
+		piglit_report_subtest_result(PIGLIT_FAIL, "%s", test_name);
 		return;
 	}
 
@@ -101,7 +101,7 @@ check_subtest(struct subtest *t)
 	if (!piglit_check_gl_error(t->expected_error)) {
 		printf("error setting parameter %s\n",
 		       piglit_get_gl_enum_name(t->param));
-		piglit_report_subtest_result(PIGLIT_FAIL, test_name);
+		piglit_report_subtest_result(PIGLIT_FAIL, "%s", test_name);
 		return;
 	}
 
@@ -114,10 +114,10 @@ check_subtest(struct subtest *t)
 		       piglit_get_gl_enum_name(t->param),
 		       expected_val,
 		       val);
-		piglit_report_subtest_result(PIGLIT_FAIL, test_name);
+		piglit_report_subtest_result(PIGLIT_FAIL, "%s", test_name);
 	}
 
-	piglit_report_subtest_result(PIGLIT_PASS, test_name);
+	piglit_report_subtest_result(PIGLIT_PASS, "%s", test_name);
 }
 
 void
diff --git a/tests/spec/gl-1.0/beginend-coverage.c b/tests/spec/gl-1.0/beginend-coverage.c
index 29044ef..8befd30 100644
--- a/tests/spec/gl-1.0/beginend-coverage.c
+++ b/tests/spec/gl-1.0/beginend-coverage.c
@@ -845,7 +845,7 @@ run_tests(struct test *tests, int num_tests, GLenum expected_error)
 
 		piglit_report_subtest_result(test_pass ?
 					     PIGLIT_PASS : PIGLIT_FAIL,
-					     tests[i].name);
+					     "%s", tests[i].name);
 
 		pass = test_pass && pass;
 	}
diff --git a/tests/spec/gl-1.0/rendermode-feedback.c b/tests/spec/gl-1.0/rendermode-feedback.c
index 5eb8362..8691c96 100644
--- a/tests/spec/gl-1.0/rendermode-feedback.c
+++ b/tests/spec/gl-1.0/rendermode-feedback.c
@@ -171,10 +171,10 @@ piglit_display(void)
 			pass = false;
 			report_failure(&types[i], buffer, returned_count);
 			piglit_report_subtest_result(PIGLIT_FAIL,
-						     types[i].name);
+						     "%s", types[i].name);
 		} else {
 			piglit_report_subtest_result(PIGLIT_PASS,
-						     types[i].name);
+						     "%s", types[i].name);
 		}
 	}
 
-- 
1.7.10.4



More information about the Piglit mailing list