netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* libnftables header includes fixups
@ 2013-10-28 12:27 Jan Engelhardt
  2013-10-28 12:27 ` [PATCH 1/4] build: resolve automake 1.12 warning Jan Engelhardt
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Jan Engelhardt @ 2013-10-28 12:27 UTC (permalink / raw)
  To: netfilter-devel; +Cc: pablo


The following changes since commit d8aec16c2b73a3f7b5183ccbe25d0522bf2f4f3c:

  include: fix missing struct nlmsghdr without definition (2013-10-27 22:03:01 +0100)

are available in the git repository at:

  git://git.inai.de/libnftables master

for you to fetch changes up to ca1a38c6aa552df9723c40459b7daccf381e8cd9:

  build: use C++11 headers if available (2013-10-28 13:24:34 +0100)

----------------------------------------------------------------
Jan Engelhardt (4):
      build: resolve automake 1.12 warning
      build: resolve build errors in dependent programs
      build: avoid inclusion of stdbool.h in C++
      build: use C++11 headers if available

 configure.ac                  |  1 +
 include/libnftables/chain.h   | 11 +++++++++--
 include/libnftables/expr.h    | 11 +++++++++--
 include/libnftables/rule.h    | 11 +++++++++--
 include/libnftables/ruleset.h | 10 ++++++++++
 include/libnftables/set.h     | 11 +++++++++--
 include/libnftables/table.h   | 11 +++++++++--
 7 files changed, 56 insertions(+), 10 deletions(-)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/4] build: resolve automake 1.12 warning
  2013-10-28 12:27 libnftables header includes fixups Jan Engelhardt
@ 2013-10-28 12:27 ` Jan Engelhardt
  2013-11-05 12:55   ` Pablo Neira Ayuso
  2013-10-28 12:27 ` [PATCH 2/4] build: resolve build errors in dependent programs Jan Engelhardt
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Jan Engelhardt @ 2013-10-28 12:27 UTC (permalink / raw)
  To: netfilter-devel; +Cc: pablo

ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac'

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
---
 configure.ac | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 4d601a6..4758a49 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,6 +5,7 @@ AC_CONFIG_AUX_DIR([build-aux])
 AC_CANONICAL_HOST
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_HEADERS([config.h])
+m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
 
 AM_INIT_AUTOMAKE([-Wall foreign tar-pax no-dist-gzip dist-bzip2
 	1.6 subdir-objects])
