summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/sys/cdefs.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
index 877746e47..7df9f1e52 100644
--- a/include/sys/cdefs.h
+++ b/include/sys/cdefs.h
@@ -20,9 +20,14 @@
#endif
-/* No C++ */
-#define __BEGIN_DECLS
-#define __END_DECLS
+/* C++ needs to know that types and declarations are C, not C++. */
+#ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+#else
+# define __BEGIN_DECLS
+# define __END_DECLS
+#endif
/* GNUish things */
#define __CONSTVALUE