git: c065db9f83ff - stable/14 - contrib/libxo: fix API header files inclusions in C++ source files
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 14 Sep 2025 00:33:58 UTC
The branch stable/14 has been updated by khng:
URL: https://cgit.FreeBSD.org/src/commit/?id=c065db9f83ff7c9fa9ce59d095c7e0f966f1df77
commit c065db9f83ff7c9fa9ce59d095c7e0f966f1df77
Author: ShengYi Hung <aokblast@FreeBSD.org>
AuthorDate: 2025-09-07 18:33:01 +0000
Commit: Ka Ho Ng <khng@FreeBSD.org>
CommitDate: 2025-09-14 00:33:40 +0000
contrib/libxo: fix API header files inclusions in C++ source files
C++ source files need `extern "C"` to disable C++ name mangling.
MFC after: 1 week
Reviewed by: aokblast (previous version), phil, imp (previous version)
Differential Revision: https://reviews.freebsd.org/D47930
(cherry picked from commit 11ace56fa030185025936c795d5cf7c57b266835)
---
contrib/libxo/libxo/xo.h | 8 ++++++++
contrib/libxo/libxo/xo_encoder.h | 8 ++++++++
2 files changed, 16 insertions(+)
diff --git a/contrib/libxo/libxo/xo.h b/contrib/libxo/libxo/xo.h
index 6a61a16c7cae..7f37b469b54e 100644
--- a/contrib/libxo/libxo/xo.h
+++ b/contrib/libxo/libxo/xo.h
@@ -27,6 +27,10 @@
#include <stdlib.h>
#include <errno.h>
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
#ifdef __dead2
#define NORETURN __dead2
#else
@@ -699,4 +703,8 @@ xo_retain_clear_all (void);
void
xo_retain_clear (const char *fmt);
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
#endif /* INCLUDE_XO_H */
diff --git a/contrib/libxo/libxo/xo_encoder.h b/contrib/libxo/libxo/xo_encoder.h
index 099248ae13a6..bb57194ab030 100644
--- a/contrib/libxo/libxo/xo_encoder.h
+++ b/contrib/libxo/libxo/xo_encoder.h
@@ -20,6 +20,10 @@
#include <string.h>
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
/*
* Expose libxo's memory allocation functions
*/
@@ -167,4 +171,8 @@ xo_encoder_op_name (xo_encoder_op_t op);
void
xo_failure (xo_handle_t *xop, const char *fmt, ...);
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
#endif /* XO_ENCODER_H */