[i-g-t,3/3] Move declaration to the top of the code
diff mbox

Message ID 491079aa8b1be2e1f6f79aee7b08aa5ca1d42098.1527639529.git.rodrigosiqueiramelo@gmail.com
State New
Headers show

Commit Message

Rodrigo Siqueira May 30, 2018, 12:47 a.m. UTC
This patch fix the following gcc warnings:

warning: ISO C90 forbids mixed declarations and code
[-Wdeclaration-after-statement] [..]
igt_color_encoding.c:45:2: warning: ISO C90 forbids mixed declarations
and code [-Wdeclaration-after-statement] [..]
igt_color_encoding.c: In function ‘ycbcr_to_rgb_matrix’:
igt_color_encoding.c:72:2: warning: ISO C90 forbids mixed declarations
and code [-Wdeclaration-after-statement] [..]

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 lib/igt_color_encoding.c         | 16 ++++++----------
 tests/kms_frontbuffer_tracking.c |  2 +-
 2 files changed, 7 insertions(+), 11 deletions(-)

Comments

Arkadiusz Hiler June 4, 2018, 10:54 a.m. UTC | #1
On Tue, May 29, 2018 at 09:47:13PM -0300, Rodrigo Siqueira wrote:
> This patch fix the following gcc warnings:
> 
> warning: ISO C90 forbids mixed declarations and code
> [-Wdeclaration-after-statement] [..]
> igt_color_encoding.c:45:2: warning: ISO C90 forbids mixed declarations
> and code [-Wdeclaration-after-statement] [..]
> igt_color_encoding.c: In function ‘ycbcr_to_rgb_matrix’:
> igt_color_encoding.c:72:2: warning: ISO C90 forbids mixed declarations
> and code [-Wdeclaration-after-statement] [..]
> 
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>

Patch
diff mbox

diff --git a/lib/igt_color_encoding.c b/lib/igt_color_encoding.c
index b1648a74..1a89bb46 100644
--- a/lib/igt_color_encoding.c
+++ b/lib/igt_color_encoding.c
@@ -36,11 +36,9 @@  static const struct color_encoding color_encodings[IGT_NUM_COLOR_ENCODINGS] = {
 
 static struct igt_mat4 rgb_to_ycbcr_matrix(const struct color_encoding *e)
 {
-	float kr, kg, kb;
-
-	kr = e->kr;
-	kb = e->kb;
-	kg = 1.0f - kr - kb;
+	float kr = e->kr;
+	float kb = e->kb;
+	float kg = 1.0f - kr - kb;
 
 	struct igt_mat4 ret = {
 		.d[0 * 4 + 0] = kr,
@@ -63,11 +61,9 @@  static struct igt_mat4 rgb_to_ycbcr_matrix(const struct color_encoding *e)
 
 static struct igt_mat4 ycbcr_to_rgb_matrix(const struct color_encoding *e)
 {
-	float kr, kg, kb;
-
-	kr = e->kr;
-	kb = e->kb;
-	kg = 1.0f - kr - kb;
+	float kr = e->kr;
+	float kb = e->kb;
+	float kg = 1.0f - kr - kb;
 
 	struct igt_mat4 ret = {
 		.d[0 * 4 + 0] = 1.0f,
diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index 8754cc46..dbb8ba62 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -1770,8 +1770,8 @@  static void do_status_assertions(int flags)
 static void __do_assertions(const struct test_mode *t, int flags,
 			    int line)
 {
-	flags = adjust_assertion_flags(t, flags);
 	bool mandatory_sink_crc = t->feature & FEATURE_PSR;
+	flags = adjust_assertion_flags(t, flags);
 
 	igt_debug("checking asserts in line %i\n", line);