summaryrefslogtreecommitdiff
path: root/lib/security
diff options
context:
space:
mode:
authorMattias Rönnblom <[email protected]>2024-09-20 12:47:49 +0200
committerDavid Marchand <[email protected]>2024-10-09 18:03:30 +0200
commit719834a6849e1daf4a70ff7742bbcc3ae7e25607 (patch)
tree4f53e6551676cba64e4cac5c4a92e31f34520279 /lib/security
parent917b7c78cee5ea96862fa6351a646bf305a99b6d (diff)
use C linkage where appropriate in headers
Assure that 'extern "C" { /../ }' do not cover files included from a particular header file, and address minor issues resulting from this change of order. Dealing with C++ should delegate to the individual include file level, rather than being imposed by the user of that file. For example, forcing C linkage prevents __Generic macros being replaced with overloaded static inline functions in C++ translation units. Eliminate 'extern "C"' from files which do not declare any symbols (e.g., only macros or struct types). On the other hand, the headers check is too naive in assuming that all headers must contain a 'extern "C"'. Such a check was added in commit 1ee492bdc4ff ("buildtools/chkincs: check missing C++ guards"). Since this current change results in many headers not containing such a token, remove the check for 'extern "C"' until we have a better implementation. Signed-off-by: Mattias Rönnblom <[email protected]> Acked-by: Morten Brørup <[email protected]> Signed-off-by: David Marchand <[email protected]>
Diffstat (limited to 'lib/security')
-rw-r--r--lib/security/rte_security.h8
-rw-r--r--lib/security/rte_security_driver.h6
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/security/rte_security.h b/lib/security/rte_security.h
index 1c8474b74f..7a9bafa0fa 100644
--- a/lib/security/rte_security.h
+++ b/lib/security/rte_security.h
@@ -12,10 +12,6 @@
* RTE Security Common Definitions
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <sys/types.h>
#include <rte_compat.h>
@@ -24,6 +20,10 @@ extern "C" {
#include <rte_ip.h>
#include <rte_mbuf_dyn.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/** IPSec protocol mode */
enum rte_security_ipsec_sa_mode {
RTE_SECURITY_IPSEC_SA_MODE_TRANSPORT = 1,
diff --git a/lib/security/rte_security_driver.h b/lib/security/rte_security_driver.h
index 9bb5052a4c..2ceb145066 100644
--- a/lib/security/rte_security_driver.h
+++ b/lib/security/rte_security_driver.h
@@ -12,13 +12,13 @@
* RTE Security Common Definitions
*/
+#include <rte_compat.h>
+#include "rte_security.h"
+
#ifdef __cplusplus
extern "C" {
#endif
-#include <rte_compat.h>
-#include "rte_security.h"
-
/**
* @internal
* Security session to be used by library for internal usage