Skip to contentSkip to conversation

iptables: Remove const qualifier from struct option.

PATCH Applied Varsha Rao 2 participants 4 messages Dec 21, 2017 netfilter

lore
Share & tools
lore

Varsha Rao

author
#0 lore raw

PATCH 1/1 iptables: Remove const qualifier from struct option.

As opts is reassigned multiple times, it cannot be made constant. So remove const qualifier from structure option. This patch fixes the following warning:

warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
.orig_opts = original_opts,

---
 iptables/ip6tables.c | 2 +-
 iptables/iptables.c  | 2 +-
 iptables/xtables.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
iptables/ip6tables.c +1 -1
index 0f6fa31a..49bd006f 100644
@@ -78,7 +78,7 @@ static const char optflags[]
 
 static const char unsupported_rev[] = " [unsupported revision]";
 
-static const struct option original_opts[] = {
+static struct option original_opts[] = {
 	{.name = "append",        .has_arg = 1, .val = 'A'},
 	{.name = "delete",        .has_arg = 1, .val = 'D'},
 	{.name = "check" ,        .has_arg = 1, .val = 'C'},
iptables/iptables.c +1 -1
index e930fe26..69d19fec 100644
@@ -75,7 +75,7 @@ static const char optflags[]
 
 static const char unsupported_rev[] = " [unsupported revision]";
 
-static const struct option original_opts[] = {
+static struct option original_opts[] = {
 	{.name = "append",        .has_arg = 1, .val = 'A'},
 	{.name = "delete",        .has_arg = 1, .val = 'D'},
 	{.name = "check",         .has_arg = 1, .val = 'C'},
iptables/xtables.c +1 -1
index aebe7d77..ac113254 100644
@@ -59,7 +59,7 @@ static const char cmdflags[] = { 'I', 'D', 'D', 'R', 'A', 'L', 'F', 'Z',
 static const char optflags[]
 = { 'n', 's', 'd', 'p', 'j', 'v', 'x', 'i', 'o', '0', 'c', 'f'};
 
-static const struct option original_opts[] = {
+static struct option original_opts[] = {
 	{.name = "append",	  .has_arg = 1, .val = 'A'},
 	{.name = "delete",	  .has_arg = 1, .val = 'D'},
 	{.name = "check",	  .has_arg = 1, .val = 'C'},
Signature · 1 line
2.14.3
author
#1 lore raw

PATCH 1/1 extensions: Add macro _DEFAULT_SOURCE.

Define _DEFAULT_SOURCE as _BSD_SOURCE is deprecated.
https://sourceware.org/glibc/wiki/Release/2.20#Packaging_Changes

This patch fixes the following warning:

warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]

 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use
 # _DEFAULT_SOURCE"
---
 extensions/libxt_hashlimit.c | 1 +
 extensions/libxt_limit.c     | 1 +
 2 files changed, 2 insertions(+)
extensions/libxt_hashlimit.c +1 -0
index e51ac1ae..ffe342a7 100644
@@ -11,6 +11,7 @@
  * Error corections by [email protected] (22.01.2005)
  */
 #define _BSD_SOURCE 1
+#define _DEFAULT_SOURCE 1
 #define _ISOC99_SOURCE 1
 #include <inttypes.h>
 #include <math.h>
extensions/libxt_limit.c +1 -0
index 5cc95c2e..c8ddca87 100644
@@ -4,6 +4,7 @@
  * Hervé Eychenne    <[email protected]>
  */
 #define _BSD_SOURCE 1
+#define _DEFAULT_SOURCE 1
 #define _ISOC99_SOURCE 1
 #include <math.h>
 #include <stdio.h>
Signature · 1 line
2.14.3
#2 lore raw

Re: [PATCH iptables] extensions: Add macro _DEFAULT_SOURCE.

Quoted 9 lines · Varsha Rao

Define _DEFAULT_SOURCE as _BSD_SOURCE is deprecated.
https://sourceware.org/glibc/wiki/Release/2.20#Packaging_Changes

This patch fixes the following warning:

warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]

 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use
 # _DEFAULT_SOURCE"

Also applied, thanks.

maintainer Applied
#3 lore raw
In reply to Varsha Rao
Quoted 7 lines · Varsha Rao

As opts is reassigned multiple times, it cannot be made constant. So remove const qualifier from structure option. This patch fixes the following warning:

warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
.orig_opts = original_opts,

Applied, thanks Varsha.