-- 
1.8.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] build: resolve build errors in dependent programs
  2013-10-28 12:27 libnftables header includes fixups Jan Engelhardt
  2013-10-28 12:27 ` [PATCH 1/4] build: resolve automake 1.12 warning Jan Engelhardt
@ 2013-10-28 12:27 ` Jan Engelhardt
  2013-11-05 12:56   ` Pablo Neira Ayuso
  2013-10-28 12:27 ` [PATCH 3/4] build: avoid inclusion of stdbool.h in C++ Jan Engelhardt
  2013-10-28 12:27 ` [PATCH 4/4] build: use C++11 headers if available Jan Engelhardt
  3 siblings, 1 reply; 9+ messages in thread
From: Jan Engelhardt @ 2013-10-28 12:27 UTC (permalink / raw)
  To: netfilter-devel; +Cc: pablo

The headers do not compile standalone, which also causes nftables to
fail to build for the same reason.

	$ gcc -x c -Wall -c *.h
	chain.h:62:35: error: unknown type name ‘size_t’
	expr.h:40:39: error: unknown type name ‘size_t’
	rule.h:60:34: error: unknown type name ‘size_t’
	ruleset.h:20:1: error: unknown type name ‘bool’
	ruleset.h:20:59: error: unknown type name ‘uint16_t’
	ruleset.h:21:52: error: unknown type name ‘uint16_t’
	ruleset.h:22:50: error: unknown type name ‘uint16_t’
	ruleset.h:23:63: error: unknown type name ‘uint16_t’
	ruleset.h:39:37: error: unknown type name ‘size_t’
	ruleset.h:39:80: error: unknown type name ‘uint32_t’
	ruleset.h:39:95: error: unknown type name ‘uint32_t’
	set.h:40:33: error: unknown type name ‘size_t’
	set.h:110:38: error: unknown type name ‘size_t’
	table.h:50:35: error: unknown type name ‘size_t’

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
---
 include/libnftables/chain.h   | 1 +
 include/libnftables/expr.h    | 1 +
 include/libnftables/rule.h    | 1 +
 include/libnftables/ruleset.h | 4 ++++
 include/libnftables/set.h     | 1 +
 include/libnftables/table.h   | 1 +
 6 files changed, 9 insertions(+)

diff --git a/include/libnftables/chain.h b/include/libnftables/chain.h
index d85a2a2..d3ba75b 100644
--- a/include/libnftables/chain.h
+++ b/include/libnftables/chain.h
@@ -3,6 +3,7 @@
 
 #include <stdint.h>
 #include <stdbool.h>
+#include <sys/types.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/include/libnftables/expr.h b/include/libnftables/expr.h
index 64c407c..81e224c 100644
--- a/include/libnftables/expr.h
+++ b/include/libnftables/expr.h
@@ -3,6 +3,7 @@
 
 #include <stdint.h>
 #include <stdbool.h>
+#include <sys/types.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/include/libnftables/rule.h b/include/libnftables/rule.h
index a501d2d..5b5263a 100644
--- a/include/libnftables/rule.h
+++ b/include/libnftables/rule.h
@@ -3,6 +3,7 @@
 
 #include <stdint.h>
 #include <stdbool.h>
+#include <sys/types.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/include/libnftables/ruleset.h b/include/libnftables/ruleset.h
index a4a1279..49f7c4e 100644
--- a/include/libnftables/ruleset.h
+++ b/include/libnftables/ruleset.h
@@ -1,6 +1,10 @@
 #ifndef _RULESET_H_
 #define _RULESET_H_
 
+#include <stdbool.h>
+#include <stdint.h>
+#include <sys/types.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/include/libnftables/set.h b/include/libnftables/set.h
index 14a6327..1bd7670 100644
--- a/include/libnftables/set.h
+++ b/include/libnftables/set.h
@@ -3,6 +3,7 @@
 
 #include <stdint.h>
 #include <stdbool.h>
+#include <sys/types.h>
 
 enum {
 	NFT_SET_ATTR_TABLE,
diff --git a/include/libnftables/table.h b/include/libnftables/table.h
index 42a4aa7..86978e1 100644
--- a/include/libnftables/table.h
+++ b/include/libnftables/table.h
@@ -3,6 +3,7 @@
 
 #include <stdint.h>
 #include <stdbool.h>
+#include <sys/types.h>
 
 #ifdef __cplusplus
 extern "C" {
-- 
1.8.2

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] build: avoid inclusion of stdbool.h in C++
  2013-10-28 12:27 libnftables header includes fixups Jan Engelhardt
  2013-10-28 12:27 ` [PATCH 1/4] build: resolve automake 1.12 warning Jan Engelhardt
  2013-10-28 12:27 ` [PATCH 2/4] build: resolve build errors in dependent programs Jan Engelhardt
@ 2013-10-28 12:27 ` Jan Engelhardt
  2013-11-05 12:57   ` Pablo Neira Ayuso
  2013-10-28 12:27 ` [PATCH 4/4] build: use C++11 headers if available Jan Engelhardt
  3 siblings, 1 reply; 9+ messages in thread
From: Jan Engelhardt @ 2013-10-28 12:27 UTC (permalink / raw)
  To: netfilter-devel; +Cc: pablo

C++ does not need this header, as it already has bool builtin.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
---
 include/libnftables/chain.h   | 4 +++-
 include/libnftables/expr.h    | 4 +++-
 include/libnftables/rule.h    | 4 +++-
 include/libnftables/ruleset.h | 4 +++-
 include/libnftables/set.h     | 4 +++-
 include/libnftables/table.h   | 4 +++-
 6 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/include/libnftables/chain.h b/include/libnftables/chain.h
