From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] lib/crc16: use non-C99 loop style
Date: Wed, 13 Feb 2019 22:57:28 +0100 [thread overview]
Message-ID: <20190213215728.21603-1-thomas.petazzoni@bootlin.com> (raw)
Commit 51c2345bd24837f9f67f16268da6dc71573f1325 ("Roll CRC16-CCITT
into the hash infrastructure") has modified the crc16 code by adding a
C99-style loop where the loop iterator is declared inside the for()
statement. This breaks the build with old compiler such as gcc 4.7,
that do not default to C99:
./tools/../lib/crc16.c: In function 'crc16_ccitt':
./tools/../lib/crc16.c:70:2: error: 'for' loop initial declarations are only allowed in C99 mode
./tools/../lib/crc16.c:70:2: note: use option -std=c99 or -std=gnu99 to compile your code
Switching to the regular coding style used in the rest of U-Boot
allows to fix this build issue.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
lib/crc16.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/crc16.c b/lib/crc16.c
index f46ba727c9..89d2cff131 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.20.1
next reply other threads:[~2019-02-13 21:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-13 21:57 Thomas Petazzoni [this message]
2019-02-13 22:50 ` [U-Boot] [PATCH] lib/crc16: use non-C99 loop style Philipp Tomsich
2019-02-14 0:31 ` Tom Rini
2019-02-14 0:57 ` Philipp Tomsich
2019-02-14 7:56 ` Thomas Petazzoni
2019-02-14 11:35 ` Philipp Tomsich
2019-02-14 12:22 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190213215728.21603-1-thomas.petazzoni@bootlin.com \
--to=thomas.petazzoni@bootlin.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox