Message ID | 20231122191753.42997-1-jaslo@ziska.de |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
Hi Jaslo, Thank you for sending a quick fix, much appreciated. On Wed, Nov 22, 2023 at 08:15:47PM +0100, Jaslo Ziska via libcamera-devel wrote: > Fix unused variable error introduced in fd84180d. Missing Signed-off-by: tag. A Fixes: tag is also needed. The commit message could read -------- Commit fd84180d7a09 ("gstreamer: Implement element EOS handling") has introduced a compilation warning with clang: ../../src/gstreamer/gstlibcamerasrc.cpp:768:23: error: unused variable 'oldEvent' [-Werror,-Wunused-variable] g_autoptr(GstEvent) oldEvent = self->pending_eos.exchange(event); ^ This seems to be a false positive, but nonetheless breaks the build. Fix it. Fixes: fd84180d7a09 ("gstreamer: Implement element EOS handling") Signed-off-by: Jaslo Ziska <jaslo@ziska.de> -------- > --- > This patch fixes the unused variable error raised by Laurent. > > src/gstreamer/gstlibcamerasrc.cpp | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp > index 767017db..b0eb2dd7 100644 > --- a/src/gstreamer/gstlibcamerasrc.cpp > +++ b/src/gstreamer/gstlibcamerasrc.cpp > @@ -765,7 +765,7 @@ gst_libcamera_src_send_event(GstElement *element, GstEvent *event) > > switch (GST_EVENT_TYPE(event)) { > case GST_EVENT_EOS: { > - g_autoptr(GstEvent) oldEvent = self->pending_eos.exchange(event); > + [[maybe_unused]] g_autoptr(GstEvent) oldEvent = self->pending_eos.exchange(event); I prefer Nicolas' proposal: GstEvent *oldEvent = self->pending_eos.exchange(event); gst_clear_event(&oldEvent); This is more explicit, I'm slightly worried that the [[maybe_unused]] may lead to an incorrect optimization with clang. If clang believes that the variable is unused, it may just omit it and fail to handle the cleanup. I'll send a v2 of this (keeping your authorship of course). Please let me know if you're fine with the changes by reviewing v2, and I'll push the fix. I also apologize for the long mail threads and the conflicted revert that was posted, there's been some miscommunication. > > ret = TRUE; > break;
diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index 767017db..b0eb2dd7 100644 --- a/src/gstreamer/gstlibcamerasrc.cpp +++ b/src/gstreamer/gstlibcamerasrc.cpp @@ -765,7 +765,7 @@ gst_libcamera_src_send_event(GstElement *element, GstEvent *event) switch (GST_EVENT_TYPE(event)) { case GST_EVENT_EOS: { - g_autoptr(GstEvent) oldEvent = self->pending_eos.exchange(event); + [[maybe_unused]] g_autoptr(GstEvent) oldEvent = self->pending_eos.exchange(event); ret = TRUE; break;