Skip to contentSkip to conversation

package/dnsmasq: fix build with gcc 4.8

PATCH Applied Fabrice Fontaine 2 participants 2 messages Jan 2, 2022 – Jan 4, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/dnsmasq: fix build with gcc 4.8

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

---
 ...-src-option.c-fix-build-with-gcc-4.8.patch | 52 +++++++++++++++++++
 ...9080ff8743133fbd52427b4b2213171-typo.patch | 36 +++++++++++++
 2 files changed, 88 insertions(+)
 create mode 100644 package/dnsmasq/0001-src-option.c-fix-build-with-gcc-4.8.patch
 create mode 100644 package/dnsmasq/0002-Fix-46312909d9080ff8743133fbd52427b4b2213171-typo.patch
package/dnsmasq/0001-src-option.c-fix-build-with-gcc-4.8.patch new file +52 -0
new file mode 100644
index 0000000000..50ecf2f18a
@@ -0,0 +1,52 @@
+From 46312909d9080ff8743133fbd52427b4b2213171 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+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 <[email protected]>
+[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++) {
+             if (!isxdigit((int)*p))
+               ret_err(gen_err);
+           }
+@@ -2533,7 +2534,8 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
+ 
+           u8 *u = daemon->umbrella_device;
+           char word[3];
+-          for (u8 i = 0; i < sizeof(daemon->umbrella_device); i++, arg+=2) {
++          u8 i;
++          for (i = 0; i < sizeof(daemon->umbrella_device); i++, arg+=2) {
+             memcpy(word, &(arg[0]), 2);
+             *u++ = strtoul(word, NULL, 16);
+           }
+-- 
+2.33.0
+
package/dnsmasq/0002-Fix-46312909d9080ff8743133fbd52427b4b2213171-typo.patch new file +36 -0
new file mode 100644
index 0000000000..8cdf5b3f1b
@@ -0,0 +1,36 @@
+From 2748fb81e23b71e2c44956e99321816aca91905d Mon Sep 17 00:00:00 2001
+From: Simon Kelley <[email protected]>
+Date: Sat, 1 Jan 2022 23:03:26 +0000
+Subject: [PATCH] Fix 46312909d9080ff8743133fbd52427b4b2213171 typo.
+
+[Upstream commit 2748fb81e23b71e2c44956e99321816aca91905d]
+Signed-off-by: Fabrice Fontaine <[email protected]> 
+---
+ src/option.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/option.c b/src/option.c
+index c57f6d8..6f56ce8 100644
+--- a/src/option.c
++++ b/src/option.c
+@@ -357,7 +357,7 @@ static const struct myoption opts[] =
+     { "dhcp-ignore-clid", 0, 0,  LOPT_IGNORE_CLID },
+     { "dynamic-host", 1, 0, LOPT_DYNHOST },
+     { "log-debug", 0, 0, LOPT_LOG_DEBUG },
+-	{ "umbrella", 2, 0, LOPT_UMBRELLA },
++    { "umbrella", 2, 0, LOPT_UMBRELLA },
+     { "quiet-tftp", 0, 0, LOPT_QUIET_TFTP },
+     { NULL, 0, 0, 0 }
+   };
+@@ -2526,7 +2526,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
+           if (strlen(arg) != 16)
+               ret_err(gen_err);
+           char *p;
+-          for (*p = arg; *p; p++) {
++          for (p = arg; *p; p++) {
+             if (!isxdigit((int)*p))
+               ret_err(gen_err);
+           }
+-- 
+2.33.0
+
Signature · 6 lines
2.33.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 12 lines · Fabrice Fontaine

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) {
            ^
Quoted 4 lines

Fixes:
- http://autobuild.buildroot.org/results/39b34a4e69fc10f4bd9d4ddb0ed8c0aae5741c84

Applied to master, thanks.

Regards,
Arnout

Quoted 98 lines
---
  ...-src-option.c-fix-build-with-gcc-4.8.patch | 52 +++++++++++++++++++
  ...9080ff8743133fbd52427b4b2213171-typo.patch | 36 +++++++++++++
  2 files changed, 88 insertions(+)

create mode 100644 package/dnsmasq/0001-src-option.c-fix-build-with-gcc-4.8.patch create mode 100644 package/dnsmasq/0002-Fix-46312909d9080ff8743133fbd52427b4b2213171-typo.patch

package/dnsmasq/0001-src-option.c-fix-build-with-gcc-4.8.patch new file +52 -0
new file mode 100644
index 0000000000..50ecf2f18a
@@ -0,0 +1,52 @@
+From 46312909d9080ff8743133fbd52427b4b2213171 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+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 <[email protected]>
+[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++) {
+             if (!isxdigit((int)*p))
+               ret_err(gen_err);
+           }
+@@ -2533,7 +2534,8 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
+
+           u8 *u = daemon->umbrella_device;
+           char word[3];
+-          for (u8 i = 0; i < sizeof(daemon->umbrella_device); i++, arg+=2) {
++          u8 i;
++          for (i = 0; i < sizeof(daemon->umbrella_device); i++, arg+=2) {
+             memcpy(word, &(arg[0]), 2);
+             *u++ = strtoul(word, NULL, 16);
+           }
+--
+2.33.0
+
package/dnsmasq/0002-Fix-46312909d9080ff8743133fbd52427b4b2213171-typo.patch new file +26 -0
new file mode 100644
index 0000000000..8cdf5b3f1b
@@ -0,0 +1,36 @@
+From 2748fb81e23b71e2c44956e99321816aca91905d Mon Sep 17 00:00:00 2001
+From: Simon Kelley <[email protected]>
+Date: Sat, 1 Jan 2022 23:03:26 +0000
+Subject: [PATCH] Fix 46312909d9080ff8743133fbd52427b4b2213171 typo.
+
+[Upstream commit 2748fb81e23b71e2c44956e99321816aca91905d]
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ src/option.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/option.c b/src/option.c
+index c57f6d8..6f56ce8 100644
+--- a/src/option.c
++++ b/src/option.c
+@@ -357,7 +357,7 @@ static const struct myoption opts[] =
+     { "dhcp-ignore-clid", 0, 0,  LOPT_IGNORE_CLID },
+     { "dynamic-host", 1, 0, LOPT_DYNHOST },
+     { "log-debug", 0, 0, LOPT_LOG_DEBUG },
+-	{ "umbrella", 2, 0, LOPT_UMBRELLA },
++    { "umbrella", 2, 0, LOPT_UMBRELLA },
+     { "quiet-tftp", 0, 0, LOPT_QUIET_TFTP },
+     { NULL, 0, 0, 0 }
+   };
+@@ -2526,7 +2526,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
+           if (strlen(arg) != 16)

package/dnsmasq/0002-Fix-46312909d9080ff8743133fbd52427b4b2213171-typo.patch line 36

Quoted 10 lines
package/dnsmasq/0002-Fix-46312909d9080ff8743133fbd52427b4b2213171-typo.patch new file +10 -0
+               ret_err(gen_err);
+           char *p;
+-          for (*p = arg; *p; p++) {
++          for (p = arg; *p; p++) {
+             if (!isxdigit((int)*p))
+               ret_err(gen_err);
+           }
+--
+2.33.0
+

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot