diff mbox series

lib: remove C++ include guard from private headers

Message ID 20210915164636.3015197-1-thomas@monjalon.net (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
Series lib: remove C++ include guard from private headers | expand

Checks

Context Check Description
ci/iol-x86_64-compile-testing warning Testing issues
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Testing fail Testing issues
ci/Intel-compilation success Compilation OK
ci/github-robot: build success github build: passed
ci/checkpatch success coding style OK

Commit Message

Thomas Monjalon Sept. 15, 2021, 4:46 p.m. UTC
The private headers are compiled internally with a C compiler.
Thus extern "C" declaration is useless in such files.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 lib/acl/acl_vect.h                    | 8 --------
 lib/acl/tb_mem.h                      | 8 --------
 lib/bpf/bpf_def.h                     | 8 --------
 lib/bpf/bpf_impl.h                    | 8 --------
 lib/cryptodev/cryptodev_pmd.h         | 8 --------
 lib/distributor/distributor_private.h | 8 --------
 lib/eal/common/malloc_heap.h          | 8 --------
 lib/ethdev/ethdev_driver.h            | 8 --------
 lib/ethdev/ethdev_private.h           | 8 --------
 lib/eventdev/eventdev_pmd.h           | 8 --------
 lib/eventdev/eventdev_pmd_pci.h       | 9 ---------
 lib/eventdev/eventdev_pmd_vdev.h      | 8 --------
 lib/fib/dir24_8.h                     | 8 --------
 lib/fib/trie.h                        | 9 ---------
 lib/node/ethdev_rx_priv.h             | 8 --------
 lib/node/ethdev_tx_priv.h             | 8 --------
 lib/node/ip4_rewrite_priv.h           | 8 --------
 lib/node/pkt_cls_priv.h               | 8 --------
 lib/power/guest_channel.h             | 9 ---------
 lib/power/power_acpi_cpufreq.h        | 8 --------
 lib/power/power_cppc_cpufreq.h        | 8 --------
 lib/power/power_kvm_vm.h              | 7 -------
 lib/power/power_pstate_cpufreq.h      | 7 -------
 lib/rcu/rcu_qsbr_pvt.h                | 8 --------
 lib/stack/stack_pvt.h                 | 9 ---------
 25 files changed, 202 deletions(-)

Comments

Stephen Hemminger Sept. 15, 2021, 6:08 p.m. UTC | #1
On Wed, 15 Sep 2021 18:46:35 +0200
Thomas Monjalon <thomas@monjalon.net> wrote:

> The private headers are compiled internally with a C compiler.
> Thus extern "C" declaration is useless in such files.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---

Makes sense, make sure it doesn't break Windows builds.
There is not a C++ application regression test in CI.
Thomas Monjalon Sept. 23, 2021, 6:37 a.m. UTC | #2
15/09/2021 18:46, Thomas Monjalon:
> The private headers are compiled internally with a C compiler.
> Thus extern "C" declaration is useless in such files.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>

Applied
diff mbox series

Patch

diff --git a/lib/acl/acl_vect.h b/lib/acl/acl_vect.h
index 951e5828a9..e4b4666090 100644
--- a/lib/acl/acl_vect.h
+++ b/lib/acl/acl_vect.h
@@ -11,10 +11,6 @@ 
  * RTE ACL SSE/AVX related header.
  */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 
 /*
  * Takes 2 SIMD registers containing N transitions each (tr0, tr1).
@@ -80,8 +76,4 @@  extern "C" {
 } while (0)
 
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* _RTE_ACL_VECT_H_ */
diff --git a/lib/acl/tb_mem.h b/lib/acl/tb_mem.h
index 50a803c738..2093744a6d 100644
--- a/lib/acl/tb_mem.h
+++ b/lib/acl/tb_mem.h
@@ -14,10 +14,6 @@ 
  * destructed (finish of build phase).
  */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <rte_acl_osdep.h>
 #include <setjmp.h>
 
@@ -40,8 +36,4 @@  struct tb_mem_pool {
 void *tb_alloc(struct tb_mem_pool *pool, size_t size);
 void tb_free_pool(struct tb_mem_pool *pool);
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* _TB_MEM_H_ */
diff --git a/lib/bpf/bpf_def.h b/lib/bpf/bpf_def.h
index d39992997a..fa9125307e 100644
--- a/lib/bpf/bpf_def.h
+++ b/lib/bpf/bpf_def.h
@@ -22,10 +22,6 @@ 
 #include <stdint.h>
 
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /*
  * The instruction encodings.
  */
@@ -144,8 +140,4 @@  struct ebpf_insn {
  */
 #define	EBPF_FUNC_MAX_ARGS	(EBPF_REG_6 - EBPF_REG_1)
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* RTE_BPF_DEF_H_ */
diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h
index 03ba0ae112..26d165ad5c 100644
--- a/lib/bpf/bpf_impl.h
+++ b/lib/bpf/bpf_impl.h
@@ -8,10 +8,6 @@ 
 #include <rte_bpf.h>
 #include <sys/mman.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #define MAX_BPF_STACK_SIZE	0x200
 
 struct rte_bpf {
@@ -47,8 +43,4 @@  bpf_size(uint32_t bpf_op_sz)
 	return 0;
 }
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* _BPF_H_ */
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index ec7bb82be8..ae3aac59ae 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -13,10 +13,6 @@ 
  * them directly.
  */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <string.h>
 
 #include <rte_config.h>
@@ -561,8 +557,4 @@  set_asym_session_private_data(struct rte_cryptodev_asym_session *sess,
 	sess->sess_private_data[driver_id] = private_data;
 }
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* _CRYPTODEV_PMD_H_ */
diff --git a/lib/distributor/distributor_private.h b/lib/distributor/distributor_private.h
index 689fe3e183..7101f63234 100644
--- a/lib/distributor/distributor_private.h
+++ b/lib/distributor/distributor_private.h
@@ -13,10 +13,6 @@ 
  * one-at-a-time to workers, with dynamic load balancing.
  */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #define NO_FLAGS 0
 #define RTE_DISTRIB_PREFIX "DT_"
 
@@ -170,8 +166,4 @@  find_match_vec(struct rte_distributor *d,
 			uint16_t *data_ptr,
 			uint16_t *output_ptr);
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* _DIST_PRIV_H_ */
diff --git a/lib/eal/common/malloc_heap.h b/lib/eal/common/malloc_heap.h
index 772736b53f..3a6ec6ecf0 100644
--- a/lib/eal/common/malloc_heap.h
+++ b/lib/eal/common/malloc_heap.h
@@ -33,10 +33,6 @@  struct malloc_heap {
 	char name[RTE_HEAP_NAME_MAX_LEN];
 } __rte_cache_aligned;
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 static inline unsigned
 malloc_get_numa_socket(void)
 {
@@ -100,8 +96,4 @@  malloc_socket_to_heap_id(unsigned int socket_id);
 int
 rte_eal_malloc_heap_init(void);
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* MALLOC_HEAP_H_ */
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index 40e474aa7e..cc2c75261c 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -17,10 +17,6 @@ 
 
 #include <rte_ethdev.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /**< @internal Declaration of the hairpin peer queue information structure. */
 struct rte_hairpin_peer_info;
 
@@ -1513,8 +1509,4 @@  struct rte_eth_tunnel_filter_conf {
 	uint16_t queue_id;      /**< Queue assigned to if match. */
 };
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* _RTE_ETHDEV_DRIVER_H_ */
diff --git a/lib/ethdev/ethdev_private.h b/lib/ethdev/ethdev_private.h
index 9bb0879538..3724429577 100644
--- a/lib/ethdev/ethdev_private.h
+++ b/lib/ethdev/ethdev_private.h
@@ -9,10 +9,6 @@ 
 
 #include "rte_ethdev.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /*
  * Convert rte_eth_dev pointer to port id.
  * NULL will be translated to RTE_MAX_ETHPORTS.
@@ -30,8 +26,4 @@  eth_find_device(const struct rte_eth_dev *_start, rte_eth_cmp_t cmp,
 /* Parse devargs value for representor parameter. */
 int rte_eth_devargs_parse_representor_ports(char *str, void *data);
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* _ETH_PRIVATE_H_ */
diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index 0f724ac85d..94d99f4903 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -13,10 +13,6 @@ 
  * them directly.
  */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <string.h>
 
 #include <rte_common.h>
@@ -1192,8 +1188,4 @@  rte_event_pmd_allocate(const char *name, int socket_id);
 int
 rte_event_pmd_release(struct rte_eventdev *eventdev);
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* _RTE_EVENTDEV_PMD_H_ */
diff --git a/lib/eventdev/eventdev_pmd_pci.h b/lib/eventdev/eventdev_pmd_pci.h
index d14ea634b8..1545b240f2 100644
--- a/lib/eventdev/eventdev_pmd_pci.h
+++ b/lib/eventdev/eventdev_pmd_pci.h
@@ -13,11 +13,6 @@ 
  * them directly.
  */
 
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <string.h>
 
 #include <rte_config.h>
@@ -151,8 +146,4 @@  rte_event_pmd_pci_remove(struct rte_pci_device *pci_dev,
 	return 0;
 }
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* _RTE_EVENTDEV_PMD_PCI_H_ */
diff --git a/lib/eventdev/eventdev_pmd_vdev.h b/lib/eventdev/eventdev_pmd_vdev.h
index bc0cf44c8c..2d33924e6c 100644
--- a/lib/eventdev/eventdev_pmd_vdev.h
+++ b/lib/eventdev/eventdev_pmd_vdev.h
@@ -13,10 +13,6 @@ 
  * them directly.
  */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <string.h>
 
 #include <rte_config.h>
@@ -101,8 +97,4 @@  rte_event_pmd_vdev_uninit(const char *name)
 	return 0;
 }
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* _RTE_EVENTDEV_PMD_VDEV_H_ */
diff --git a/lib/fib/dir24_8.h b/lib/fib/dir24_8.h
index bac65eeda9..b0d1a40ee9 100644
--- a/lib/fib/dir24_8.h
+++ b/lib/fib/dir24_8.h
@@ -14,10 +14,6 @@ 
  * DIR24_8 algorithm
  */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #define DIR24_8_TBL24_NUM_ENT		(1 << 24)
 #define DIR24_8_TBL8_GRP_NUM_ENT	256U
 #define DIR24_8_EXT_ENT			1
@@ -252,8 +248,4 @@  int
 dir24_8_modify(struct rte_fib *fib, uint32_t ip, uint8_t depth,
 	uint64_t next_hop, int op);
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* _DIR24_8_H_ */
diff --git a/lib/fib/trie.h b/lib/fib/trie.h
index a4f429ce54..9fd15ae79f 100644
--- a/lib/fib/trie.h
+++ b/lib/fib/trie.h
@@ -13,10 +13,6 @@ 
 #include <rte_prefetch.h>
 #include <rte_branch_prediction.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /* @internal Total number of tbl24 entries. */
 #define TRIE_TBL24_NUM_ENT	(1 << 24)
 /* Maximum depth value possible for IPv6 LPM. */
@@ -145,9 +141,4 @@  int
 trie_modify(struct rte_fib6 *fib, const uint8_t ip[RTE_FIB6_IPV6_ADDR_SIZE],
 	uint8_t depth, uint64_t next_hop, int op);
 
-
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* _TRIE_H_ */
diff --git a/lib/node/ethdev_rx_priv.h b/lib/node/ethdev_rx_priv.h
index efcd66dd48..21dcba51fc 100644
--- a/lib/node/ethdev_rx_priv.h
+++ b/lib/node/ethdev_rx_priv.h
@@ -4,10 +4,6 @@ 
 #ifndef __INCLUDE_ETHDEV_RX_PRIV_H__
 #define __INCLUDE_ETHDEV_RX_PRIV_H__
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <rte_common.h>
 
 struct ethdev_rx_node_elem;
@@ -76,8 +72,4 @@  struct ethdev_rx_node_main *ethdev_rx_get_node_data_get(void);
  */
 struct rte_node_register *ethdev_rx_node_get(void);
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* __INCLUDE_ETHDEV_RX_PRIV_H__ */
diff --git a/lib/node/ethdev_tx_priv.h b/lib/node/ethdev_tx_priv.h
index 586bff44a7..e3a6fdb8af 100644
--- a/lib/node/ethdev_tx_priv.h
+++ b/lib/node/ethdev_tx_priv.h
@@ -4,10 +4,6 @@ 
 #ifndef __INCLUDE_ETHDEV_TX_PRIV_H__
 #define __INCLUDE_ETHDEV_TX_PRIV_H__
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 struct ethdev_tx_node_ctx;
 typedef struct ethdev_tx_node_ctx ethdev_tx_node_ctx_t;
 
@@ -55,8 +51,4 @@  struct ethdev_tx_node_main *ethdev_tx_node_data_get(void);
  */
 struct rte_node_register *ethdev_tx_node_get(void);
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* __INCLUDE_ETHDEV_TX_PRIV_H__ */
diff --git a/lib/node/ip4_rewrite_priv.h b/lib/node/ip4_rewrite_priv.h
index 80f0abdc94..a1fb8668c5 100644
--- a/lib/node/ip4_rewrite_priv.h
+++ b/lib/node/ip4_rewrite_priv.h
@@ -4,10 +4,6 @@ 
 #ifndef __INCLUDE_IP4_REWRITE_PRIV_H__
 #define __INCLUDE_IP4_REWRITE_PRIV_H__
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <rte_common.h>
 
 #define RTE_GRAPH_IP4_REWRITE_MAX_NH 64
@@ -70,8 +66,4 @@  struct rte_node_register *ip4_rewrite_node_get(void);
  */
 int ip4_rewrite_set_next(uint16_t port_id, uint16_t next_index);
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* __INCLUDE_IP4_REWRITE_PRIV_H__ */
diff --git a/lib/node/pkt_cls_priv.h b/lib/node/pkt_cls_priv.h
index 3f2bb04e1e..6f5374f0be 100644
--- a/lib/node/pkt_cls_priv.h
+++ b/lib/node/pkt_cls_priv.h
@@ -4,10 +4,6 @@ 
 #ifndef __INCLUDE_PKT_CLS_PRIV_H__
 #define __INCLUDE_PKT_CLS_PRIV_H__
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <rte_common.h>
 
 struct pkt_cls_node_ctx {
@@ -20,8 +16,4 @@  enum pkt_cls_next_nodes {
 	PKT_CLS_NEXT_MAX,
 };
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* __INCLUDE_PKT_CLS_PRIV_H__ */
diff --git a/lib/power/guest_channel.h b/lib/power/guest_channel.h
index 43d532a5aa..bdda1367f0 100644
--- a/lib/power/guest_channel.h
+++ b/lib/power/guest_channel.h
@@ -4,10 +4,6 @@ 
 #ifndef _GUEST_CHANNEL_H
 #define _GUEST_CHANNEL_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /**
  * Check if any Virtio-Serial VM end-points exist in path.
  *
@@ -86,9 +82,4 @@  int power_guest_channel_read_msg(void *pkt,
 		size_t pkt_len,
 		unsigned int lcore_id);
 
-
-#ifdef __cplusplus
-}
-#endif
-
 #endif
diff --git a/lib/power/power_acpi_cpufreq.h b/lib/power/power_acpi_cpufreq.h
index 038857b3a6..41675b9cd9 100644
--- a/lib/power/power_acpi_cpufreq.h
+++ b/lib/power/power_acpi_cpufreq.h
@@ -16,10 +16,6 @@ 
 #include <rte_string_fns.h>
 #include "rte_power.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /**
  * Check if ACPI power management is supported.
  *
@@ -222,8 +218,4 @@  int power_acpi_disable_turbo(unsigned int lcore_id);
 int power_acpi_get_capabilities(unsigned int lcore_id,
 		struct rte_power_core_capabilities *caps);
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif
diff --git a/lib/power/power_cppc_cpufreq.h b/lib/power/power_cppc_cpufreq.h
index 57c0ee880c..4e73c91b05 100644
--- a/lib/power/power_cppc_cpufreq.h
+++ b/lib/power/power_cppc_cpufreq.h
@@ -17,10 +17,6 @@ 
 #include <rte_string_fns.h>
 #include "rte_power.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /**
  * Check if CPPC power management is supported.
  *
@@ -223,8 +219,4 @@  int power_cppc_disable_turbo(unsigned int lcore_id);
 int power_cppc_get_capabilities(unsigned int lcore_id,
 		struct rte_power_core_capabilities *caps);
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* _POWER_CPPC_CPUFREQ_H */
diff --git a/lib/power/power_kvm_vm.h b/lib/power/power_kvm_vm.h
index 73b4c82e57..9a309a300f 100644
--- a/lib/power/power_kvm_vm.h
+++ b/lib/power/power_kvm_vm.h
@@ -16,10 +16,6 @@ 
 #include <rte_string_fns.h>
 #include "rte_power.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /**
  * Check if KVM power management is supported.
  *
@@ -204,7 +200,4 @@  int power_kvm_vm_disable_turbo(unsigned int lcore_id);
 int power_kvm_vm_get_capabilities(unsigned int lcore_id,
 		struct rte_power_core_capabilities *caps);
 
-#ifdef __cplusplus
-}
-#endif
 #endif
diff --git a/lib/power/power_pstate_cpufreq.h b/lib/power/power_pstate_cpufreq.h
index 0be0bd6b81..3260b32494 100644
--- a/lib/power/power_pstate_cpufreq.h
+++ b/lib/power/power_pstate_cpufreq.h
@@ -16,10 +16,6 @@ 
 #include <rte_string_fns.h>
 #include "rte_power.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /**
  * Check if pstate power management is supported.
  *
@@ -221,8 +217,5 @@  int power_pstate_disable_turbo(unsigned int lcore_id);
  */
 int power_pstate_get_capabilities(unsigned int lcore_id,
 		struct rte_power_core_capabilities *caps);
-#ifdef __cplusplus
-}
-#endif
 
 #endif
diff --git a/lib/rcu/rcu_qsbr_pvt.h b/lib/rcu/rcu_qsbr_pvt.h
index 196b9abd65..5fd7ca2f05 100644
--- a/lib/rcu/rcu_qsbr_pvt.h
+++ b/lib/rcu/rcu_qsbr_pvt.h
@@ -10,10 +10,6 @@ 
  * by the user of this library.
  */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <rte_ring.h>
 #include <rte_ring_elem.h>
 
@@ -59,8 +55,4 @@  typedef struct {
 	uint8_t elem[0]; /**< Pointer to user element */
 } __attribute__((__may_alias__)) __rte_rcu_qsbr_dq_elem_t;
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* _RTE_RCU_QSBR_PVT_H_ */
diff --git a/lib/stack/stack_pvt.h b/lib/stack/stack_pvt.h
index ecf40819c5..c7eab4027d 100644
--- a/lib/stack/stack_pvt.h
+++ b/lib/stack/stack_pvt.h
@@ -5,10 +5,6 @@ 
 #ifndef _STACK_PVT_H_
 #define _STACK_PVT_H_
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <rte_log.h>
 
 extern int stack_logtype;
@@ -26,9 +22,4 @@  extern int stack_logtype;
 #define STACK_LOG_INFO(fmt, args...) \
 	STACK_LOG(INFO, fmt, ## args)
 
-
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* _STACK_PVT_H_ */