commit:     4a08517cac3c68c232694db7288654b58b68b8ba
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 21 13:31:07 2014 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Oct 21 13:39:34 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=4a08517c

einfo.h, rc.h.in: ensure __BEGIN_DECLS is defined

Some Standard C Libraries, like musl, don't define __BEGIN_DECLS
or __END_DECLS.  We add some ifdef magic to ensure these are
available.

---
 src/libeinfo/einfo.h | 10 ++++++++++
 src/librc/rc.h.in    | 10 ++++++++++
 2 files changed, 20 insertions(+)

diff --git a/src/libeinfo/einfo.h b/src/libeinfo/einfo.h
index 31a891f..8fe5649 100644
--- a/src/libeinfo/einfo.h
+++ b/src/libeinfo/einfo.h
@@ -48,6 +48,16 @@
 # endif
 #endif
 
+#undef __BEGIN_DECLS
+#undef __END_DECLS
+#ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+#else
+# define __BEGIN_DECLS /* empty */
+# define __END_DECLS /* empty */
+#endif
+
 __BEGIN_DECLS
 
 /*! @brief Color types to use */

diff --git a/src/librc/rc.h.in b/src/librc/rc.h.in
index c2a919f..5cd584f 100644
--- a/src/librc/rc.h.in
+++ b/src/librc/rc.h.in
@@ -31,6 +31,16 @@
 #include <stdbool.h>
 #include <stdio.h>
 
+#undef __BEGIN_DECLS
+#undef __END_DECLS
+#ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+#else
+# define __BEGIN_DECLS /* empty */
+# define __END_DECLS /* empty */
+#endif
+
 __BEGIN_DECLS
 
 #define RC_PREFIX "@PREFIX@"

Reply via email to