index d3ba75b..13b037d 100644
--- a/include/libnftables/chain.h
+++ b/include/libnftables/chain.h
@@ -2,7 +2,9 @@
 #define _CHAIN_H_
 
 #include <stdint.h>
-#include <stdbool.h>
+#ifndef __cplusplus
+#	include <stdbool.h>
+#endif
 #include <sys/types.h>
 
 #ifdef __cplusplus
diff --git a/include/libnftables/expr.h b/include/libnftables/expr.h
index 81e224c..d5f13a6 100644
--- a/include/libnftables/expr.h
+++ b/include/libnftables/expr.h
@@ -2,7 +2,9 @@
 #define _RULE_EXPR_H_
 
 #include <stdint.h>
-#include <stdbool.h>
+#ifndef __cplusplus
+#	include <stdbool.h>
+#endif
 #include <sys/types.h>
 
 #ifdef __cplusplus
diff --git a/include/libnftables/rule.h b/include/libnftables/rule.h
index 5b5263a..cb71e49 100644
--- a/include/libnftables/rule.h
+++ b/include/libnftables/rule.h
@@ -2,7 +2,9 @@
 #define _RULE_H_
 
 #include <stdint.h>
-#include <stdbool.h>
+#ifndef __cplusplus
+#	include <stdbool.h>
+#endif
 #include <sys/types.h>
 
 #ifdef __cplusplus
diff --git a/include/libnftables/ruleset.h b/include/libnftables/ruleset.h
index 49f7c4e..96ff425 100644
--- a/include/libnftables/ruleset.h
+++ b/include/libnftables/ruleset.h
@@ -1,7 +1,9 @@
 #ifndef _RULESET_H_
 #define _RULESET_H_
 
-#include <stdbool.h>
+#ifndef __cplusplus
+#	include <stdbool.h>
+#endif
 #include <stdint.h>
 #include <sys/types.h>
 
diff --git a/include/libnftables/set.h b/include/libnftables/set.h
index 1bd7670..92af85c 100644
--- a/include/libnftables/set.h
+++ b/include/libnftables/set.h
@@ -2,7 +2,9 @@
 #define _NFT_SET_H_
 
 #include <stdint.h>
-#include <stdbool.h>
+#ifndef __cplusplus
+#	include <stdbool.h>
+#endif
 #include <sys/types.h>
 
 enum {
diff --git a/include/libnftables/table.h b/include/libnftables/table.h
index 86978e1..b91a457 100644
--- a/include/libnftables/table.h
+++ b/include/libnftables/table.h
@@ -2,7 +2,9 @@
 #define _TABLE_H_
 
 #include <stdint.h>
-#include <stdbool.h>
+#ifndef __cplusplus
+#	include <stdbool.h>
+#endif
 #include <sys/types.h>
 
 #ifdef __cplusplus
-- 
1.8.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] build: use C++11 headers if available
  2013-10-28 12:27 libnftables header includes fixups Jan Engelhardt
                   ` (2 preceding siblings ...)
  2013-10-28 12:27 ` [PATCH 3/4] build: avoid inclusion of stdbool.h in C++ Jan Engelhardt
