]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Fix warnings about uninitialized variables when compiling with -flto
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 15 May 2025 10:40:13 +0000 (13:40 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Thu, 22 May 2025 11:30:15 +0000 (11:30 +0000)
These were only false positives, except for the unit test ones, which don't
really matter.

src/anvil/test-connect-limit.c
src/lib-dict/dict-txn-lua.c
src/lib-lua/test-lua.c
src/lib-settings/settings.c
src/lib/test-strnum.c

index 52035e69f77421ce9c8c70a191f691d853ee122e..6bbd58809b8bed2595e406c100ec9e53c2eccf33 100644 (file)
@@ -314,7 +314,7 @@ static void test_sessions_compare(struct connect_limit *limit,
                test_assert(!session->found);
                session->found = TRUE;
 
-               pid_t pid;
+               pid_t pid = -1;
                test_assert(str_to_pid(args[0], &pid) == 0);
                test_assert(pid == session->pid);
                test_assert_strcmp(args[1], session->key.username);
index 54bb390b9948f25c99b15ae170b7b8381fc68213..990e4c525982532f258acc2e1cb2cb766ef226b9 100644 (file)
@@ -250,7 +250,7 @@ int lua_dict_transaction_begin(lua_State *L)
 static int lua_dict_set_timestamp(lua_State *L)
 {
        struct lua_dict_txn *txn;
-       lua_Number tv_sec, tv_nsec;
+       lua_Number tv_sec = 0, tv_nsec = 0;
 
        DLUA_REQUIRE_ARGS(L, 2);
 
index 676ca8d121fbf39d781b75be9557e77206be1869..af350dc5b96119666a7c64acbb7e4b3452e8174a 100644 (file)
@@ -33,14 +33,12 @@ static void check_table_get_##name##_ok(struct dlua_script *script, \
        /* check string key */                                          \
        ret = dlua_table_get_##name##_by_str(script->L, idx,            \
                                             str_key, &value);          \
-       test_assert(ret == 1);                                          \
-       test_assert(value == expected_value);                           \
+       test_assert(ret == 1 && value == expected_value);               \
                                                                        \
        /* check int key */                                             \
        ret = dlua_table_get_##name##_by_int(script->L, idx,            \
                                             int_key, &value);          \
-       test_assert(ret == 1);                                          \
-       test_assert(value == expected_value);                           \
+       test_assert(ret == 1 && value == expected_value);               \
 }                                                                      \
 static void check_table_get_##name##_err(struct dlua_script *script,   \
                                         int idx, int expected_ret,     \
@@ -75,7 +73,7 @@ static void check_table_get_string_ok(struct dlua_script *script,
                                      const char *str_key,
                                      lua_Integer int_key)
 {
-       const char *value;
+       const char *value = NULL;
        int ret;
 
        /* check string key */
index 622ae746c5b2052b3d10c1590b405a982a037cae..e3ecfbaa7c6f4828d2e69507455103109c5154aa 100644 (file)
@@ -802,7 +802,7 @@ static int
 settings_var_expand(struct settings_apply_ctx *ctx, unsigned int key_idx,
                    const char **value, const char **error_r)
 {
-       struct settings_file file;
+       struct settings_file file = { NULL, NULL };
        const char *orig_value = *value;
        bool changed;
        bool want_expand = FALSE;
index fff060615255261a366fce3def1e9bd46a050918..3df2bff752bc4cf7c75b2e2a1a80f0e37a66311b 100644 (file)
@@ -107,7 +107,7 @@ static void test_str_to_uintmax_hex(void)
 
        test_begin("str_to_uintmax_hex in range");
        while (i < sizeof(uintmax_t)*CHAR_BIT) {
-               uintmax_t value_back;
+               uintmax_t value_back = UINTMAX_MAX;
                const char *endp;
 
                value = (value << 1) + 1;