All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Arnout Vandecappelle' <arnout@mind.be>,
	"buildroot@buildroot.org" <buildroot@buildroot.org>
Subject: Re: [Buildroot] [git commit] package/dnsmasq: fix build with gcc 4.8
Date: Wed, 5 Jan 2022 12:01:42 +0000	[thread overview]
Message-ID: <516a76d402014d0fb3d8e1b0cb8ef462@AcuMS.aculab.com> (raw)
In-Reply-To: <20220104180257.67D5282BA6@busybox.osuosl.org>

From: Arnout Vandecappelle
> Sent: 04 January 2022 17:49
> 
> commit: https://git.buildroot.net/buildroot/commit/?id=17aa836bd7a2c90da053398ce024b4113cf8b53c
> branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master
> 
> Fix the following build failure with gcc 4.8 raised since bump to
> version 2.86 in commit 5b29096f8fcb0acd8890073a56ba9d620b1f911c:
> 
> option.c: In function 'one_opt':
> option.c:2445:11: error: 'for' loop initial declarations are only allowed in C99 mode
>            for (char *p = arg; *p; p++) {
>            ^
> option.c:2445:11: note: use option -std=c99 or -std=gnu99 to compile your code
> option.c:2453:11: error: 'for' loop initial declarations are only allowed in C99 mode
>            for (u8 i = 0; i < sizeof(daemon->umbrella_device); i++, arg+=2) {
>            ^
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/39b34a4e69fc10f4bd9d4ddb0ed8c0aae5741c84
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> ---
>  .../0001-src-option.c-fix-build-with-gcc-4.8.patch | 52 ++++++++++++++++++++++
>  ...2909d9080ff8743133fbd52427b4b2213171-typo.patch | 36 +++++++++++++++
>  2 files changed, 88 insertions(+)
> 
> diff --git a/package/dnsmasq/0001-src-option.c-fix-build-with-gcc-4.8.patch b/package/dnsmasq/0001-
> src-option.c-fix-build-with-gcc-4.8.patch
> new file mode 100644
> index 0000000000..50ecf2f18a
> --- /dev/null
> +++ b/package/dnsmasq/0001-src-option.c-fix-build-with-gcc-4.8.patch
> @@ -0,0 +1,52 @@
> +From 46312909d9080ff8743133fbd52427b4b2213171 Mon Sep 17 00:00:00 2001
> +From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +Date: Fri, 31 Dec 2021 17:29:44 +0100
> +Subject: [PATCH] src/option.c: fix build with gcc 4.8
> +
> +Fix the following build failure with gcc 4.8 raised since version 2.86:
> +
> +option.c: In function 'one_opt':
> +option.c:2445:11: error: 'for' loop initial declarations are only allowed in C99 mode
> +           for (char *p = arg; *p; p++) {
> +           ^
> +option.c:2445:11: note: use option -std=c99 or -std=gnu99 to compile your code
> +option.c:2453:11: error: 'for' loop initial declarations are only allowed in C99 mode
> +           for (u8 i = 0; i < sizeof(daemon->umbrella_device); i++, arg+=2) {
> +           ^
> +
> +Fixes:
> + - http://autobuild.buildroot.org/results/39b34a4e69fc10f4bd9d4ddb0ed8c0aae5741c84
> +
> +Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +[Upstream commit 46312909d9080ff8743133fbd52427b4b2213171]
> +---
> + src/option.c | 6 ++++--
> + 1 file changed, 4 insertions(+), 2 deletions(-)
> +
> +diff --git a/src/option.c b/src/option.c
> +index ff54def..c57f6d8 100644
> +--- a/src/option.c
> ++++ b/src/option.c
> +@@ -2525,7 +2525,8 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int
> comma
> +           arg += 9;
> +           if (strlen(arg) != 16)
> +               ret_err(gen_err);
> +-          for (char *p = arg; *p; p++) {
> ++          char *p;
> ++          for (*p = arg; *p; p++) {

Isn't that going to get an error for mixing code and declarations?

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2022-01-05 12:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04 17:49 [Buildroot] [git commit] package/dnsmasq: fix build with gcc 4.8 Arnout Vandecappelle
2022-01-05 12:01 ` David Laight [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-03-03 21:26 Peter Korsgaard

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=516a76d402014d0fb3d8e1b0cb8ef462@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=arnout@mind.be \
    --cc=buildroot@buildroot.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.