diff mbox

[3/4] build: avoid inclusion of stdbool.h in C++

Message ID 1382963240-18760-4-git-send-email-jengelh@inai.de
State Not Applicable
Headers show

Commit Message

Jan Engelhardt Oct. 28, 2013, 12:27 p.m. UTC
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(-)

Comments

Pablo Neira Ayuso Nov. 5, 2013, 12:57 p.m. UTC | #1
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?
--
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
Jan Engelhardt Nov. 6, 2013, 6:21 p.m. UTC | #2
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.
--
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
diff mbox

Patch

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