netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Cernekee <cernekee@chromium.org>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH libnetfilter_conntrack] src: Make the library compile under clang
Date: Sun, 14 Aug 2016 13:59:01 -0700	[thread overview]
Message-ID: <1471208341-24673-1-git-send-email-cernekee@chromium.org> (raw)

clang treats "char buffer[size]" inside a union as VLAIS unless |size|
is const:

src/conntrack/api.c:992:8: error: fields must have a constant size: 'variable length array in structure' extension will never be supported
                char buffer[size];
                     ^

Signed-off-by: Kevin Cernekee <cernekee@chromium.org>
---
 src/conntrack/api.c | 4 ++--
 src/expect/api.c    | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/conntrack/api.c b/src/conntrack/api.c
index e4d4acc312bb..bed2e42c8f43 100644
--- a/src/conntrack/api.c
+++ b/src/conntrack/api.c
@@ -955,7 +955,7 @@ int nfct_query(struct nfct_handle *h,
 	       const enum nf_conntrack_query qt,
 	       const void *data)
 {
-	size_t size = 4096;	/* enough for now */
+	const size_t size = 4096;	/* enough for now */
 	union {
 		char buffer[size];
 		struct nfnlhdr req;
@@ -987,7 +987,7 @@ int nfct_send(struct nfct_handle *h,
 	      const enum nf_conntrack_query qt,
 	      const void *data)
 {
-	size_t size = 4096;	/* enough for now */
+	const size_t size = 4096;	/* enough for now */
 	union {
 		char buffer[size];
 		struct nfnlhdr req;
diff --git a/src/expect/api.c b/src/expect/api.c
index 8ff20e2821e3..3f1763038ede 100644
--- a/src/expect/api.c
+++ b/src/expect/api.c
@@ -669,7 +669,7 @@ int nfexp_query(struct nfct_handle *h,
 	        const enum nf_conntrack_query qt,
 	        const void *data)
 {
-	size_t size = 4096;	/* enough for now */
+	const size_t size = 4096;	/* enough for now */
 	union {
 		char buffer[size];
 		struct nfnlhdr req;
@@ -701,7 +701,7 @@ int nfexp_send(struct nfct_handle *h,
 	       const enum nf_conntrack_query qt,
 	       const void *data)
 {
-	size_t size = 4096;	/* enough for now */
+	const size_t size = 4096;	/* enough for now */
 	union {
 		char buffer[size];
 		struct nfnlhdr req;
-- 
2.8.0.rc3.226.g39d4020


             reply	other threads:[~2016-08-14 20:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-14 20:59 Kevin Cernekee [this message]
2016-08-17 15:05 ` [PATCH libnetfilter_conntrack] src: Make the library compile under clang Pablo Neira Ayuso

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=1471208341-24673-1-git-send-email-cernekee@chromium.org \
    --to=cernekee@chromium.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).