clang-format: reformat code with clang-format 15.0.4-1.fc37

This is the version shipped in Fedora 37. As Fedora 37 is now out, the
core developers switch to it. Our gitlab-ci will also use that as base
image for the check-{patch.tree} tests and to generate the pages. There
is a need that everybody agrees on which clang-format version to use,
and that version should be the one of the currently used Fedora release.

Also update the used Fedora image in "contrib/scripts/nm-code-format-container.sh"
script.

The gitlab-ci still needs update in the following commit. The change
in isolation will break the "check-tree" test.
This commit is contained in:
Thomas Haller 2022-11-19 11:14:07 +01:00
parent fe7bea9685
commit 3fb8c0f614
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
28 changed files with 128 additions and 126 deletions

View file

@ -10,7 +10,7 @@ die() {
DIR="$(realpath "$(dirname "$0")/../../")" DIR="$(realpath "$(dirname "$0")/../../")"
cd "$DIR" cd "$DIR"
FEDORA_VERSION=36 FEDORA_VERSION=37
PODNAME="nm-code-format-f$FEDORA_VERSION" PODNAME="nm-code-format-f$FEDORA_VERSION"

View file

@ -208,7 +208,8 @@ NMDevice *nm_device_factory_create_device(NMDeviceFactory *factory,
\ \
NM_DEVICE_FACTORY_DECLARE_TYPES(st_code) \ NM_DEVICE_FACTORY_DECLARE_TYPES(st_code) \
\ \
static void nm_##lower##_device_factory_init(NM##mixed##DeviceFactory *self) {} \ static void nm_##lower##_device_factory_init(NM##mixed##DeviceFactory *self) \
{} \
\ \
static void nm_##lower##_device_factory_class_init(NM##mixed##DeviceFactoryClass *klass) \ static void nm_##lower##_device_factory_class_init(NM##mixed##DeviceFactoryClass *klass) \
{ \ { \

View file

@ -1602,7 +1602,7 @@ ovsdb_got_update(NMOvsdb *self, json_t *msg)
json_t *items; json_t *items;
json_t *external_ids; json_t *external_ids;
json_error_t json_error = { json_error_t json_error = {
0, 0,
}; };
void *iter; void *iter;
const char *name; const char *name;
@ -2003,7 +2003,7 @@ ovsdb_got_msg(NMOvsdb *self, json_t *msg)
{ {
NMOvsdbPrivate *priv = NM_OVSDB_GET_PRIVATE(self); NMOvsdbPrivate *priv = NM_OVSDB_GET_PRIVATE(self);
json_error_t json_error = { json_error_t json_error = {
0, 0,
}; };
json_t *json_id = NULL; json_t *json_id = NULL;
json_int_t id = (json_int_t) -1; json_int_t id = (json_int_t) -1;
@ -2145,7 +2145,7 @@ ovsdb_read_cb(GObject *source_object, GAsyncResult *res, gpointer user_data)
gssize size; gssize size;
json_t *msg; json_t *msg;
json_error_t json_error = { json_error_t json_error = {
0, 0,
}; };
size = g_input_stream_read_finish(stream, res, &error); size = g_input_stream_read_finish(stream, res, &error);

View file

@ -1576,7 +1576,7 @@ nm_dhcp_client_handle_event(gpointer unused,
nm_auto_unref_l3cd_init NML3ConfigData *l3cd = NULL; nm_auto_unref_l3cd_init NML3ConfigData *l3cd = NULL;
NMDhcpClientEventType client_event_type; NMDhcpClientEventType client_event_type;
NMPlatformIP6Address prefix = { NMPlatformIP6Address prefix = {
0, 0,
}; };
g_return_val_if_fail(NM_IS_DHCP_CLIENT(self), FALSE); g_return_val_if_fail(NM_IS_DHCP_CLIENT(self), FALSE);

View file

@ -593,7 +593,7 @@ nm_dhcp_utils_ip6_prefix_from_options(GHashTable *options)
{ {
gs_strfreev char **split_addr = NULL; gs_strfreev char **split_addr = NULL;
NMPlatformIP6Address address = { NMPlatformIP6Address address = {
0, 0,
}; };
struct in6_addr tmp_addr; struct in6_addr tmp_addr;
char *str = NULL; char *str = NULL;

View file

@ -284,7 +284,7 @@ test_classless_static_routes_1(void)
const char *expected_route2_dest = "10.0.0.0"; const char *expected_route2_dest = "10.0.0.0";
const char *expected_route2_gw = "10.17.66.41"; const char *expected_route2_gw = "10.17.66.41";
static const Option data[] = { static const Option data[] = {
/* dhclient custom format */ /* dhclient custom format */
{"rfc3442_classless_static_routes", "24 192 168 10 192 168 1 1 8 10 10 17 66 41"}, {"rfc3442_classless_static_routes", "24 192 168 10 192 168 1 1 8 10 10 17 66 41"},
{NULL, NULL}}; {NULL, NULL}};
@ -309,7 +309,7 @@ test_classless_static_routes_2(void)
const char *expected_route2_dest = "10.0.0.0"; const char *expected_route2_dest = "10.0.0.0";
const char *expected_route2_gw = "10.17.66.41"; const char *expected_route2_gw = "10.17.66.41";
static const Option data[] = { static const Option data[] = {
/* dhcpcd format */ /* dhcpcd format */
{"classless_static_routes", "192.168.10.0/24 192.168.1.1 10.0.0.0/8 10.17.66.41"}, {"classless_static_routes", "192.168.10.0/24 192.168.1.1 10.0.0.0/8 10.17.66.41"},
{NULL, NULL}}; {NULL, NULL}};
@ -335,7 +335,7 @@ test_fedora_dhclient_classless_static_routes(void)
const char *expected_route2_gw = "10.34.255.6"; const char *expected_route2_gw = "10.34.255.6";
const char *expected_gateway = "192.168.0.113"; const char *expected_gateway = "192.168.0.113";
static const Option data[] = { static const Option data[] = {
/* Fedora dhclient format */ /* Fedora dhclient format */
{"classless_static_routes", {"classless_static_routes",
"0 192.168.0.113 25.129.210.177.132 192.168.0.113 7.2 10.34.255.6"}, "0 192.168.0.113 25.129.210.177.132 192.168.0.113 7.2 10.34.255.6"},
{NULL, NULL}}; {NULL, NULL}};
@ -361,7 +361,7 @@ test_dhclient_invalid_classless_routes_1(void)
const char *expected_route1_dest = "192.168.10.0"; const char *expected_route1_dest = "192.168.10.0";
const char *expected_route1_gw = "192.168.1.1"; const char *expected_route1_gw = "192.168.1.1";
static const Option data[] = { static const Option data[] = {
/* dhclient format */ /* dhclient format */
{"rfc3442_classless_static_routes", "24 192 168 10 192 168 1 1 45 10 17 66 41"}, {"rfc3442_classless_static_routes", "24 192 168 10 192 168 1 1 45 10 17 66 41"},
{NULL, NULL}}; {NULL, NULL}};
@ -388,7 +388,7 @@ test_dhcpcd_invalid_classless_routes_1(void)
const char *expected_route2_dest = "100.99.88.56"; const char *expected_route2_dest = "100.99.88.56";
const char *expected_route2_gw = "10.1.1.1"; const char *expected_route2_gw = "10.1.1.1";
static const Option data[] = { static const Option data[] = {
/* dhcpcd format */ /* dhcpcd format */
{"classless_static_routes", "192.168.10.0/24 192.168.1.1 10.0.adfadf/44 10.17.66.41"}, {"classless_static_routes", "192.168.10.0/24 192.168.1.1 10.0.adfadf/44 10.17.66.41"},
{NULL, NULL}}; {NULL, NULL}};
@ -418,8 +418,8 @@ test_dhclient_invalid_classless_routes_2(void)
const char *expected_route2_dest = "100.99.88.56"; const char *expected_route2_dest = "100.99.88.56";
const char *expected_route2_gw = "10.1.1.1"; const char *expected_route2_gw = "10.1.1.1";
static const Option data[] = { static const Option data[] = {
{"rfc3442_classless_static_routes", "45 10 17 66 41 24 192 168 10 192 168 1 1"}, {"rfc3442_classless_static_routes", "45 10 17 66 41 24 192 168 10 192 168 1 1"},
{NULL, NULL}}; {NULL, NULL}};
options = fill_table(generic_options, NULL); options = fill_table(generic_options, NULL);
options = fill_table(data, options); options = fill_table(data, options);
@ -447,8 +447,8 @@ test_dhcpcd_invalid_classless_routes_2(void)
const char *expected_route2_dest = "100.99.88.56"; const char *expected_route2_dest = "100.99.88.56";
const char *expected_route2_gw = "10.1.1.1"; const char *expected_route2_gw = "10.1.1.1";
static const Option data[] = { static const Option data[] = {
{"classless_static_routes", "10.0.adfadf/44 10.17.66.41 192.168.10.0/24 192.168.1.1"}, {"classless_static_routes", "10.0.adfadf/44 10.17.66.41 192.168.10.0/24 192.168.1.1"},
{NULL, NULL}}; {NULL, NULL}};
options = fill_table(generic_options, NULL); options = fill_table(generic_options, NULL);
options = fill_table(data, options); options = fill_table(data, options);
@ -476,8 +476,8 @@ test_dhclient_invalid_classless_routes_3(void)
const char *expected_route1_dest = "192.168.10.0"; const char *expected_route1_dest = "192.168.10.0";
const char *expected_route1_gw = "192.168.1.1"; const char *expected_route1_gw = "192.168.1.1";
static const Option data[] = { static const Option data[] = {
{"rfc3442_classless_static_routes", "24 192 168 10 192 168 1 1 32 128 10 17 66 41"}, {"rfc3442_classless_static_routes", "24 192 168 10 192 168 1 1 32 128 10 17 66 41"},
{NULL, NULL}}; {NULL, NULL}};
options = fill_table(generic_options, NULL); options = fill_table(generic_options, NULL);
options = fill_table(data, options); options = fill_table(data, options);
@ -500,8 +500,8 @@ test_dhcpcd_invalid_classless_routes_3(void)
const char *expected_route1_dest = "192.168.10.0"; const char *expected_route1_dest = "192.168.10.0";
const char *expected_route1_gw = "192.168.1.1"; const char *expected_route1_gw = "192.168.1.1";
static Option data[] = { static Option data[] = {
{"classless_static_routes", "192.168.10.0/24 192.168.1.1 128/32 10.17.66.41"}, {"classless_static_routes", "192.168.10.0/24 192.168.1.1 128/32 10.17.66.41"},
{NULL, NULL}}; {NULL, NULL}};
options = fill_table(generic_options, NULL); options = fill_table(generic_options, NULL);
options = fill_table(data, options); options = fill_table(data, options);
@ -525,8 +525,8 @@ test_dhclient_gw_in_classless_routes(void)
const char *expected_route1_gw = "192.168.1.1"; const char *expected_route1_gw = "192.168.1.1";
const char *expected_gateway = "192.2.3.4"; const char *expected_gateway = "192.2.3.4";
static Option data[] = { static Option data[] = {
{"rfc3442_classless_static_routes", "24 192 168 10 192 168 1 1 0 192 2 3 4"}, {"rfc3442_classless_static_routes", "24 192 168 10 192 168 1 1 0 192 2 3 4"},
{NULL, NULL}}; {NULL, NULL}};
options = fill_table(generic_options, NULL); options = fill_table(generic_options, NULL);
options = fill_table(data, options); options = fill_table(data, options);
@ -549,8 +549,8 @@ test_dhcpcd_gw_in_classless_routes(void)
const char *expected_route1_gw = "192.168.1.1"; const char *expected_route1_gw = "192.168.1.1";
const char *expected_gateway = "192.2.3.4"; const char *expected_gateway = "192.2.3.4";
static Option data[] = { static Option data[] = {
{"classless_static_routes", "192.168.10.0/24 192.168.1.1 0.0.0.0/0 192.2.3.4"}, {"classless_static_routes", "192.168.10.0/24 192.168.1.1 0.0.0.0/0 192.2.3.4"},
{NULL, NULL}}; {NULL, NULL}};
options = fill_table(generic_options, NULL); options = fill_table(generic_options, NULL);
options = fill_table(data, options); options = fill_table(data, options);

View file

@ -575,63 +575,63 @@ nm_config_cmd_line_options_add_to_entries(NMConfigCmdLineOptions *cli, GOptionCo
{ {
GOptionGroup *group; GOptionGroup *group;
GOptionEntry config_options[] = { GOptionEntry config_options[] = {
{"config", {"config",
0, 0,
0, 0,
G_OPTION_ARG_FILENAME, G_OPTION_ARG_FILENAME,
&cli->config_main_file, &cli->config_main_file,
N_("Config file location"), N_("Config file location"),
DEFAULT_CONFIG_MAIN_FILE}, DEFAULT_CONFIG_MAIN_FILE},
{"config-dir", {"config-dir",
0, 0,
0, 0,
G_OPTION_ARG_FILENAME, G_OPTION_ARG_FILENAME,
&cli->config_dir, &cli->config_dir,
N_("Config directory location"), N_("Config directory location"),
DEFAULT_CONFIG_DIR}, DEFAULT_CONFIG_DIR},
{"system-config-dir", {"system-config-dir",
0, 0,
0, 0,
G_OPTION_ARG_FILENAME, G_OPTION_ARG_FILENAME,
&cli->system_config_dir, &cli->system_config_dir,
N_("System config directory location"), N_("System config directory location"),
DEFAULT_SYSTEM_CONFIG_DIR}, DEFAULT_SYSTEM_CONFIG_DIR},
{"intern-config", {"intern-config",
0, 0,
0, 0,
G_OPTION_ARG_FILENAME, G_OPTION_ARG_FILENAME,
&cli->intern_config_file, &cli->intern_config_file,
N_("Internal config file location"), N_("Internal config file location"),
DEFAULT_INTERN_CONFIG_FILE}, DEFAULT_INTERN_CONFIG_FILE},
{"state-file", {"state-file",
0, 0,
0, 0,
G_OPTION_ARG_FILENAME, G_OPTION_ARG_FILENAME,
&cli->state_file, &cli->state_file,
N_("State file location"), N_("State file location"),
DEFAULT_STATE_FILE}, DEFAULT_STATE_FILE},
{"no-auto-default", {"no-auto-default",
0, 0,
G_OPTION_FLAG_HIDDEN, G_OPTION_FLAG_HIDDEN,
G_OPTION_ARG_FILENAME, G_OPTION_ARG_FILENAME,
&cli->no_auto_default_file, &cli->no_auto_default_file,
N_("State file for no-auto-default devices"), N_("State file for no-auto-default devices"),
DEFAULT_NO_AUTO_DEFAULT_FILE}, DEFAULT_NO_AUTO_DEFAULT_FILE},
{"plugins", {"plugins",
0, 0,
0, 0,
G_OPTION_ARG_STRING, G_OPTION_ARG_STRING,
&cli->plugins, &cli->plugins,
N_("List of plugins separated by ','"), N_("List of plugins separated by ','"),
NM_CONFIG_DEFAULT_MAIN_PLUGINS}, NM_CONFIG_DEFAULT_MAIN_PLUGINS},
{"configure-and-quit", {"configure-and-quit",
0, 0,
G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_FLAG_OPTIONAL_ARG,
G_OPTION_ARG_CALLBACK, G_OPTION_ARG_CALLBACK,
parse_configure_and_quit, parse_configure_and_quit,
N_("Quit after initial configuration"), N_("Quit after initial configuration"),
NULL}, NULL},
{"debug", {"debug",
'd', 'd',
0, 0,
G_OPTION_ARG_NONE, G_OPTION_ARG_NONE,
@ -639,29 +639,29 @@ nm_config_cmd_line_options_add_to_entries(NMConfigCmdLineOptions *cli, GOptionCo
N_("Don't become a daemon, and log to stderr"), N_("Don't become a daemon, and log to stderr"),
NULL}, NULL},
/* These three are hidden for now, and should eventually just go away. */ /* These three are hidden for now, and should eventually just go away. */
{"connectivity-uri", {"connectivity-uri",
0, 0,
G_OPTION_FLAG_HIDDEN, G_OPTION_FLAG_HIDDEN,
G_OPTION_ARG_STRING, G_OPTION_ARG_STRING,
&cli->connectivity_uri, &cli->connectivity_uri,
N_("An http(s) address for checking internet connectivity"), N_("An http(s) address for checking internet connectivity"),
"http://example.com"}, "http://example.com"},
{"connectivity-interval", {"connectivity-interval",
0, 0,
G_OPTION_FLAG_HIDDEN, G_OPTION_FLAG_HIDDEN,
G_OPTION_ARG_INT, G_OPTION_ARG_INT,
&cli->connectivity_interval, &cli->connectivity_interval,
N_("The interval between connectivity checks (in seconds)"), N_("The interval between connectivity checks (in seconds)"),
G_STRINGIFY(NM_CONFIG_DEFAULT_CONNECTIVITY_INTERVAL)}, G_STRINGIFY(NM_CONFIG_DEFAULT_CONNECTIVITY_INTERVAL)},
{"connectivity-response", {"connectivity-response",
0, 0,
G_OPTION_FLAG_HIDDEN, G_OPTION_FLAG_HIDDEN,
G_OPTION_ARG_STRING, G_OPTION_ARG_STRING,
&cli->connectivity_response, &cli->connectivity_response,
N_("The expected start of the response"), N_("The expected start of the response"),
NM_CONFIG_DEFAULT_CONNECTIVITY_RESPONSE}, NM_CONFIG_DEFAULT_CONNECTIVITY_RESPONSE},
{0}, {0},
}; };
g_return_if_fail(opt_ctx); g_return_if_fail(opt_ctx);

View file

@ -3863,7 +3863,7 @@ nm_utils_dhcp_client_id_duid(guint32 iaid, const guint8 *duid, gsize duid_len)
guint8 type; guint8 type;
guint32 iaid; guint32 iaid;
guint8 duid[]; guint8 duid[];
} * client_id; } *client_id;
gsize total_size; gsize total_size;
/* the @duid must include the 16 bit duid-type and the data (of max 128 bytes). */ /* the @duid must include the 16 bit duid-type and the data (of max 128 bytes). */
@ -3913,7 +3913,7 @@ nm_utils_dhcp_client_id_systemd_node_specific_full(guint32 iaid,
} en; } en;
}; };
} duid; } duid;
} * client_id; } *client_id;
guint64 u64; guint64 u64;
g_return_val_if_fail(machine_id, NULL); g_return_val_if_fail(machine_id, NULL);

View file

@ -43,21 +43,21 @@ read_argv(int *argc, char ***argv)
{ {
GOptionContext *context; GOptionContext *context;
GOptionEntry options[] = { GOptionEntry options[] = {
{"no-persist", {"no-persist",
'P', 'P',
G_OPTION_FLAG_REVERSE, G_OPTION_FLAG_REVERSE,
G_OPTION_ARG_NONE, G_OPTION_ARG_NONE,
&global_opt.persist, &global_opt.persist,
"Exit after processing netlink messages", "Exit after processing netlink messages",
NULL}, NULL},
{"state-file", {"state-file",
'S', 'S',
0, 0,
G_OPTION_ARG_FILENAME, G_OPTION_ARG_FILENAME,
&global_opt.state_file, &global_opt.state_file,
"Dump the platform cache to this file", "Dump the platform cache to this file",
"FILE"}, "FILE"},
{0}, {0},
}; };
gs_free_error GError *error = NULL; gs_free_error GError *error = NULL;

View file

@ -1934,10 +1934,10 @@ nmtstp_link_macvlan_add(NMPlatform *platform,
if (external_command) { if (external_command) {
const char *dev; const char *dev;
char *modes[] = { char *modes[] = {
[MACVLAN_MODE_BRIDGE] = "bridge", [MACVLAN_MODE_BRIDGE] = "bridge",
[MACVLAN_MODE_VEPA] = "vepa", [MACVLAN_MODE_VEPA] = "vepa",
[MACVLAN_MODE_PRIVATE] = "private", [MACVLAN_MODE_PRIVATE] = "private",
[MACVLAN_MODE_PASSTHRU] = "passthru", [MACVLAN_MODE_PASSTHRU] = "passthru",
}; };
dev = nm_platform_link_get_name(platform, parent); dev = nm_platform_link_get_name(platform, parent);

View file

@ -1176,7 +1176,7 @@ _rule_check_kernel_support(NMPlatform *platform, int attribute)
.addr_family = AF_INET, .addr_family = AF_INET,
.priority = PROBE_PRORITY, .priority = PROBE_PRORITY,
.uid_range = .uid_range =
{ {
.start = 0, .start = 0,
.end = 0, .end = 0,
}, },

View file

@ -2049,11 +2049,11 @@ test_read_wired_aliases_good(gconstpointer test_data)
NULL}; NULL};
const char *expected_address_3[] = {"192.168.1.5", "192.168.1.6", NULL}; const char *expected_address_3[] = {"192.168.1.5", "192.168.1.6", NULL};
const char *expected_label_0[] = { const char *expected_label_0[] = {
NULL, NULL,
"aliasem0:1", "aliasem0:1",
"aliasem0:2", "aliasem0:2",
"aliasem0:99", "aliasem0:99",
NULL, NULL,
}; };
const char *expected_label_3[] = { const char *expected_label_3[] = {
NULL, NULL,

View file

@ -1103,9 +1103,9 @@ test_config_set_values(void)
const char *CONFIG_USER = BUILD_DIR "/test-set-values-user.conf"; const char *CONFIG_USER = BUILD_DIR "/test-set-values-user.conf";
const char *CONFIG_INTERN = BUILD_DIR "/test-set-values-intern.conf"; const char *CONFIG_INTERN = BUILD_DIR "/test-set-values-intern.conf";
const char *atomic_section_prefixes[] = { const char *atomic_section_prefixes[] = {
"atomic-prefix-1.", "atomic-prefix-1.",
"atomic-prefix-2.", "atomic-prefix-2.",
NULL, NULL,
}; };
g_assert(g_file_set_contents(CONFIG_USER, "", 0, NULL)); g_assert(g_file_set_contents(CONFIG_USER, "", 0, NULL));

View file

@ -227,11 +227,11 @@ do_test_nm_utils_kill_child(void)
{ {
GLogLevelFlags fatal_mask; GLogLevelFlags fatal_mask;
char *argv_watchdog[] = { char *argv_watchdog[] = {
"bash", "bash",
"-c", "-c",
"sleep 4; " "sleep 4; "
"kill -KILL 0; #watchdog for #" TEST_TOKEN, "kill -KILL 0; #watchdog for #" TEST_TOKEN,
NULL, NULL,
}; };
char *argv1[] = { char *argv1[] = {
"bash", "bash",

View file

@ -3099,7 +3099,7 @@ check_dbus_properties:
const struct { const struct {
const char *dbus_type; const char *dbus_type;
GType default_gtype; GType default_gtype;
} * p_expected_type, *p_expected_type_2, } *p_expected_type, *p_expected_type_2,
expected_types[] = { expected_types[] = {
{"b", G_TYPE_BOOLEAN}, {"q", G_TYPE_UINT}, {"b", G_TYPE_BOOLEAN}, {"q", G_TYPE_UINT},
{"y", G_TYPE_UCHAR}, {"i", G_TYPE_INT}, {"y", G_TYPE_UCHAR}, {"i", G_TYPE_INT},

View file

@ -2148,11 +2148,11 @@ nm_team_setting_config_set(NMTeamSetting *self, const char *js_str)
else { else {
gboolean unrecognized_content = FALSE; gboolean unrecognized_content = FALSE;
bool has_lst[_NM_TEAM_ATTRIBUTE_NUM] = { bool has_lst[_NM_TEAM_ATTRIBUTE_NUM] = {
FALSE, FALSE,
}; };
NMValueTypUnion val_lst[_NM_TEAM_ATTRIBUTE_NUM]; NMValueTypUnion val_lst[_NM_TEAM_ATTRIBUTE_NUM];
nm_json_t *found_keys[_NM_TEAM_ATTRIBUTE_NUM] = { nm_json_t *found_keys[_NM_TEAM_ATTRIBUTE_NUM] = {
NULL, NULL,
}; };
gs_unref_ptrarray GPtrArray *ptr_array_master_runner_tx_hash_free = NULL; gs_unref_ptrarray GPtrArray *ptr_array_master_runner_tx_hash_free = NULL;
gs_unref_ptrarray GPtrArray *ptr_array_link_watchers_free = NULL; gs_unref_ptrarray GPtrArray *ptr_array_link_watchers_free = NULL;

View file

@ -4052,11 +4052,11 @@ test_connection_diff_different(void)
NMSettingIPConfig *s_ip4; NMSettingIPConfig *s_ip4;
gboolean same; gboolean same;
const DiffSetting settings[] = { const DiffSetting settings[] = {
{NM_SETTING_IP4_CONFIG_SETTING_NAME, {NM_SETTING_IP4_CONFIG_SETTING_NAME,
{ {
{NM_SETTING_IP_CONFIG_METHOD, {NM_SETTING_IP_CONFIG_METHOD,
NM_SETTING_DIFF_RESULT_IN_A | NM_SETTING_DIFF_RESULT_IN_B}, NM_SETTING_DIFF_RESULT_IN_A | NM_SETTING_DIFF_RESULT_IN_B},
{NULL, NM_SETTING_DIFF_RESULT_UNKNOWN}, {NULL, NM_SETTING_DIFF_RESULT_UNKNOWN},
}}, }},
}; };
@ -4137,10 +4137,10 @@ test_connection_diff_inferrable(void)
NMSettingIPConfig *s_ip4; NMSettingIPConfig *s_ip4;
char *uuid; char *uuid;
const DiffSetting settings[] = { const DiffSetting settings[] = {
{NM_SETTING_CONNECTION_SETTING_NAME, {NM_SETTING_CONNECTION_SETTING_NAME,
{ {
{NM_SETTING_CONNECTION_INTERFACE_NAME, NM_SETTING_DIFF_RESULT_IN_A}, {NM_SETTING_CONNECTION_INTERFACE_NAME, NM_SETTING_DIFF_RESULT_IN_A},
{NULL, NM_SETTING_DIFF_RESULT_UNKNOWN}, {NULL, NM_SETTING_DIFF_RESULT_UNKNOWN},
}}, }},
}; };
@ -8475,7 +8475,7 @@ test_nm_utils_strstrdictkey(void)
const char *v1; const char *v1;
const char *v2; const char *v2;
NMUtilsStrStrDictKey *v_static; NMUtilsStrStrDictKey *v_static;
} * val1, *val2, } *val1, *val2,
values[] = { values[] = {
{NULL, NULL}, {NULL, NULL},
{"", NULL}, {"", NULL},

View file

@ -1010,15 +1010,15 @@ nm_g_variant_equal(GVariant *a, GVariant *b)
const typeof(flags) _flags = (flags); \ const typeof(flags) _flags = (flags); \
const typeof(flags) _val = (val); \ const typeof(flags) _val = (val); \
\ \
_flags &(~_val); \ _flags & (~_val); \
}) })
#define NM_FLAGS_ASSIGN(flags, val, assign) \ #define NM_FLAGS_ASSIGN(flags, val, assign) \
({ \ ({ \
const typeof(flags) _flags = (flags); \ const typeof(flags) _flags = (flags); \
const typeof(flags) _val = (val); \ const typeof(flags) _val = (val); \
\ \
(assign) ? _flags | (_val) : _flags &(~_val); \ (assign) ? _flags | (_val) : _flags & (~_val); \
}) })
#define NM_FLAGS_ASSIGN_MASK(flags, mask, val) \ #define NM_FLAGS_ASSIGN_MASK(flags, mask, val) \

View file

@ -2723,7 +2723,8 @@ _nmtst_variant_new_vardict(int dummy, ...)
G_STMT_END G_STMT_END
#else #else
#define _nmtst_assert_variant_bytestring_cmp_str(_ptr, _ptr2, _len) \ #define _nmtst_assert_variant_bytestring_cmp_str(_ptr, _ptr2, _len) \
G_STMT_START {} \ G_STMT_START \
{} \
G_STMT_END G_STMT_END
#endif #endif

View file

@ -153,8 +153,8 @@ test_make_strv(void)
const char *const *v2a = NM_MAKE_STRV("a", "b"); const char *const *v2a = NM_MAKE_STRV("a", "b");
const char *const *v2b = NM_MAKE_STRV("a", "b", ); const char *const *v2b = NM_MAKE_STRV("a", "b", );
const char *const v3[] = { const char *const v3[] = {
"a", "a",
"b", "b",
}; };
const char *const *v4b = NM_MAKE_STRV("a", _make_strv_foo(), ); const char *const *v4b = NM_MAKE_STRV("a", _make_strv_foo(), );

View file

@ -5572,7 +5572,7 @@ _nl_msg_new_tfilter(uint16_t nlmsg_type, uint16_t nlmsg_flags, const NMPlatformT
if (nm_streq(action->kind, NM_PLATFORM_ACTION_KIND_SIMPLE)) { if (nm_streq(action->kind, NM_PLATFORM_ACTION_KIND_SIMPLE)) {
const NMPlatformActionSimple *simple = &action->simple; const NMPlatformActionSimple *simple = &action->simple;
struct tc_defact sel = { struct tc_defact sel = {
0, 0,
}; };
if (!(act_options = nla_nest_start(msg, TCA_ACT_OPTIONS))) if (!(act_options = nla_nest_start(msg, TCA_ACT_OPTIONS)))
@ -5586,7 +5586,7 @@ _nl_msg_new_tfilter(uint16_t nlmsg_type, uint16_t nlmsg_flags, const NMPlatformT
} else if (nm_streq(action->kind, NM_PLATFORM_ACTION_KIND_MIRRED)) { } else if (nm_streq(action->kind, NM_PLATFORM_ACTION_KIND_MIRRED)) {
const NMPlatformActionMirred *mirred = &action->mirred; const NMPlatformActionMirred *mirred = &action->mirred;
struct tc_mirred sel = { struct tc_mirred sel = {
0, 0,
}; };
if (!(act_options = nla_nest_start(msg, TCA_ACT_OPTIONS))) if (!(act_options = nla_nest_start(msg, TCA_ACT_OPTIONS)))
@ -8319,7 +8319,7 @@ link_set_address(NMPlatform *platform, int ifindex, gconstpointer address, size_
nm_auto_nlmsg struct nl_msg *nlmsg = NULL; nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
const ChangeLinkData d = { const ChangeLinkData d = {
.set_address = .set_address =
{ {
.address = address, .address = address,
.length = length, .length = length,
}, },

View file

@ -199,13 +199,13 @@ nm_vpn_openconnect_authenticate_helper(const char *host,
const char *const *iter; const char *const *iter;
const char *path; const char *path;
const char *const DEFAULT_PATHS[] = { const char *const DEFAULT_PATHS[] = {
"/sbin/", "/sbin/",
"/usr/sbin/", "/usr/sbin/",
"/usr/local/sbin/", "/usr/local/sbin/",
"/bin/", "/bin/",
"/usr/bin/", "/usr/bin/",
"/usr/local/bin/", "/usr/local/bin/",
NULL, NULL,
}; };
path = nm_utils_file_search_in_paths("openconnect", path = nm_utils_file_search_in_paths("openconnect",

View file

@ -1138,25 +1138,25 @@ _initial_setup(int *p_argc, char ***p_argv, GError **error)
GOptionContext *opt_ctx; GOptionContext *opt_ctx;
gboolean arg_debug = FALSE; gboolean arg_debug = FALSE;
GOptionEntry entries[] = {{ GOptionEntry entries[] = {{
"debug", "debug",
0, 0,
0, 0,
G_OPTION_ARG_NONE, G_OPTION_ARG_NONE,
&arg_debug, &arg_debug,
"Output to console rather than syslog", "Output to console rather than syslog",
NULL, NULL,
}, },
{ {
"persist", "persist",
0, 0,
0, 0,
G_OPTION_ARG_NONE, G_OPTION_ARG_NONE,
&gl.persist, &gl.persist,
"Don't quit after a short timeout", "Don't quit after a short timeout",
NULL, NULL,
}, },
{ {
NULL, NULL,
}}; }};
gboolean success; gboolean success;

View file

@ -103,50 +103,50 @@ main(int argc, char *argv[])
gboolean dump_to_stdout = FALSE; gboolean dump_to_stdout = FALSE;
gs_strfreev char **remaining = NULL; gs_strfreev char **remaining = NULL;
GOptionEntry option_entries[] = { GOptionEntry option_entries[] = {
{"connections-dir", {"connections-dir",
'c', 'c',
0, 0,
G_OPTION_ARG_FILENAME, G_OPTION_ARG_FILENAME,
&connections_dir, &connections_dir,
"Output connection directory", "Output connection directory",
NM_KEYFILE_PATH_NAME_RUN}, NM_KEYFILE_PATH_NAME_RUN},
{"persistent-connections-dir", {"persistent-connections-dir",
'p', 'p',
0, 0,
G_OPTION_ARG_FILENAME, G_OPTION_ARG_FILENAME,
&etc_connections_dir, &etc_connections_dir,
"Persistent connection directory", "Persistent connection directory",
NM_KEYFILE_PATH_NAME_ETC_DEFAULT}, NM_KEYFILE_PATH_NAME_ETC_DEFAULT},
{"initrd-data-dir", {"initrd-data-dir",
'i', 'i',
0, 0,
G_OPTION_ARG_FILENAME, G_OPTION_ARG_FILENAME,
&initrd_dir, &initrd_dir,
"Output initrd data directory", "Output initrd data directory",
DEFAULT_INITRD_DATA_DIR}, DEFAULT_INITRD_DATA_DIR},
{"sysfs-dir", {"sysfs-dir",
'd', 'd',
0, 0,
G_OPTION_ARG_FILENAME, G_OPTION_ARG_FILENAME,
&sysfs_dir, &sysfs_dir,
"The sysfs mount point", "The sysfs mount point",
DEFAULT_SYSFS_DIR}, DEFAULT_SYSFS_DIR},
{"run-config-dir", {"run-config-dir",
'r', 'r',
0, 0,
G_OPTION_ARG_FILENAME, G_OPTION_ARG_FILENAME,
&run_config_dir, &run_config_dir,
"Output config directory", "Output config directory",
DEFAULT_RUN_CONFIG_DIR}, DEFAULT_RUN_CONFIG_DIR},
{"stdout", {"stdout",
's', 's',
0, 0,
G_OPTION_ARG_NONE, G_OPTION_ARG_NONE,
&dump_to_stdout, &dump_to_stdout,
"Dump connections to standard output", "Dump connections to standard output",
NULL}, NULL},
{G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &remaining, NULL, NULL}, {G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &remaining, NULL, NULL},
{NULL}}; {NULL}};
nm_auto_free_option_context GOptionContext *option_context = NULL; nm_auto_free_option_context GOptionContext *option_context = NULL;
gs_free_error GError *error = NULL; gs_free_error GError *error = NULL;
gs_free char *hostname = NULL; gs_free char *hostname = NULL;

View file

@ -539,8 +539,8 @@ reader_parse_ip(Reader *reader, const char *sysfs_dir, char *argument)
int client_ip_prefix = -1; int client_ip_prefix = -1;
gboolean clear_ip4_required_timeout = TRUE; gboolean clear_ip4_required_timeout = TRUE;
const char *dns[2] = { const char *dns[2] = {
NULL, NULL,
NULL, NULL,
}; };
int dns_addr_family[2] = { int dns_addr_family[2] = {
AF_UNSPEC, AF_UNSPEC,

View file

@ -233,15 +233,15 @@ main(int argc, char *argv[])
GOptionContext *opt_ctx = NULL; GOptionContext *opt_ctx = NULL;
gboolean success; gboolean success;
GOptionEntry options[] = { GOptionEntry options[] = {
{"quiet", 'q', 0, G_OPTION_ARG_NONE, &data.quiet, N_("Don't print anything"), NULL}, {"quiet", 'q', 0, G_OPTION_ARG_NONE, &data.quiet, N_("Don't print anything"), NULL},
{"wait-for-startup", {"wait-for-startup",
's', 's',
0, 0,
G_OPTION_ARG_NONE, G_OPTION_ARG_NONE,
&data.wait_startup, &data.wait_startup,
N_("Wait for NetworkManager startup instead of a connection"), N_("Wait for NetworkManager startup instead of a connection"),
NULL}, NULL},
{"timeout", {"timeout",
't', 't',
0, 0,
G_OPTION_ARG_INT, G_OPTION_ARG_INT,
@ -249,14 +249,14 @@ main(int argc, char *argv[])
N_("Time to wait for a connection, in seconds (without the option, default value is 30). " N_("Time to wait for a connection, in seconds (without the option, default value is 30). "
"Maximum value is 2073600 seconds."), "Maximum value is 2073600 seconds."),
"<timeout>"}, "<timeout>"},
{"exit", {"exit",
'x', 'x',
0, 0,
G_OPTION_ARG_NONE, G_OPTION_ARG_NONE,
&data.exit_no_nm, &data.exit_no_nm,
N_("Exit immediately if NetworkManager is not running or connecting"), N_("Exit immediately if NetworkManager is not running or connecting"),
NULL}, NULL},
{NULL}, {NULL},
}; };
/* Set locale to be able to use environment variables */ /* Set locale to be able to use environment variables */

View file

@ -1035,7 +1035,7 @@ nmc_readline_echo(const NmcConfig *nmc_config, gboolean echo_on, const char *pro
#if HAVE_READLINE_HISTORY #if HAVE_READLINE_HISTORY
nm_auto_free HISTORY_STATE *saved_history = NULL; nm_auto_free HISTORY_STATE *saved_history = NULL;
HISTORY_STATE passwd_history = { HISTORY_STATE passwd_history = {
0, 0,
}; };
#else #else
int start, curpos; int start, curpos;

View file

@ -133,10 +133,10 @@ nmt_password_fields_init(NmtPasswordFields *fields)
{ {
NmtPasswordFieldsPrivate *priv = NMT_PASSWORD_FIELDS_GET_PRIVATE(fields); NmtPasswordFieldsPrivate *priv = NMT_PASSWORD_FIELDS_GET_PRIVATE(fields);
NmtNewtPopupEntry entries[] = { NmtNewtPopupEntry entries[] = {
{_("Store password for all users"), NULL}, {_("Store password for all users"), NULL},
{_("Store password only for this user"), NULL}, {_("Store password only for this user"), NULL},
{_("Ask password every time"), NULL}, {_("Ask password every time"), NULL},
{}, {},
}; };
priv->entry = NMT_NEWT_ENTRY(nmt_newt_entry_new(-1, 0)); priv->entry = NMT_NEWT_ENTRY(nmt_newt_entry_new(-1, 0));