storage: remove unused variables
James Prestwood
PATCH 1/3 storage: remove unused variables
The auto macros apparently made it difficult for gcc to detect, but clang was able to find them.
--- src/storage.c | 2 -- 1 file changed, 2 deletions(-)
src/storage.c +0 -2
@@ -456,11 +456,9 @@ char *__storage_encrypt(const struct l_settings *settings, const char *name,int __storage_decrypt (struct l_settings *settings,const char *ssid,bool *encrypt) { - _auto_(l_settings_free) struct l_settings *security = NULL; _auto_(l_free) uint8_t *encrypted = NULL; _auto_(l_free) uint8_t *decrypted = NULL; _auto_(l_free) uint8_t *salt = NULL; - _auto_(l_strv_free) char **embedded = NULL; _auto_(l_strv_free) char **groups = NULL;char **i;size_t elen, slen;
Signature · 1 line
2.34.1
Denis Kenzior
Hi James,
Quoted 6 lines · James Prestwood
The auto macros apparently made it difficult for gcc to detect, but clang was able to find them.
--- src/storage.c | 2 -- 1 file changed, 2 deletions(-)
Patches 1-2 applied, thanks.
Regards,
-Denis
James Prestwood
PATCH 2/3 p2p: fix warning for uninitialized variable (clang)
In reply to James PrestwoodThis is actually a false positive only because p2p_device_validate_conn_wfd bails out if the IE is NULL which avoids using wfd_data_length. But its subtle and without inspecting the code it does seem like the length could be used uninitialized.
src/p2p.c:940:7: error: variable 'wfd_data_len' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (dev->conn_own_wfd)
^~~~~~~~~~~~~~~~~
src/p2p.c:946:8: note: uninitialized use occurs here
wfd_data_len))
^~~~~~~~~~~~
src/p2p.c:940:3: note: remove the 'if' if its condition is always true
if (dev->conn_own_wfd)
^~~~~~~~~~~~~~~~~~~~~~
src/p2p.c:906:23: note: initialize the variable 'wfd_data_len' to silence this warning
ssize_t wfd_data_len;
^
= 0
---
src/p2p.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)src/p2p.c +1 -1
@@ -903,7 +903,7 @@ static void p2p_group_event(enum ap_event_type type, const void *event_data, {const struct ap_event_station_added_data *data = event_data; L_AUTO_FREE_VAR(uint8_t *, wfd_data) = NULL; -ssize_t wfd_data_len; +ssize_t wfd_data_len =0 ;struct p2p_association_req req_info;int r;
Signature · 1 line
2.34.1
James Prestwood
PATCH 3/3 build: ignore unknown warnings/pragmas for CC=clang
In reply to James PrestwoodIWD uses a few pragmas to ignore warnings which clang does not support. For -Werror builds these cause build failures but can be fixed by ignoring unknown warnings and pragmas.
--- acinclude.m4 | 5 +++++ 1 file changed, 5 insertions(+)
acinclude.m4 +5 -0
@@ -64,4 +64,9 @@ AC_DEFUN([COMPILER_FLAGS], [ CFLAGS+=" -Wcast-align" fi fi + + if (test "$CC" = "clang"); then + CFLAGS+=" -Wno-unknown-warning-option" + CFLAGS+=" -Wno-unknown-pragmas" + fi ])
Signature · 1 line
2.34.1