From 610f52f3bea153a3293e67b95f7c4f31e74d2ffd Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Wed, 2 Mar 2022 22:17:24 +0100 Subject: [PATCH] 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: pattern.c: In function 'is_valid_dns_name': pattern.c:134:3: error: 'for' loop initial declarations are only allowed in C99 mode for (const char *c = value;; c++) ^ pattern.c:134:3: note: use option -std=c99 or -std=gnu99 to compile your code pattern.c: In function 'is_valid_dns_name_pattern': pattern.c:249:3: error: 'for' loop initial declarations are only allowed in C99 mode for (const char *c = value;; c++) ^ Fixes: - http://autobuild.buildroot.org/results/eb0c34ff58eaf103f51c7171ecd97a3bdb887601 Signed-off-by: Fabrice Fontaine Signed-off-by: Peter Korsgaard --- ...src-pattern.c-fix-build-with-gcc-4.8.patch | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 package/dnsmasq/0004-src-pattern.c-fix-build-with-gcc-4.8.patch diff --git a/package/dnsmasq/0004-src-pattern.c-fix-build-with-gcc-4.8.patch b/package/dnsmasq/0004-src-pattern.c-fix-build-with-gcc-4.8.patch new file mode 100644 index 0000000000..90bb02b23a --- /dev/null +++ b/package/dnsmasq/0004-src-pattern.c-fix-build-with-gcc-4.8.patch @@ -0,0 +1,57 @@ +From 0c89dd2fa0fe50b00bca638dbbacfbd361526e0a Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine +Date: Sun, 2 Jan 2022 21:57:52 +0100 +Subject: [PATCH] src/pattern.c: fix build with gcc 4.8 + +Fix the following build failure: + +pattern.c: In function 'is_valid_dns_name': +pattern.c:134:3: error: 'for' loop initial declarations are only allowed in C99 mode + for (const char *c = value;; c++) + ^ +pattern.c:134:3: note: use option -std=c99 or -std=gnu99 to compile your code +pattern.c: In function 'is_valid_dns_name_pattern': +pattern.c:249:3: error: 'for' loop initial declarations are only allowed in C99 mode + for (const char *c = value;; c++) + ^ + +Signed-off-by: Fabrice Fontaine +[Retrieved from: +https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=commit;h=b2690415bfa1bc105e61b75f642fb5c1aaf0fae8] +--- + src/pattern.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/pattern.c b/src/pattern.c +index 03e23b9..928d259 100644 +--- a/src/pattern.c ++++ b/src/pattern.c +@@ -129,9 +129,9 @@ int is_valid_dns_name(const char *value) + + size_t num_bytes = 0; + size_t num_labels = 0; +- const char *label = NULL; ++ const char *c, *label = NULL; + int is_label_numeric = 1; +- for (const char *c = value;; c++) ++ for (c = value;; c++) + { + if (*c && + *c != '-' && *c != '.' && +@@ -242,11 +242,11 @@ int is_valid_dns_name_pattern(const char *value) + + size_t num_bytes = 0; + size_t num_labels = 0; +- const char *label = NULL; ++ const char *c, *label = NULL; + int is_label_numeric = 1; + size_t num_wildcards = 0; + int previous_label_has_wildcard = 1; +- for (const char *c = value;; c++) ++ for (c = value;; c++) + { + if (*c && + *c != '*' && /* Wildcard. */ +-- +2.20.1 +