libnftables: build fixes
The following changes since commit ec4b60bebcab23d46aa09bed06018457c35e5afa:
src: json: remove spaces (2013-10-17 10:03:37 +0200)
are available in the git repository at:
git://git.inai.de/libnftables master
for you to fetch changes up to 2952864a0bd3b074c322862fd4dbc792fb620818:
build: resolve build errors in dependent programs (2013-10-20 16:28:55 +0200)
----------------------------------------------------------------
Jan Engelhardt (2):
build: resolve automake 1.12 warning
build: resolve build errors in dependent programs
configure.ac | 1 + include/libnftables/chain.h | 10 ++++++++-- include/libnftables/expr.h | 10 ++++++++-- include/libnftables/rule.h | 10 ++++++++-- include/libnftables/ruleset.h | 8 ++++++++ include/libnftables/set.h | 10 ++++++++-- include/libnftables/table.h | 10 ++++++++-- 7 files changed, 49 insertions(+), 10 deletions(-)
PATCH 1/2 build: resolve automake 1.12 warning
ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac'
--- configure.ac | 1 + 1 file changed, 1 insertion(+)
configure.ac +1 -0
@@ -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])
Signature · 1 line
1.8.2
PATCH 2/2 build: resolve build errors in dependent programs
In reply to Jan EngelhardtThe headers do not compile standalone, which also causes nftables to fail to build for the same reason. In addition, <stdbool.h> is not needed for C++, and C++ should use contemporary headers if available, which is hereby done.
chain.h:44:71: warning: "struct nlmsghdr" declared inside parameter list [enabled by default] chain.h:60:35: error: unknown type name "size_t" expr.h:40:39: error: unknown type name "size_t" rule.h:43:64: warning: "struct nlmsghdr" declared inside parameter list [enabled by default] rule.h:59: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:39:37: error: unknown type name "size_t" set.h:38:33: error: unknown type name "size_t" table.h:32:71: warning: "struct nlmsghdr" declared inside parameter list [enabled by default] table.h:48:35: error: unknown type name "size_t"
--- include/libnftables/chain.h | 10 ++++++++-- include/libnftables/expr.h | 10 ++++++++-- include/libnftables/rule.h | 10 ++++++++-- include/libnftables/ruleset.h | 8 ++++++++ include/libnftables/set.h | 10 ++++++++-- include/libnftables/table.h | 10 ++++++++-- 6 files changed, 48 insertions(+), 10 deletions(-)
include/libnftables/chain.h +8 -2
@@ -1,14 +1,20 @@ #ifndef _CHAIN_H_ #define _CHAIN_H_ -#include <stdint.h> -#include <stdbool.h> +#if defined(__cplusplus) && __cplusplus >= 201100L +# include <cstdint> +#else +# include <stdbool.h> +# include <stdint.h> +#endif +#include <sys/types.h> #ifdef __cplusplus extern "C" { #endif struct nft_chain; +struct nlmsghdr; struct nft_chain *nft_chain_alloc(void); void nft_chain_free(struct nft_chain *);
include/libnftables/expr.h +8 -2
@@ -1,14 +1,20 @@ #ifndef _RULE_EXPR_H_ #define _RULE_EXPR_H_ -#include <stdint.h> -#include <stdbool.h> +#if defined(__cplusplus) && __cplusplus >= 201100L +# include <cstdint> +#else +# include <stdbool.h> +# include <stdint.h> +#endif +#include <sys/types.h> #ifdef __cplusplus extern "C" { #endif struct nft_rule_expr; +struct nlmsghdr; enum { NFT_RULE_EXPR_ATTR_NAME = 0,
include/libnftables/rule.h +8 -2
@@ -1,8 +1,13 @@ #ifndef _RULE_H_ #define _RULE_H_ -#include <stdint.h> -#include <stdbool.h> +#if defined(__cplusplus) && __cplusplus >= 201100L +# include <cstdint> +#else +# include <stdbool.h> +# include <stdint.h> +#endif +#include <sys/types.h> #ifdef __cplusplus extern "C" {
@@ -10,6 +15,7 @@ extern "C" {struct nft_rule ;struct nft_rule_expr ; +struct nlmsghdr ;struct nft_rule *nft_rule_alloc (void );void nft_rule_free (struct nft_rule *);
include/libnftables/ruleset.h +8 -0
@@ -1,6 +1,14 @@ #ifndef _RULESET_H_ #define _RULESET_H_ +#if defined(__cplusplus) && __cplusplus >= 201100L +# include <cstdint> +#else +# include <stdbool.h> +# include <stdint.h> +#endif +#include <sys/types.h> + #ifdef __cplusplus extern "C" { #endif
include/libnftables/set.h +8 -2
@@ -1,8 +1,13 @@#ifndef _NFT_SET_H_#define _NFT_SET_H_ -#include <stdint.h> -#include <stdbool.h> +#if defined(__cplusplus) && __cplusplus >=201100L +# include <cstdint> +#else +# include <stdbool.h> +# include <stdint.h> +#endif +#include <sys/types.h> enum { NFT_SET_ATTR_TABLE,
@@ -16,6 +21,7 @@ enum { };struct nft_set ; +struct nlmsghdr ;struct nft_set *nft_set_alloc (void );void nft_set_free (struct nft_set *s);
include/libnftables/table.h +8 -2
@@ -1,14 +1,20 @@ #ifndef _TABLE_H_ #define _TABLE_H_ -#include <stdint.h> -#include <stdbool.h> +#if defined(__cplusplus) && __cplusplus >= 201100L +# include <cstdint> +#else +# include <stdbool.h> +# include <stdint.h> +#endif +#include <sys/types.h> #ifdef __cplusplus extern "C" { #endif struct nft_table; +struct nlmsghdr; struct nft_table *nft_table_alloc(void); void nft_table_free(struct nft_table *);
Signature · 1 line
1.8.2
Pablo Neira Ayuso
maintainerRe: [PATCH 2/2] build: resolve build errors in dependent programs
Quoted 5 lines · Jan Engelhardt
The headers do not compile standalone, which also causes nftables to fail to build for the same reason. In addition, <
stdbool.h> is not needed for C++, and C++ should use contemporary headers if available, which is hereby done.
Quoted 14 lines
chain.h:44:71: warning: "struct nlmsghdr" declared inside parameter list [enabled by default] chain.h:60:35: error: unknown type name "
size_t" expr.h:40:39: error: unknown type name "size_t" rule.h:43:64: warning: "struct nlmsghdr" declared inside parameter list [enabled by default] rule.h:59: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:39:37: error: unknown type name "size_t" set.h:38:33: error: unknown type name "size_t" table.h:32:71: warning: "struct nlmsghdr" declared inside parameter list [enabled by default] table.h:48:35: error: unknown type name "size_t"
This is fixing two different issues in one single patch.
I have applied a patch to add struct nlmsghdr without definition.
Regarding the c++ changes, we already discussed this in libmnl's patch:
5b8a0c7 include: don't force compiler to enter C++11 mode
this change doesn't seem to be required by g++ at all.
Re: [PATCH 2/2] build: resolve build errors in dependent programs
Quoted 8 lines · Pablo Neira Ayuso
Quoted 4 lines · Jan Engelhardt
chain.h:44:71: warning: "struct nlmsghdr" declared inside parameter list [enabled by default] chain.h:60:35: error: unknown type name "
size_t"This is fixing two different issues in one single patch. I have applied a patch to add struct nlmsghdr without definition.
Well, there's still size_t left.
Quoted 6 lines
Regarding the c++ changes, we already discussed this in libmnl's patch:
5b8a0c7 include: don't force compiler to enter C++11 mode
this change doesn't seem to be required by g++ at all.
Not required by g++, but wanted by the standard. Also note that in my current submission, I expressly specified
#if ... __cplusplus >= 2011UL.
which is how to tackle this. The remaining patches will be posted by git-s-e shortly.