package/expedite: fix build issue with gcc < 5
PATCH v2 1/1 package/expedite: fix build issue with gcc < 5
The code use for loop initial declarations which are only allowed in C99 mode which is not the default C standard with gcc < 5.
This way of writing for loop was added by the latest commit and it is not consistent with the rest of the code.
So revert to the C89 for loop syntax.
Reported upstream:
https://phab.enlightenment.org/T5440
Fixes:
http://autobuild.buildroot.net/results/ed8/ed840755e8e486e48eab8c13a8bb5e9a448199ce
--- .../0001-fix-build-failure-with-gcc-5.patch | 289 +++++++++++++++++++++ 1 file changed, 289 insertions(+) create mode 100644 package/expedite/0001-fix-build-failure-with-gcc-5.patch
package/expedite/0001-fix-build-failure-with-gcc-5.patch new file +289 -0
@@ -0,0 +1,289 @@ +From 01a29e6a1d2ed083d1a1884dbca37ae518f354c7 Mon Sep 17 00:00:00 2001 +From: Romain Naour <[email protected]> +Date: Sun, 30 Apr 2017 12:07:02 +0200 +Subject: [PATCH] fix build failure with gcc < 5 + +Definition of variables inside the initialization part of for() loops +was added by [1] and produce some build failure with "old" gcc version +(gcc < 5). + +This way of writing for loop is not consistent with the rest of the +code. So revert to the C89 for loop syntax. + +Reported upstream: +https://phab.enlightenment.org/T5440 + +[1] https://git.enlightenment.org/tools/expedite.git/commit/?id=0529ce56b6fb01e9651e76461e9608e15a040fb3 + +Fixes: +http://autobuild.buildroot.net/results/930/930796603d37bc309a591eec68037192c51028ce + +Signed-off-by: Romain Naour <[email protected]> +--- + src/bin/image_data_argb.c | 9 ++++++--- + src/bin/image_data_argb_alpha.c | 6 ++++-- + src/bin/image_data_ycbcr601pl.c | 12 ++++++++---- + .../image_data_ycbcr601pl_map_nearest_solid_rotate.c | 12 ++++++++---- + src/bin/image_data_ycbcr601pl_map_solid_rotate.c | 12 ++++++++---- + src/bin/image_data_ycbcr601pl_wide_stride.c | 17 +++++++++++------ + 6 files changed, 45 insertions(+), 23 deletions(-) + +diff --git a/src/bin/image_data_argb.c b/src/bin/image_data_argb.c +index d5889ce..9c607b2 100644 +--- a/src/bin/image_data_argb.c ++++ b/src/bin/image_data_argb.c +@@ -20,12 +20,13 @@ static Evas_Object *o_images[1]; + /* setup */ + static void _setup(void) + { ++ int i; + Evas_Object *o; + Eina_Slice sl; + + sl.len = 640 * 480 * 4; + sl.mem = malloc(sl.len); +- for (int i = 0; i < 1; i++) ++ for (i = 0; i < 1; i++) + { + o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas); + o_images[i] = o; +@@ -42,7 +43,8 @@ static void _setup(void) + /* cleanup */ + static void _cleanup(void) + { +- for (int i = 0; i < 1; i++) ++ int i; ++ for (i = 0; i < 1; i++) + { + Evas_Object *o = o_images[i]; + Eina_Slice sl = {}; +@@ -56,7 +58,8 @@ static void _cleanup(void) + /* loop - do things */ + static void _loop(double t, int f) + { +- for (int i = 0; i < 1; i++) ++ int i; ++ for (i = 0; i < 1; i++) + { + Evas_Object *o = o_images[i]; + unsigned int *data, *p; +diff --git a/src/bin/image_data_argb_alpha.c b/src/bin/image_data_argb_alpha.c +index 79f4c54..ffbe57e 100644 +--- a/src/bin/image_data_argb_alpha.c ++++ b/src/bin/image_data_argb_alpha.c +@@ -20,12 +20,13 @@ static Evas_Object *o_images[1]; + /* setup */ + static void _setup(void) + { ++ int i; + Evas_Object *o; + Eina_Slice sl; + + sl.len = 640 * 480 * 4; + sl.mem = malloc(sl.len); +- for (int i = 0; i < 1; i++) ++ for (i = 0; i < 1; i++) + { + o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas); + o_images[i] = o; +@@ -42,7 +43,8 @@ static void _setup(void) + /* cleanup */ + static void _cleanup(void) + { +- for (int i = 0; i < 1; i++) ++ int i; ++ for (i = 0; i < 1; i++) + { + Evas_Object *o = o_images[i]; + Eina_Slice sl = {}; +diff --git a/src/bin/image_data_ycbcr601pl.c b/src/bin/image_data_ycbcr601pl.c +index 032d5b3..e126e98 100644 +--- a/src/bin/image_data_ycbcr601pl.c ++++ b/src/bin/image_data_ycbcr601pl.c +@@ -21,9 +21,11 @@ static Eina_Slice slice[3]; + /* setup */ + static void _setup(void) + { ++ int i; + FILE *f; +- for (int i = 0; i < 1; i++) ++ for (i = 0; i < 1; i++) + { ++ int p; + Evas_Object *o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas); + o_images[i] = o; + efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); +@@ -37,7 +39,7 @@ static void _setup(void) + slice[2].len = 320 * 240; + f = fopen(build_path("tp.yuv"), "rb"); + if (!f) continue; +- for (int p = 0; p < 3; p++) ++ for (p = 0; p < 3; p++) + { + slice[p].mem = malloc(slice[p].len); + fread((void *) slice[p].mem, slice[p].len, 1, f); +@@ -51,10 +53,12 @@ static void _setup(void) + /* cleanup */ + static void _cleanup(void) + { +- for (int i = 0; i < 1; i++) ++ int i; ++ for (i = 0; i < 1; i++) + { ++ int p; + Evas_Object *o = o_images[i]; +- for (int p = 0; p < 3; p++) ++ for (p = 0; p < 3; p++) + { + efl_gfx_buffer_managed_set(o, NULL, 640, 480, 0, EFL_GFX_COLORSPACE_YCBCR422P601_PL, p); + free((void *) slice[p].mem); +diff --git a/src/bin/image_data_ycbcr601pl_map_nearest_solid_rotate.c b/src/bin/image_data_ycbcr601pl_map_nearest_solid_rotate.c +index 0a5bcf4..db52b0b 100644 +--- a/src/bin/image_data_ycbcr601pl_map_nearest_solid_rotate.c ++++ b/src/bin/image_data_ycbcr601pl_map_nearest_solid_rotate.c +@@ -21,9 +21,11 @@ static Eina_Slice slice[3]; + /* setup */ + static void _setup(void) + { ++ int i; + FILE *f; +- for (int i = 0; i < 1; i++) ++ for (i = 0; i < 1; i++) + { ++ int p; + Evas_Object *o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas); + o_images[i] = o; + efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); +@@ -37,7 +39,7 @@ static void _setup(void) + slice[2].len = 320 * 240; + f = fopen(build_path("tp.yuv"), "rb"); + if (!f) continue; +- for (int p = 0; p < 3; p++) ++ for (p = 0; p < 3; p++) + { + slice[p].mem = malloc(slice[p].len); + fread((void *) slice[p].mem, slice[p].len, 1, f); +@@ -51,10 +53,12 @@ static void _setup(void) + /* cleanup */ + static void _cleanup(void) + { +- for (int i = 0; i < 1; i++) ++ int i; ++ for (i = 0; i < 1; i++) + { ++ int p; + Evas_Object *o = o_images[i]; +- for (int p = 0; p < 3; p++) ++ for (p = 0; p < 3; p++) + { + efl_gfx_buffer_managed_set(o, NULL, 640, 480, 0, EFL_GFX_COLORSPACE_YCBCR422P601_PL, p); + free((void *) slice[p].mem); +diff --git a/src/bin/image_data_ycbcr601pl_map_solid_rotate.c b/src/bin/image_data_ycbcr601pl_map_solid_rotate.c +index 355293f..ac4364d 100644 +--- a/src/bin/image_data_ycbcr601pl_map_solid_rotate.c ++++ b/src/bin/image_data_ycbcr601pl_map_solid_rotate.c +@@ -22,8 +22,10 @@ static Eina_Slice slice[3]; + static void _setup(void) + { + FILE *f; +- for (int i = 0; i < 1; i++) ++ int i; ++ for (i = 0; i < 1; i++) + { ++ int p; + Evas_Object *o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas); + o_images[i] = o; + efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); +@@ -37,7 +39,7 @@ static void _setup(void) + slice[2].len = 320 * 240; + f = fopen(build_path("tp.yuv"), "rb"); + if (!f) continue; +- for (int p = 0; p < 3; p++) ++ for (p = 0; p < 3; p++) + { + slice[p].mem = malloc(slice[p].len); + fread((void *) slice[p].mem, slice[p].len, 1, f); +@@ -51,10 +53,12 @@ static void _setup(void) + /* cleanup */ + static void _cleanup(void) + { +- for (int i = 0; i < 1; i++) ++ int i; ++ for (i = 0; i < 1; i++) + { ++ int p; + Evas_Object *o = o_images[i]; +- for (int p = 0; p < 3; p++) ++ for (p = 0; p < 3; p++) + { + efl_gfx_buffer_managed_set(o, NULL, 640, 480, 0, EFL_GFX_COLORSPACE_YCBCR422P601_PL, p); + free((void *) slice[p].mem); +diff --git a/src/bin/image_data_ycbcr601pl_wide_stride.c b/src/bin/image_data_ycbcr601pl_wide_stride.c +index d4e8fa2..9adb62f 100644 +--- a/src/bin/image_data_ycbcr601pl_wide_stride.c ++++ b/src/bin/image_data_ycbcr601pl_wide_stride.c +@@ -21,11 +21,13 @@ static Eina_Slice slice[3]; + /* setup */ + static void _setup(void) + { ++ int i; + int stride; + FILE *f; + int w = 320 - 16; +- for (int i = 0; i < 1; i++) ++ for (i = 0; i < 1; i++) + { ++ int p; + Evas_Object *o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas); + o_images[i] = o; + efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); +@@ -41,7 +43,7 @@ static void _setup(void) + f = fopen(build_path("tp.yuv"), "rb"); + if (!f) continue; + stride = 640; +- for (int p = 0; p < 3; p++) ++ for (p = 0; p < 3; p++) + { + slice[p].mem = malloc(slice[p].len); + fread((void *) slice[p].mem, slice[p].len, 1, f); +@@ -57,10 +59,12 @@ static void _setup(void) + /* cleanup */ + static void _cleanup(void) + { +- for (int i = 0; i < 1; i++) ++ int i; ++ for (i = 0; i < 1; i++) + { ++ int p; + Evas_Object *o = o_images[i]; +- for (int p = 0; p < 3; p++) ++ for (p = 0; p < 3; p++) + { + efl_gfx_buffer_managed_set(o, NULL, 640, 480, 0, + EFL_GFX_COLORSPACE_YCBCR422P601_PL, p); +@@ -77,11 +81,12 @@ static void _loop(double t, int f) + Evas_Coord x, y, w, h; + for (i = 0; i < 1; i++) + { ++ int p; + Evas_Object *o = o_images[i]; + Eina_Slice sl[3]; + int stride; + +- for (int p = 0; p < 3; p++) ++ for (p = 0; p < 3; p++) + efl_gfx_buffer_managed_get(o, &sl[p], p); + + w = 640; +@@ -97,7 +102,7 @@ static void _loop(double t, int f) + if (w > 640) w = 320; + + stride = 640; +- for (int p = 0; p < 3; p++) ++ for (p = 0; p < 3; p++) + { + efl_gfx_buffer_managed_set(o, &sl[p], w, 480, stride, + EFL_GFX_COLORSPACE_YCBCR422P601_PL, p); +-- +2.9.3 +
Signature · 1 line
2.9.3
PATCH v2 1/1 package/expedite: fix build issue with gcc < 5
Hello,
Quoted 10 lines · Romain Naour
The code use for loop initial declarations which are only allowed in C99 mode which is not the default C standard with gcc < 5.
This way of writing for loop was added by the latest commit and it is not consistent with the rest of the code.
So revert to the C89 for loop syntax.Reported upstream:
https://phab.enlightenment.org/T5440
Quoted 8 lines
Fixes:
http://autobuild.buildroot.net/results/ed8/ed840755e8e486e48eab8c13a8bb5e9a448199ceSigned-off-by Romain Naour <[email protected]>--- .../0001-fix-build-failure-with-gcc-5.patch | 289 +++++++++++++++++++++ 1 file changed, 289 insertions(+) create mode 100644 package/expedite/0001-fix-build-failure-with-gcc-5.patch
I'm not sure why you gave up on the -std=c99 solution, but OK, I've applied this patch. We'll see what upstream suggests.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com