Use extern C guards in all headers
The project uses a mix of C and C++ requiring
extern "C" guards from C++ code both within the
project & from C++ apps that use libcper. That
won't be required with this change.
Change-Id: I835dd05166732ca213c72eae2904815a8769599b
Signed-off-by: Karthik Rajagopalan <krajagopalan@nvidia.com>
diff --git a/sections/cper-section-arm.h b/sections/cper-section-arm.h
index e865434..fdefeae 100644
--- a/sections/cper-section-arm.h
+++ b/sections/cper-section-arm.h
@@ -1,6 +1,10 @@
#ifndef CPER_SECTION_ARM_H
#define CPER_SECTION_ARM_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <json.h>
#include "../edk/Cper.h"
@@ -459,4 +463,8 @@
json_object *cper_section_arm_to_ir(void *section);
void ir_section_arm_to_cper(json_object *section, FILE *out);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/sections/cper-section-ccix-per.h b/sections/cper-section-ccix-per.h
index 86e277c..69dbea2 100644
--- a/sections/cper-section-ccix-per.h
+++ b/sections/cper-section-ccix-per.h
@@ -1,6 +1,10 @@
#ifndef CPER_SECTION_CCIX_PER_H
#define CPER_SECTION_CCIX_PER_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <json.h>
#include "../edk/Cper.h"
@@ -24,4 +28,8 @@
json_object *cper_section_ccix_per_to_ir(void *section);
void ir_section_ccix_per_to_cper(json_object *section, FILE *out);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/sections/cper-section-cxl-component.h b/sections/cper-section-cxl-component.h
index 69b9066..f3b8ad1 100644
--- a/sections/cper-section-cxl-component.h
+++ b/sections/cper-section-cxl-component.h
@@ -1,6 +1,10 @@
#ifndef CPER_SECTION_CXL_COMPONENT_H
#define CPER_SECTION_CXL_COMPONENT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <json.h>
#include "../edk/Cper.h"
@@ -36,4 +40,8 @@
json_object *cper_section_cxl_component_to_ir(void *section);
void ir_section_cxl_component_to_cper(json_object *section, FILE *out);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/sections/cper-section-cxl-protocol.h b/sections/cper-section-cxl-protocol.h
index 9339f57..e4854a3 100644
--- a/sections/cper-section-cxl-protocol.h
+++ b/sections/cper-section-cxl-protocol.h
@@ -1,6 +1,10 @@
#ifndef CPER_SECTION_CXL_PROTOCOL_H
#define CPER_SECTION_CXL_PROTOCOL_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <json.h>
#include "../edk/Cper.h"
@@ -67,4 +71,8 @@
json_object *cper_section_cxl_protocol_to_ir(void *section);
void ir_section_cxl_protocol_to_cper(json_object *section, FILE *out);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/sections/cper-section-dmar-generic.h b/sections/cper-section-dmar-generic.h
index 035b25d..8e96ecf 100644
--- a/sections/cper-section-dmar-generic.h
+++ b/sections/cper-section-dmar-generic.h
@@ -1,6 +1,10 @@
#ifndef CPER_SECTION_DMAR_GENERIC_H
#define CPER_SECTION_DMAR_GENERIC_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <json.h>
#include "../edk/Cper.h"
@@ -68,4 +72,8 @@
json_object *cper_section_dmar_generic_to_ir(void *section);
void ir_section_dmar_generic_to_cper(json_object *section, FILE *out);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/sections/cper-section-dmar-iommu.h b/sections/cper-section-dmar-iommu.h
index d15a9d1..2f990ab 100644
--- a/sections/cper-section-dmar-iommu.h
+++ b/sections/cper-section-dmar-iommu.h
@@ -1,10 +1,18 @@
#ifndef CPER_SECTION_DMAR_IOMMU_H
#define CPER_SECTION_DMAR_IOMMU_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <json.h>
#include "../edk/Cper.h"
json_object *cper_section_dmar_iommu_to_ir(void *section);
void ir_section_dmar_iommu_to_cper(json_object *section, FILE *out);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/sections/cper-section-dmar-vtd.h b/sections/cper-section-dmar-vtd.h
index f78b2d1..3c3a134 100644
--- a/sections/cper-section-dmar-vtd.h
+++ b/sections/cper-section-dmar-vtd.h
@@ -1,6 +1,10 @@
#ifndef CPER_SECTION_DMAR_VTD_H
#define CPER_SECTION_DMAR_VTD_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <json.h>
#include "../edk/Cper.h"
@@ -33,4 +37,8 @@
json_object *cper_section_dmar_vtd_to_ir(void *section);
void ir_section_dmar_vtd_to_cper(json_object *section, FILE *out);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/sections/cper-section-firmware.h b/sections/cper-section-firmware.h
index eab0e99..858ee5d 100644
--- a/sections/cper-section-firmware.h
+++ b/sections/cper-section-firmware.h
@@ -1,6 +1,10 @@
#ifndef CPER_SECTION_FIRMWARE_H
#define CPER_SECTION_FIRMWARE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <json.h>
#include "../edk/Cper.h"
@@ -20,4 +24,8 @@
json_object *cper_section_firmware_to_ir(void *section);
void ir_section_firmware_to_cper(json_object *section, FILE *out);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/sections/cper-section-generic.h b/sections/cper-section-generic.h
index 765794e..7148cfd 100644
--- a/sections/cper-section-generic.h
+++ b/sections/cper-section-generic.h
@@ -1,6 +1,10 @@
#ifndef CPER_SECTION_GENERIC_H
#define CPER_SECTION_GENERIC_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <json.h>
#include "../edk/Cper.h"
@@ -65,4 +69,8 @@
json_object *cper_section_generic_to_ir(void *section);
void ir_section_generic_to_cper(json_object *section, FILE *out);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/sections/cper-section-ia32x64.h b/sections/cper-section-ia32x64.h
index c020ff4..4670d48 100644
--- a/sections/cper-section-ia32x64.h
+++ b/sections/cper-section-ia32x64.h
@@ -1,6 +1,10 @@
#ifndef CPER_SECTION_IA32X64_H
#define CPER_SECTION_IA32X64_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <json.h>
#include "../edk/Cper.h"
@@ -108,4 +112,8 @@
json_object *cper_section_ia32x64_to_ir(void *section);
void ir_section_ia32x64_to_cper(json_object *section, FILE *out);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/sections/cper-section-ipf.h b/sections/cper-section-ipf.h
index cf346ef..9e265db 100644
--- a/sections/cper-section-ipf.h
+++ b/sections/cper-section-ipf.h
@@ -1,6 +1,10 @@
#ifndef CPER_SECTION_IPF_H
#define CPER_SECTION_IPF_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <json.h>
#include "../edk/Cper.h"
@@ -69,4 +73,8 @@
json_object *cper_section_ipf_to_ir(void *section);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/sections/cper-section-memory.h b/sections/cper-section-memory.h
index 5134f6e..4d293d8 100644
--- a/sections/cper-section-memory.h
+++ b/sections/cper-section-memory.h
@@ -1,6 +1,10 @@
#ifndef CPER_SECTION_MEMORY_H
#define CPER_SECTION_MEMORY_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <json.h>
#include "../edk/Cper.h"
@@ -54,4 +58,8 @@
void ir_section_memory_to_cper(json_object *section, FILE *out);
void ir_section_memory2_to_cper(json_object *section, FILE *out);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/sections/cper-section-nvidia.h b/sections/cper-section-nvidia.h
index 973c3af..b05fdde 100644
--- a/sections/cper-section-nvidia.h
+++ b/sections/cper-section-nvidia.h
@@ -1,10 +1,18 @@
#ifndef CPER_SECTION_NVIDIA_H
#define CPER_SECTION_NVIDIA_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <json.h>
#include "../edk/Cper.h"
json_object *cper_section_nvidia_to_ir(void *section);
void ir_section_nvidia_to_cper(json_object *section, FILE *out);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/sections/cper-section-pci-bus.h b/sections/cper-section-pci-bus.h
index 6a959e4..93f61be 100644
--- a/sections/cper-section-pci-bus.h
+++ b/sections/cper-section-pci-bus.h
@@ -1,6 +1,10 @@
#ifndef CPER_SECTION_PCI_BUS_H
#define CPER_SECTION_PCI_BUS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <json.h>
#include "../edk/Cper.h"
@@ -30,4 +34,8 @@
json_object *cper_section_pci_bus_to_ir(void *section);
void ir_section_pci_bus_to_cper(json_object *section, FILE *out);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/sections/cper-section-pci-dev.h b/sections/cper-section-pci-dev.h
index 5326a8c..9d161c9 100644
--- a/sections/cper-section-pci-dev.h
+++ b/sections/cper-section-pci-dev.h
@@ -1,6 +1,10 @@
#ifndef CPER_SECTION_PCI_DEV_H
#define CPER_SECTION_PCI_DEV_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <json.h>
#include "../edk/Cper.h"
@@ -36,4 +40,8 @@
json_object *cper_section_pci_dev_to_ir(void *section);
void ir_section_pci_dev_to_cper(json_object *section, FILE *out);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/sections/cper-section-pcie.h b/sections/cper-section-pcie.h
index b0042c5..b2581e5 100644
--- a/sections/cper-section-pcie.h
+++ b/sections/cper-section-pcie.h
@@ -1,6 +1,10 @@
#ifndef CPER_SECTION_PCIE_H
#define CPER_SECTION_PCIE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <json.h>
#include "../edk/Cper.h"
@@ -32,4 +36,8 @@
json_object *cper_section_pcie_to_ir(void *section);
void ir_section_pcie_to_cper(json_object *section, FILE *out);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/sections/cper-section.h b/sections/cper-section.h
index 4ec8650..71cf4b1 100644
--- a/sections/cper-section.h
+++ b/sections/cper-section.h
@@ -1,6 +1,10 @@
#ifndef CPER_SECTION_H
#define CPER_SECTION_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <json.h>
#include <stdio.h>
#include <stdlib.h>
@@ -17,4 +21,8 @@
extern CPER_SECTION_DEFINITION section_definitions[];
extern const size_t section_definitions_len;
+#ifdef __cplusplus
+}
+#endif
+
#endif