Date: Wed, 10 Sep 2025 07:31:29 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Ka Ho Ng <khng@freebsd.org> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 11ace56fa030 - main - contrib/libxo: fix API header files inclusions in C++ source files Message-ID: <aMD_IRCC1wA7DpMI@kib.kiev.ua> In-Reply-To: <202509071842.587IgHbm001636@gitrepo.freebsd.org> References: <202509071842.587IgHbm001636@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Sep 07, 2025 at 06:42:17PM +0000, Ka Ho Ng wrote: > The branch main has been updated by khng: > > URL: https://cgit.FreeBSD.org/src/commit/?id=11ace56fa030185025936c795d5cf7c57b266835 > > commit 11ace56fa030185025936c795d5cf7c57b266835 > Author: ShengYi Hung <aokblast@FreeBSD.org> > AuthorDate: 2025-09-07 18:33:01 +0000 > Commit: Ka Ho Ng <khng@FreeBSD.org> > CommitDate: 2025-09-07 18:33:01 +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 > --- > 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 */ Would it be better to use __BEGIN_DECLS? I am not completely sure due to contrib/, but libxo is FreeBSD-specific enough already.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?aMD_IRCC1wA7DpMI>