From 0f59af42a752b7c7bed65fef251c8bf79bdc47fa Mon Sep 17 00:00:00 2001 From: Hannes Winkler Date: Mon, 16 Sep 2024 13:05:28 +0000 Subject: [PATCH] enable & fix some warnings --- CMakeLists.txt | 2 +- src/plugins/audioplayers/player.c | 4 ++++ src/plugins/gstreamer_video_player/frame.c | 3 +++ src/plugins/gstreamer_video_player/player.c | 5 +++++ src/vulkan.h | 1 + 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 734aba51..3d7002bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,7 +168,7 @@ target_include_directories(flutterpi_module PUBLIC ) target_compile_options(flutterpi_module PUBLIC - $<$:-O0 -Wall -Wextra -Wno-sign-compare -Werror -ggdb -U_FORTIFY_SOURCE -DDEBUG> + $<$:-O0 -Wall -Wextra -Wno-sign-compare -Wswitch-enum -Wformat -Wdouble-promotion -Werror -ggdb -U_FORTIFY_SOURCE -DDEBUG> $<$:-O3 -Wall -Wextra -Wno-sign-compare -ggdb -DNDEBUG> $<$:-O3 -Wall -Wextra -Wno-sign-compare -DNDEBUG> ) diff --git a/src/plugins/audioplayers/player.c b/src/plugins/audioplayers/player.c index 9716de07..7df2038f 100644 --- a/src/plugins/audioplayers/player.c +++ b/src/plugins/audioplayers/player.c @@ -183,6 +183,9 @@ struct audio_player *audio_player_new(char *player_id, char *channel) { gboolean audio_player_on_bus_message(GstBus *bus, GstMessage *message, struct audio_player *data) { (void) bus; + + PRAGMA_DIAGNOSTIC_PUSH + PRAGMA_DIAGNOSTIC_IGNORED("-Wswitch-enum") switch (GST_MESSAGE_TYPE(message)) { case GST_MESSAGE_ERROR: { GError *err; @@ -214,6 +217,7 @@ gboolean audio_player_on_bus_message(GstBus *bus, GstMessage *message, struct au // https://gstreamer.freedesktop.org/documentation/gstreamer/gstmessage.html?gi-language=c#enumerations break; } + PRAGMA_DIAGNOSTIC_POP // Continue watching for messages return TRUE; diff --git a/src/plugins/gstreamer_video_player/frame.c b/src/plugins/gstreamer_video_player/frame.c index a9c8b829..a014e5fb 100644 --- a/src/plugins/gstreamer_video_player/frame.c +++ b/src/plugins/gstreamer_video_player/frame.c @@ -697,6 +697,8 @@ get_plane_infos(GstBuffer *buffer, const GstVideoInfo *info, struct gbm_device * } static uint32_t drm_format_from_gst_info(const GstVideoInfo *info) { + PRAGMA_DIAGNOSTIC_PUSH + PRAGMA_DIAGNOSTIC_IGNORED("-Wswitch-enum") switch (GST_VIDEO_INFO_FORMAT(info)) { case GST_VIDEO_FORMAT_YUY2: return DRM_FORMAT_YUYV; case GST_VIDEO_FORMAT_YVYU: return DRM_FORMAT_YVYU; @@ -730,6 +732,7 @@ static uint32_t drm_format_from_gst_info(const GstVideoInfo *info) { case GST_VIDEO_FORMAT_xBGR: return DRM_FORMAT_RGBX8888; default: return DRM_FORMAT_INVALID; } + PRAGMA_DIAGNOSTIC_POP } ATTR_CONST GstVideoFormat gst_video_format_from_drm_format(uint32_t drm_format) { diff --git a/src/plugins/gstreamer_video_player/player.c b/src/plugins/gstreamer_video_player/player.c index 9ea047bc..eeaee794 100644 --- a/src/plugins/gstreamer_video_player/player.c +++ b/src/plugins/gstreamer_video_player/player.c @@ -472,6 +472,9 @@ static void on_bus_message(struct gstplayer *player, GstMessage *msg) { gchar *debug_info; DEBUG_TRACE_BEGIN(player, "on_bus_message"); + + PRAGMA_DIAGNOSTIC_PUSH + PRAGMA_DIAGNOSTIC_IGNORED("-Wswitch-enum") switch (GST_MESSAGE_TYPE(msg)) { case GST_MESSAGE_ERROR: gst_message_parse_error(msg, &error, &debug_info); @@ -604,6 +607,8 @@ static void on_bus_message(struct gstplayer *player, GstMessage *msg) { default: LOG_DEBUG("gstreamer message: %s, src: %s\n", GST_MESSAGE_TYPE_NAME(msg), GST_MESSAGE_SRC_NAME(msg)); break; } + PRAGMA_DIAGNOSTIC_POP + DEBUG_TRACE_END(player, "on_bus_message"); return; } diff --git a/src/vulkan.h b/src/vulkan.h index 3821805a..88b9411c 100644 --- a/src/vulkan.h +++ b/src/vulkan.h @@ -81,6 +81,7 @@ static inline const char *vk_strerror(VkResult result) { #if VK_HEADER_VERSION >= 213 case VK_ERROR_COMPRESSION_EXHAUSTED_EXT: return "VK_ERROR_COMPRESSION_EXHAUSTED_EXT"; #endif + case VK_RESULT_MAX_ENUM: default: return ""; } }