connection: warn if return from nm_connection_normalize() is unused

If we try to normalize a connection, we generally rely on it being
already valid and be normalized afterwards.

There's one particular case (nmcli interactive add/edit), where we call
it repeatedly on a best-effort basis and don't care about the failures.
Disable the warning there.
This commit is contained in:
Lubomir Rintel 2024-12-13 09:48:30 +01:00
parent a93dbf95bd
commit 64b062753f
2 changed files with 12 additions and 4 deletions

View file

@ -152,10 +152,16 @@ gboolean nm_connection_diff(NMConnection *a,
gboolean nm_connection_verify(NMConnection *connection, GError **error);
NM_AVAILABLE_IN_1_2
gboolean nm_connection_verify_secrets(NMConnection *connection, GError **error);
gboolean nm_connection_normalize(NMConnection *connection,
GHashTable *parameters,
gboolean *modified,
GError **error);
#ifndef __GI_SCANNER__
#ifdef NETWORKMANAGER_COMPILATION
_nm_warn_unused_result
#endif
#endif
gboolean
nm_connection_normalize(NMConnection *connection,
GHashTable *parameters,
gboolean *modified,
GError **error);
const char *nm_connection_need_secrets(NMConnection *connection, GPtrArray **hints);

View file

@ -6013,7 +6013,9 @@ read_properties:
* Keep asking until there's no more things to ask for. */
do {
/* This ensures all settings that make sense are present. */
NM_PRAGMA_WARNING_DISABLE("-Wunused-result")
nm_connection_normalize(connection, NULL, NULL, NULL);
NM_PRAGMA_WARNING_REENABLE
} while (nmc->ask && questionnaire_one_optional(nmc, connection));
/* Mandatory settings. No good reason to check this other than guarding the user