@ 2013-10-28 12:27 ` Jan Engelhardt
  3 siblings, 0 replies; 9+ messages in thread
From: Jan Engelhardt @ 2013-10-28 12:27 UTC (permalink / raw)
  To: netfilter-devel; +Cc: pablo

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
---
 include/libnftables/chain.h   | 6 +++++-
 include/libnftables/expr.h    | 6 +++++-
 include/libnftables/rule.h    | 6 +++++-
 include/libnftables/ruleset.h | 6 +++++-
 include/libnftables/set.h     | 6 +++++-
 include/libnftables/table.h   | 6 +++++-
 6 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/include/libnftables/chain.h b/include/libnftables/chain.h
index 13b037d..0e2035d 100644
--- a/include/libnftables/chain.h
+++ b/include/libnftables/chain.h
@@ -1,7 +1,11 @@
 #ifndef _CHAIN_H_
 #define _CHAIN_H_
 
-#include <stdint.h>
+#if defined(__cplusplus) && __cplusplus >= 201100L
+#	include <cstdint>
+#else
+#	include <stdint.h>
+#endif
 #ifndef __cplusplus
 #	include <stdbool.h>
 #endif
diff --git a/include/libnftables/expr.h b/include/libnftables/expr.h
index d5f13a6..0b16db3 100644
--- a/include/libnftables/expr.h
+++ b/include/libnftables/expr.h
@@ -1,7 +1,11 @@
 #ifndef _RULE_EXPR_H_
 #define _RULE_EXPR_H_
 
-#include <stdint.h>
+#if defined(__cplusplus) && __cplusplus >= 201100L
+#	include <cstdint>
+#else
+#	include <stdint.h>
+#endif
 #ifndef __cplusplus
 #	include <stdbool.h>
 #endif
diff --git a/include/libnftables/rule.h b/include/libnftables/rule.h
index cb71e49..915d4ea 100644
--- a/include/libnftables/rule.h
+++ b/include/libnftables/rule.h
@@ -1,7 +1,11 @@
 #ifndef _RULE_H_
 #define _RULE_H_
 
-#include <stdint.h>
+#if defined(__cplusplus) && __cplusplus >= 201100L
+#	include <cstdint>
+#else
+#	include <stdint.h>
+#endif
 #ifndef __cplusplus
 #	include <stdbool.h>
 #endif
diff --git a/include/libnftables/ruleset.h b/include/libnftables/ruleset.h
index 96ff425..0efc831 100644
--- a/include/libnftables/ruleset.h
+++ b/include/libnftables/ruleset.h
@@ -4,7 +4,11 @@
 #ifndef __cplusplus
 #	include <stdbool.h>
 #endif
-#include <stdint.h>
+#if defined(__cplusplus) && __cplusplus >= 201100L
+#	include <cstdint>
+#else
+#	include <stdint.h>
+#endif
 #include <sys/types.h>
 
 #ifdef __cplusplus
diff --git a/include/libnftables/set.h b/include/libnftables/set.h
index 92af85c..c9553b6 100644
--- a/include/libnftables/set.h
+++ b/include/libnftables/set.h
@@ -1,7 +1,11 @@
 #ifndef _NFT_SET_H_
 #define _NFT_SET_H_
 
-#include <stdint.h>
+#if defined(__cplusplus) && __cplusplus >= 201100L
+#	include <cstdint>
+#else
+#	include <stdint.h>
+#endif
 #ifndef __cplusplus
 #	include <stdbool.h>
 #endif
diff --git a/include/libnftables/table.h b/include/libnftables/table.h
index b91a457..ba05f5c 100644
--- a/include/libnftables/table.h
+++ b/include/libnftables/table.h
@@ -1,7 +1,11 @@
 #ifndef _TABLE_H_
 #define _TABLE_H_
 
-#include <stdint.h>
+#if defined(__cplusplus) && __cplusplus >= 201100L
+#	include <cstdint>
+#else
+#	include <stdint.h>
+#endif
 #ifndef __cplusplus
 #	include <stdbool.h>
 #endif
-- 
1.8.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] build: resolve automake 1.12 warning
  2013-10-28 12:27 ` [PATCH 1/4] build: resolve automake 1.12 warning Jan Engelhardt
@ 2013-11-05 12:55   ` Pablo Neira Ayuso
  0 siblings, 0 replies; 9+ messages in thread
From: Pablo Neira Ayuso @ 2013-11-05 12:55 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: netfilter-devel

On Mon, Oct 28, 2013 at 01:27:17PM +0100, Jan Engelhardt wrote:
> ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac'

Applied.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] build: resolve build errors in dependent programs
  2013-10-28 12:27 ` [PATCH 2/4] build: resolve build errors in dependent programs Jan Engelhardt
