Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] kvazaar: fix build with gcc 7
@ 2017-07-13 18:15 Baruch Siach
  2017-07-13 18:17 ` Baruch Siach
  2017-07-15  8:13 ` Thomas Petazzoni
  0 siblings, 2 replies; 3+ messages in thread
From: Baruch Siach @ 2017-07-13 18:15 UTC (permalink / raw)
  To: buildroot

Add upstream fix for a gcc 7 -Werror build failure.

Cc: Alexandre Esse <alexandre.esse.dev@gmail.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 ...use-FILL_ARRAY-macro-to-prevent-warning-o.patch | 56 ++++++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 package/kvazaar/0001-Modify-and-use-FILL_ARRAY-macro-to-prevent-warning-o.patch

diff --git a/package/kvazaar/0001-Modify-and-use-FILL_ARRAY-macro-to-prevent-warning-o.patch b/package/kvazaar/0001-Modify-and-use-FILL_ARRAY-macro-to-prevent-warning-o.patch
new file mode 100644
index 000000000000..633da8b36d4b
--- /dev/null
+++ b/package/kvazaar/0001-Modify-and-use-FILL_ARRAY-macro-to-prevent-warning-o.patch
@@ -0,0 +1,56 @@
+From 47a9f0de049e77e866ea5bdd4bc7c795ea6dd641 Mon Sep 17 00:00:00 2001
+From: Ari Lemmetti <ari.lemmetti@gmail.com>
+Date: Tue, 11 Apr 2017 12:57:22 +0300
+Subject: [PATCH] Modify and use FILL_ARRAY macro to prevent warning on GCC 7
+
+Following warning was given and is false positive
+
+error: 'memset' used with length equal to number of elements without multiplication by element size [-Werror=memset-elt-size]
+
+Signed-off-by: Baruch Siach <baruch@tkos.co.il>
+---
+Upstream commit 47a9f0de049e7.
+
+ src/global.h | 6 +++++-
+ src/rdo.c    | 8 ++++----
+ 2 files changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/src/global.h b/src/global.h
+index bedcd49c2e02..518167443f35 100644
+--- a/src/global.h
++++ b/src/global.h
+@@ -219,7 +219,11 @@ typedef int16_t coeff_t;
+ // Fill a structure or a static array with val bytes.
+ #define FILL(var, val) memset(&(var), (val), sizeof(var))
+ // Fill a number of elements in an array with val bytes.
+-#define FILL_ARRAY(ar, val, size) memset((ar), (val), (size) * sizeof(*(ar)))
++#define FILL_ARRAY(ar, val, size) \
++{\
++  void *temp_ptr = (void*)(ar);\
++  memset((temp_ptr), (val), (size) * sizeof(*(ar)));\
++}
+ 
+ #define FREE_POINTER(pointer) { free((void*)pointer); pointer = NULL; }
+ #define MOVE_POINTER(dst_pointer,src_pointer) { dst_pointer = src_pointer; src_pointer = NULL; }
+diff --git a/src/rdo.c b/src/rdo.c
+index 52305fd72fab..2579f2808441 100644
+--- a/src/rdo.c
++++ b/src/rdo.c
+@@ -558,10 +558,10 @@ void kvz_rdoq(encoder_state_t * const state, coeff_t *coef, coeff_t *dest_coeff,
+   // Explicitly tell the only possible numbers of elements to be zeroed.
+   // Hope the compiler is able to utilize this information.
+   switch (cg_num) {
+-    case  1: memset(sig_coeffgroup_flag, 0,  1 * sizeof(sig_coeffgroup_flag[0])); break;
+-    case  4: memset(sig_coeffgroup_flag, 0,  4 * sizeof(sig_coeffgroup_flag[0])); break;
+-    case 16: memset(sig_coeffgroup_flag, 0, 16 * sizeof(sig_coeffgroup_flag[0])); break;
+-    case 64: memset(sig_coeffgroup_flag, 0, 64 * sizeof(sig_coeffgroup_flag[0])); break;
++    case  1: FILL_ARRAY(sig_coeffgroup_flag, 0,  1); break;
++    case  4: FILL_ARRAY(sig_coeffgroup_flag, 0,  4); break;
++    case 16: FILL_ARRAY(sig_coeffgroup_flag, 0, 16); break;
++    case 64: FILL_ARRAY(sig_coeffgroup_flag, 0, 64); break;
+     default: assert(0 && "There should be 1, 4, 16 or 64 coefficient groups");
+   }
+ 
+-- 
+2.13.2
+
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] kvazaar: fix build with gcc 7
  2017-07-13 18:15 [Buildroot] [PATCH] kvazaar: fix build with gcc 7 Baruch Siach
@ 2017-07-13 18:17 ` Baruch Siach
  2017-07-15  8:13 ` Thomas Petazzoni
  1 sibling, 0 replies; 3+ messages in thread
From: Baruch Siach @ 2017-07-13 18:17 UTC (permalink / raw)
  To: buildroot

Hi Buildroot list,

On Thu, Jul 13, 2017 at 09:15:08PM +0300, Baruch Siach wrote:
> Add upstream fix for a gcc 7 -Werror build failure.

I forgot to mention,

Fixes:
http://autobuild.buildroot.net/results/ea1/ea1495696a0e810adb6695dad6b9f3d3363e81d5/
http://autobuild.buildroot.net/results/2c1/2c1fba63553afa735c5ac29d7f5de8368c794628/
http://autobuild.buildroot.net/results/d07/d07bfcb8efcb76cdea3c66e0cc24728f418e3872/

baruch

