diff mbox series

[1/1] package/uboot-tools: Fix loop positional declaration build error

Message ID 1552923418-22447-1-git-send-email-email@gmail.com
State Rejected
Headers show
Series [1/1] package/uboot-tools: Fix loop positional declaration build error | expand

Commit Message

Vadym Kochan March 18, 2019, 3:36 p.m. UTC
From: Vadim Kochan <vadim4j@gmail.com>

Move 'i' variable outside of the 'for' loop to separate declaration
in lib/crc16.c

Fixes:
	http://autobuild.buildroot.net/results/332c9d2232c03440bf71794ee7850b1f6fd51d11/

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
---
 ...04-lib-crc16-Fix-loop-initial-declaration.patch | 38 ++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 package/uboot-tools/0004-lib-crc16-Fix-loop-initial-declaration.patch

Comments

Thomas Petazzoni March 18, 2019, 4:12 p.m. UTC | #1
On Mon, 18 Mar 2019 17:36:58 +0200
Vadim Kochan <vadim4j@gmail.com> wrote:

> From: Vadim Kochan <vadim4j@gmail.com>
> 
> Move 'i' variable outside of the 'for' loop to separate declaration
> in lib/crc16.c
> 
> Fixes:
> 	http://autobuild.buildroot.net/results/332c9d2232c03440bf71794ee7850b1f6fd51d11/
> 
> Signed-off-by: Vadim Kochan <vadim4j@gmail.com>

Thanks for the fix, but I already submitted a similar one, and upstream
U-Boot wants to handle this different, see
https://lists.denx.de/pipermail/u-boot/2019-February/358821.html. I
didn't get to doing the change upstream U-Boot suggested.

Best regards,

Thomas
Vadym Kochan March 18, 2019, 4:22 p.m. UTC | #2
On Mon, Mar 18, 2019 at 05:12:37PM +0100, Thomas Petazzoni wrote:
> On Mon, 18 Mar 2019 17:36:58 +0200
> Vadim Kochan <vadim4j@gmail.com> wrote:
> 
> > From: Vadim Kochan <vadim4j@gmail.com>
> > 
> > Move 'i' variable outside of the 'for' loop to separate declaration
> > in lib/crc16.c
> > 
> > Fixes:
> > 	http://autobuild.buildroot.net/results/332c9d2232c03440bf71794ee7850b1f6fd51d11/
> > 
> > Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
> 
> Thanks for the fix, but I already submitted a similar one, and upstream
> U-Boot wants to handle this different, see
> https://lists.denx.de/pipermail/u-boot/2019-February/358821.html. I
> didn't get to doing the change upstream U-Boot suggested.
> 

OK, I've marked it as 'Rejected' :-)

Regards,
Vadim Kochan
Vadym Kochan March 25, 2019, 10:59 a.m. UTC | #3
Hi Thomas,

On Mon, Mar 18, 2019 at 05:12:37PM +0100, Thomas Petazzoni wrote:
> On Mon, 18 Mar 2019 17:36:58 +0200
> Vadim Kochan <vadim4j@gmail.com> wrote:
> 
> > From: Vadim Kochan <vadim4j@gmail.com>
> > 
> > Move 'i' variable outside of the 'for' loop to separate declaration
> > in lib/crc16.c
> > 
> > Fixes:
> > 	http://autobuild.buildroot.net/results/332c9d2232c03440bf71794ee7850b1f6fd51d11/
> > 
> > Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
> 
> Thanks for the fix, but I already submitted a similar one, and upstream
> U-Boot wants to handle this different, see
> https://lists.denx.de/pipermail/u-boot/2019-February/358821.html. I
> didn't get to doing the change upstream U-Boot suggested.
> 

So, may be then just add your patch to the u-boot-tools package ?

Regards,
Vadim Kochan
diff mbox series

Patch

diff --git a/package/uboot-tools/0004-lib-crc16-Fix-loop-initial-declaration.patch b/package/uboot-tools/0004-lib-crc16-Fix-loop-initial-declaration.patch
new file mode 100644
index 0000000..65b4c2f
--- /dev/null
+++ b/package/uboot-tools/0004-lib-crc16-Fix-loop-initial-declaration.patch
@@ -0,0 +1,38 @@ 
+From 1f6e30d11d7f58b028e42291e112cd44fbdcdbe9 Mon Sep 17 00:00:00 2001
+From: Vadim Kochan <vadim4j@gmail.com>
+Date: Mon, 18 Mar 2019 17:26:36 +0200
+Subject: [PATCH] lib/crc16: Fix loop initial declaration
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fix build error:
+
+    ./tools/../lib/crc16.c:70:2: error: ‘for’ loop initial declarations are
+        only allowed in C99 or C11 mode
+
+by moving 'i' variable from 'for' loop to separate declaration.
+
+Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
+---
+ lib/crc16.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/lib/crc16.c b/lib/crc16.c
+index f46ba72..89d2cff 100644
+--- a/lib/crc16.c
++++ b/lib/crc16.c
+@@ -67,7 +67,9 @@ static const uint16_t crc16_tab[] = {
+ 
+ uint16_t crc16_ccitt(uint16_t cksum, const unsigned char *buf, int len)
+ {
+-	for (int i = 0;  i < len;  i++)
++	int i;
++
++	for (i = 0;  i < len;  i++)
+ 		cksum = crc16_tab[((cksum>>8) ^ *buf++) & 0xff] ^ (cksum << 8);
+ 
+ 	return cksum;
+-- 
+2.7.4
+