@ 2013-11-05 12:56   ` Pablo Neira Ayuso
  0 siblings, 0 replies; 9+ messages in thread
From: Pablo Neira Ayuso @ 2013-11-05 12:56 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: netfilter-devel

On Mon, Oct 28, 2013 at 01:27:18PM +0100, Jan Engelhardt wrote:
> The headers do not compile standalone, which also causes nftables to
> fail to build for the same reason.

I fail to reproduce this compilation nftables breakage. It's clear
that third party application will do, so I have mangled the changelog.

> 	$ gcc -x c -Wall -c *.h
> 	chain.h:62:35: error: unknown type name ‘size_t’
> 	expr.h:40:39: error: unknown type name ‘size_t’
> 	rule.h:60:34: error: unknown type name ‘size_t’
> 	ruleset.h:20:1: error: unknown type name ‘bool’
> 	ruleset.h:20:59: error: unknown type name ‘uint16_t’
> 	ruleset.h:21:52: error: unknown type name ‘uint16_t’
> 	ruleset.h:22:50: error: unknown type name ‘uint16_t’
> 	ruleset.h:23:63: error: unknown type name ‘uint16_t’
> 	ruleset.h:39:37: error: unknown type name ‘size_t’
> 	ruleset.h:39:80: error: unknown type name ‘uint32_t’
> 	ruleset.h:39:95: error: unknown type name ‘uint32_t’
> 	set.h:40:33: error: unknown type name ‘size_t’
> 	set.h:110:38: error: unknown type name ‘size_t’
> 	table.h:50:35: error: unknown type name ‘size_t’

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/4] build: avoid inclusion of stdbool.h in C++
  2013-10-28 12:27 ` [PATCH 3/4] build: avoid inclusion of stdbool.h in C++ Jan Engelhardt
@ 2013-11-05 12:57   ` Pablo Neira Ayuso
  2013-11-06 18:21     ` Jan Engelhardt
  0 siblings, 1 reply; 9+ messages in thread
From: Pablo Neira Ayuso @ 2013-11-05 12:57 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: netfilter-devel

On Mon, Oct 28, 2013 at 01:27:19PM +0100, Jan Engelhardt wrote:
> C++ does not need this header, as it already has bool builtin.

This works fine with g++ as is at this moment.

Do you plan to compile libnftables using a different compiler?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/4] build: avoid inclusion of stdbool.h in C++
  2013-11-05 12:57   ` Pablo Neira Ayuso
@ 2013-11-06 18:21     ` Jan Engelhardt
  0 siblings, 0 replies; 9+ messages in thread
From: Jan Engelhardt @ 2013-11-06 18:21 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel

On Tuesday 2013-11-05 13:57, Pablo Neira Ayuso wrote:

>On Mon, Oct 28, 2013 at 01:27:19PM +0100, Jan Engelhardt wrote:
>> C++ does not need this header, as it already has bool builtin.
>
>This works fine with g++ as is at this moment.
>Do you plan to compile libnftables using a different compiler?

No such plans. I am indifferent to them, but some facts I collected:

<stdbool.h>/<cstdbool> is explicitly documented to be a GCC extension 
(which clang copies).
A side effect of stdbool.h is that the (C++) keywords "bool", "false" 
and "true" are turned into macros.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-11-06 18:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-28 12:27 libnftables header includes fixups Jan Engelhardt
2013-10-28 12:27 ` [PATCH 1/4] build: resolve automake 1.12 warning Jan Engelhardt
2013-11-05 12:55   ` Pablo Neira Ayuso
2013-10-28 12:27 ` [PATCH 2/4] build: resolve build errors in dependent programs Jan Engelhardt
2013-11-05 12:56   ` Pablo Neira Ayuso
2013-10-28 12:27 ` [PATCH 3/4] build: avoid inclusion of stdbool.h in C++ Jan Engelhardt
2013-11-05 12:57   ` Pablo Neira Ayuso
2013-11-06 18:21     ` Jan Engelhardt
2013-10-28 12:27 ` [PATCH 4/4] build: use C++11 headers if available Jan Engelhardt

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).