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/generator/cper-generate.h b/generator/cper-generate.h
index edbac36..042431f 100644
--- a/generator/cper-generate.h
+++ b/generator/cper-generate.h
@@ -1,10 +1,18 @@
#ifndef CPER_GENERATE_H
#define CPER_GENERATE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <stdio.h>
#include "../edk/BaseTypes.h"
void generate_cper_record(char **types, UINT16 num_sections, FILE *out);
void generate_single_section_record(char *type, FILE *out);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/generator/gen-utils.h b/generator/gen-utils.h
index 0ed28c2..1228253 100644
--- a/generator/gen-utils.h
+++ b/generator/gen-utils.h
@@ -1,5 +1,9 @@
-#ifndef GEN_UTILS_H
-#define GEN_UTILS_H
+#ifndef CPER_GEN_UTILS_H
+#define CPER_GEN_UTILS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
#include <stdlib.h>
#include "../edk/BaseTypes.h"
@@ -18,4 +22,8 @@
void create_valid_error_section(UINT8 *start);
UINT8 int_to_bcd(int value);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/generator/sections/gen-section.h b/generator/sections/gen-section.h
index be00b5f..d1987b9 100644
--- a/generator/sections/gen-section.h
+++ b/generator/sections/gen-section.h
@@ -1,6 +1,10 @@
#ifndef GEN_SECTIONS_H
#define GEN_SECTIONS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <stdlib.h>
#include "../../edk/Cper.h"
@@ -32,4 +36,8 @@
extern CPER_GENERATOR_DEFINITION generator_definitions[];
extern const size_t generator_definitions_len;
+#ifdef __cplusplus
+}
+#endif
+
#endif