Mesa (main): vulkan/util: Add extern "C" to allow inclusion from c++

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 4 10:52:24 UTC 2022


Module: Mesa
Branch: main
Commit: 676c65d8d56c44d14e47b3012782409c439c75b3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=676c65d8d56c44d14e47b3012782409c439c75b3

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Tue Jun 29 14:38:14 2021 +0200

vulkan/util: Add extern "C" to allow inclusion from c++

We're about to need including this header from a C++ source, so let's
wrap the whole thing in extern "C".

Reviewed-by: Jason Ekstrand <jason.ekstrand at collabora.com>
Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14850>

---

 src/vulkan/runtime/vk_log.h | 8 ++++++++
 src/vulkan/util/vk_alloc.h  | 8 ++++++++
 src/vulkan/wsi/wsi_common.h | 8 ++++++++
 3 files changed, 24 insertions(+)

diff --git a/src/vulkan/runtime/vk_log.h b/src/vulkan/runtime/vk_log.h
index 3f6a127e496..5d0c230f2a8 100644
--- a/src/vulkan/runtime/vk_log.h
+++ b/src/vulkan/runtime/vk_log.h
@@ -23,6 +23,10 @@
 
 #include "vk_instance.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* __VK_ARG_N(...) returns the number of arguments provided to it  */
 #define __VK_ARG_SEQ(_1,_2,_3,_4,_5,_6,_7,_8,N,...) N
 #define __VK_ARG_N(...) __VK_ARG_SEQ(__VA_ARGS__,8,7,6,5,4,3,2,1,0)
@@ -87,3 +91,7 @@ VkResult PRINTFLIKE(5, 6)
 __vk_errorf(const void *_obj, VkResult error,
             const char *file, int line,
             const char *format, ...);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/src/vulkan/util/vk_alloc.h b/src/vulkan/util/vk_alloc.h
index 26f350e107d..18b0d73b052 100644
--- a/src/vulkan/util/vk_alloc.h
+++ b/src/vulkan/util/vk_alloc.h
@@ -33,6 +33,10 @@
 #include "util/macros.h"
 #include "util/u_printf.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 const VkAllocationCallbacks *
 vk_default_allocator(void);
 
@@ -293,4 +297,8 @@ vk_multialloc_zalloc2(struct vk_multialloc *ma,
    return vk_multialloc_zalloc(ma, alloc ? alloc : parent_alloc, scope);
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h
index e565378ccfb..696f6b40bac 100644
--- a/src/vulkan/wsi/wsi_common.h
+++ b/src/vulkan/wsi/wsi_common.h
@@ -31,6 +31,10 @@
 #include <vulkan/vulkan.h>
 #include <vulkan/vk_icd.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifndef WSI_ENTRYPOINTS_H
 extern const struct vk_instance_entrypoint_table wsi_instance_entrypoints;
 extern const struct vk_physical_device_entrypoint_table wsi_physical_device_entrypoints;
@@ -285,4 +289,8 @@ wsi_common_bind_swapchain_image(const struct wsi_device *wsi,
                                 VkSwapchainKHR _swapchain,
                                 uint32_t image_idx);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif



More information about the mesa-commit mailing list