> Cc: Alexandre Esse <alexandre.esse.dev@gmail.com>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
>  ...use-FILL_ARRAY-macro-to-prevent-warning-o.patch | 56 ++++++++++++++++++++++
>  1 file changed, 56 insertions(+)
>  create mode 100644 package/kvazaar/0001-Modify-and-use-FILL_ARRAY-macro-to-prevent-warning-o.patch
> 
> diff --git a/package/kvazaar/0001-Modify-and-use-FILL_ARRAY-macro-to-prevent-warning-o.patch b/package/kvazaar/0001-Modify-and-use-FILL_ARRAY-macro-to-prevent-warning-o.patch
> new file mode 100644
> index 000000000000..633da8b36d4b
> --- /dev/null
> +++ b/package/kvazaar/0001-Modify-and-use-FILL_ARRAY-macro-to-prevent-warning-o.patch
> @@ -0,0 +1,56 @@
> +From 47a9f0de049e77e866ea5bdd4bc7c795ea6dd641 Mon Sep 17 00:00:00 2001
> +From: Ari Lemmetti <ari.lemmetti@gmail.com>
> +Date: Tue, 11 Apr 2017 12:57:22 +0300
> +Subject: [PATCH] Modify and use FILL_ARRAY macro to prevent warning on GCC 7
> +
> +Following warning was given and is false positive
> +
> +error: 'memset' used with length equal to number of elements without multiplication by element size [-Werror=memset-elt-size]
> +
> +Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> +---
> +Upstream commit 47a9f0de049e7.
> +
> + src/global.h | 6 +++++-
> + src/rdo.c    | 8 ++++----
> + 2 files changed, 9 insertions(+), 5 deletions(-)
> +
> +diff --git a/src/global.h b/src/global.h
> +index bedcd49c2e02..518167443f35 100644
> +--- a/src/global.h
> ++++ b/src/global.h
> +@@ -219,7 +219,11 @@ typedef int16_t coeff_t;
> + // Fill a structure or a static array with val bytes.
> + #define FILL(var, val) memset(&(var), (val), sizeof(var))
> + // Fill a number of elements in an array with val bytes.
> +-#define FILL_ARRAY(ar, val, size) memset((ar), (val), (size) * sizeof(*(ar)))
> ++#define FILL_ARRAY(ar, val, size) \
> ++{\
> ++  void *temp_ptr = (void*)(ar);\
> ++  memset((temp_ptr), (val), (size) * sizeof(*(ar)));\
> ++}
> + 
> + #define FREE_POINTER(pointer) { free((void*)pointer); pointer = NULL; }
> + #define MOVE_POINTER(dst_pointer,src_pointer) { dst_pointer = src_pointer; src_pointer = NULL; }
> +diff --git a/src/rdo.c b/src/rdo.c
> +index 52305fd72fab..2579f2808441 100644
> +--- a/src/rdo.c
> ++++ b/src/rdo.c
> +@@ -558,10 +558,10 @@ void kvz_rdoq(encoder_state_t * const state, coeff_t *coef, coeff_t *dest_coeff,
> +   // Explicitly tell the only possible numbers of elements to be zeroed.
> +   // Hope the compiler is able to utilize this information.
> +   switch (cg_num) {
> +-    case  1: memset(sig_coeffgroup_flag, 0,  1 * sizeof(sig_coeffgroup_flag[0])); break;
> +-    case  4: memset(sig_coeffgroup_flag, 0,  4 * sizeof(sig_coeffgroup_flag[0])); break;
> +-    case 16: memset(sig_coeffgroup_flag, 0, 16 * sizeof(sig_coeffgroup_flag[0])); break;
> +-    case 64: memset(sig_coeffgroup_flag, 0, 64 * sizeof(sig_coeffgroup_flag[0])); break;
> ++    case  1: FILL_ARRAY(sig_coeffgroup_flag, 0,  1); break;
> ++    case  4: FILL_ARRAY(sig_coeffgroup_flag, 0,  4); break;
> ++    case 16: FILL_ARRAY(sig_coeffgroup_flag, 0, 16); break;
> ++    case 64: FILL_ARRAY(sig_coeffgroup_flag, 0, 64); break;
> +     default: assert(0 && "There should be 1, 4, 16 or 64 coefficient groups");
> +   }
> + 
> +-- 
> +2.13.2
> +
> -- 
> 2.13.2
> 

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] kvazaar: fix build with gcc 7
  2017-07-13 18:15 [Buildroot] [PATCH] kvazaar: fix build with gcc 7 Baruch Siach
  2017-07-13 18:17 ` Baruch Siach
@ 2017-07-15  8:13 ` Thomas Petazzoni
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2017-07-15  8:13 UTC (permalink / raw)
  To: buildroot

Hello,

On Thu, 13 Jul 2017 21:15:08 +0300, Baruch Siach wrote:
> Add upstream fix for a gcc 7 -Werror build failure.
> 
> Cc: Alexandre Esse <alexandre.esse.dev@gmail.com>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
>  ...use-FILL_ARRAY-macro-to-prevent-warning-o.patch | 56 ++++++++++++++++++++++
>  1 file changed, 56 insertions(+)
>  create mode 100644 package/kvazaar/0001-Modify-and-use-FILL_ARRAY-macro-to-prevent-warning-o.patch

Applied to master, after adding the references to the autobuilder
failures that you provided. Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-15  8:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-13 18:15 [Buildroot] [PATCH] kvazaar: fix build with gcc 7 Baruch Siach
2017-07-13 18:17 ` Baruch Siach
2017-07-15  8:13 ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox