Compiler warning for ui/tap-rtp-common.c (ignoring return value)
Summary
In file included from /usr/include/glib-2.0/glib/giochannel.h:36,
from /usr/include/glib-2.0/glib.h:56,
from ../ui/tap-rtp-common.c:24:
../ui/tap-rtp-common.c: In function ‘update_payload_names’:
/usr/include/glib-2.0/glib/gstring.h:76:5: warning: ignoring return value of ‘g_string_free_and_steal’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
72 | (__builtin_constant_p (free_segment) ? \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73 | ((free_segment) ? \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
74 | (g_string_free) ((str), (free_segment)) : \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
75 | g_string_free_and_steal (str)) \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
76 | : \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
77 | (g_string_free) ((str), (free_segment)))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../ui/tap-rtp-common.c:290:5: note: in expansion of macro ‘g_string_free’
290 | g_string_free(payload_type_names, FALSE);
| ^~~~~~~~~~~~~
Steps to reproduce
Build with this patch:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 61d3798a08..dfbb36a49f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1293,7 +1293,7 @@ endmacro()
find_package(Git)
reset_find_package(GLIB2 GLIB2_MAIN_INCLUDE_DIR GLIB2_INTERNAL_INCLUDE_DIR)
find_package(GLIB2 "2.54.0" REQUIRED)
-include_directories(SYSTEM ${GLIB2_INCLUDE_DIRS})
+include_directories(${GLIB2_INCLUDE_DIRS})
reset_find_package(GMODULE2)
find_package(GMODULE2)
reset_find_package(GTHREAD2)
diff --git a/epan/CMakeLists.txt b/epan/CMakeLists.txt
index 850df44400..3303011fc2 100644
--- a/epan/CMakeLists.txt
+++ b/epan/CMakeLists.txt
@@ -357,7 +357,7 @@ target_link_libraries(epan
)
target_include_directories(epan
- SYSTEM PUBLIC
+ PUBLIC
${GLIB2_INCLUDE_DIRS}
)
diff --git a/wsutil/CMakeLists.txt b/wsutil/CMakeLists.txt
index 976446bcfe..d48930657e 100644
--- a/wsutil/CMakeLists.txt
+++ b/wsutil/CMakeLists.txt
@@ -388,7 +388,7 @@ target_link_libraries(wsutil
${WIN_WS2_32_LIBRARY}
)
-target_include_directories(wsutil SYSTEM
+target_include_directories(wsutil
PUBLIC
${GLIB2_INCLUDE_DIRS}
${GCRYPT_INCLUDE_DIRS}
What is the current bug behavior?
Memory leak.
Build information
$ gcc --version
gcc (GCC) 14.2.1 20240910