diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h index 739c7f4d3..e0037dc89 100644 --- a/include/backend/drm/drm.h +++ b/include/backend/drm/drm.h @@ -220,9 +220,20 @@ void drm_page_flip_destroy(struct wlr_drm_page_flip *page_flip); struct wlr_drm_layer *get_drm_layer(struct wlr_drm_backend *drm, struct wlr_output_layer *layer); +#if __STDC_VERSION__ >= 202311L + +#define wlr_drm_conn_log(conn, verb, fmt, ...) \ + wlr_log(verb, "connector %s: " fmt, conn->name __VA_OPT__(,) __VA_ARGS__) +#define wlr_drm_conn_log_errno(conn, verb, fmt, ...) \ + wlr_log_errno(verb, "connector %s: " fmt, conn->name __VA_OPT(,) __VA_ARGS__) + +#else + #define wlr_drm_conn_log(conn, verb, fmt, ...) \ wlr_log(verb, "connector %s: " fmt, conn->name, ##__VA_ARGS__) #define wlr_drm_conn_log_errno(conn, verb, fmt, ...) \ wlr_log_errno(verb, "connector %s: " fmt, conn->name, ##__VA_ARGS__) #endif + +#endif diff --git a/include/render/vulkan.h b/include/render/vulkan.h index 5b74b613e..7abcf3ef4 100644 --- a/include/render/vulkan.h +++ b/include/render/vulkan.h @@ -515,7 +515,16 @@ void vulkan_change_layout(VkCommandBuffer cb, VkImage img, VkImageLayout ol, VkPipelineStageFlags srcs, VkAccessFlags srca, VkImageLayout nl, VkPipelineStageFlags dsts, VkAccessFlags dsta); +#if __STDC_VERSION__ >= 202311L + +#define wlr_vk_error(fmt, res, ...) wlr_log(WLR_ERROR, fmt ": %s (%d)", \ + vulkan_strerror(res), res __VA_OPT(,) __VA_ARGS__) + +#else + #define wlr_vk_error(fmt, res, ...) wlr_log(WLR_ERROR, fmt ": %s (%d)", \ vulkan_strerror(res), res, ##__VA_ARGS__) +#endif + #endif // RENDER_VULKAN_H diff --git a/include/wlr/util/log.h b/include/wlr/util/log.h index 587104cc8..799dd509a 100644 --- a/include/wlr/util/log.h +++ b/include/wlr/util/log.h @@ -64,13 +64,23 @@ void _wlr_vlog(enum wlr_log_importance verbosity, const char *format, va_list ar #define _WLR_FILENAME __FILE__ #endif -#define wlr_log(verb, fmt, ...) \ - _wlr_log(verb, "[%s:%d] " fmt, _WLR_FILENAME, __LINE__, ##__VA_ARGS__) - #define wlr_vlog(verb, fmt, args) \ _wlr_vlog(verb, "[%s:%d] " fmt, _WLR_FILENAME, __LINE__, args) +#if __STDC_VERSION__ >= 202311L + +#define wlr_log(verb, fmt, ...) \ + _wlr_log(verb, "[%s:%d] " fmt, _WLR_FILENAME, __LINE__ __VA_OPT__(,) __VA_ARGS__) +#define wlr_log_errno(verb, fmt, ...) \ + wlr_log(verb, fmt ": %s" __VA_OPT__(,) __VA_ARGS__, strerror(errno)) + +#else + +#define wlr_log(verb, fmt, ...) \ + _wlr_log(verb, "[%s:%d] " fmt, _WLR_FILENAME, __LINE__, ##__VA_ARGS__) #define wlr_log_errno(verb, fmt, ...) \ wlr_log(verb, fmt ": %s", ##__VA_ARGS__, strerror(errno)) #endif + +#endif