diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1831b43ee7..207c992552 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -39,7 +39,7 @@ checkpatch: paths: - checkpatch-out.txt -f28_build: +build_f28: <<: *fedora_install image: fedora:28 <<: *fedora_script @@ -48,12 +48,12 @@ f28_build: paths: - docs-html -f_latest_build: +build_f_latest: <<: *fedora_install image: fedora:latest <<: *fedora_script -f_rawhide_build: +build_f_rawhide: <<: *fedora_install image: fedora:rawhide <<: *fedora_script @@ -62,7 +62,7 @@ f_rawhide_build: pages: stage: deploy dependencies: - - f28_build + - build_f28 script: - mv docs-html public artifacts: diff --git a/clients/cli/nmcli.c b/clients/cli/nmcli.c index 6d38a58857..c8253fff9a 100644 --- a/clients/cli/nmcli.c +++ b/clients/cli/nmcli.c @@ -504,7 +504,7 @@ resolve_color_alias (const char *color) static const struct { const char *name; const char *alias; - } const aliases[] = { + } aliases[] = { { "reset", "0" }, { "bold", "1" }, { "white", "1;37" }, diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c index 0cd9bf5164..e33070dc06 100644 --- a/clients/common/nm-meta-setting-desc.c +++ b/clients/common/nm-meta-setting-desc.c @@ -5099,8 +5099,8 @@ static const NMMetaPropertyType _pt_ethtool = { #define PROPERTY_INFO_WITH_DESC(name, ...) \ PROPERTY_INFO (name, DESCRIBE_DOC_##name, ##__VA_ARGS__) -#define ENUM_VALUE_INFOS(...) (((const NMUtilsEnumValueInfo []) { __VA_ARGS__, { 0 } })) -#define INT_VALUE_INFOS(...) (((const NMMetaUtilsIntValueInfo []) { __VA_ARGS__, { 0 } })) +#define ENUM_VALUE_INFOS(...) (((const NMUtilsEnumValueInfo []) { __VA_ARGS__ { .nick = NULL, }, })) +#define INT_VALUE_INFOS(...) (((const NMMetaUtilsIntValueInfo []) { __VA_ARGS__ { .nick = NULL, }, })) #define GET_FCN_WITH_DEFAULT(type, func) \ /* macro that returns @func as const (gboolean(*)(NMSetting*)) type, but checks @@ -5142,9 +5142,9 @@ static const NMMetaPropertyType _pt_ethtool = { .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, \ .value_infos = INT_VALUE_INFOS ( \ { \ - .value = -1, \ + .value.i64 = -1, \ .nick = "unset", \ - } \ + }, \ ), \ ), @@ -5669,13 +5669,13 @@ static const NMMetaPropertyInfo *const property_infos_CONNECTION[] = { .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, .value_infos = INT_VALUE_INFOS ( { - .value = -1, + .value.i64 = -1, .nick = "default", }, { - .value = 0, + .value.i64 = 0, .nick = "forever", - } + }, ), ), ), @@ -5779,7 +5779,7 @@ static const NMMetaPropertyInfo *const property_infos_CONNECTION[] = { { .value = NM_SETTING_CONNECTION_LLDP_ENABLE_RX, .nick = "enable", - } + }, ), ), .typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT @@ -6162,15 +6162,15 @@ static const NMMetaPropertyInfo *const property_infos_IP4_CONFIG[] = { PROPERTY_INFO (NM_SETTING_IP_CONFIG_ROUTE_TABLE, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTE_TABLE, .property_type = &_pt_gobject_int, .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, - .value_infos = INT_VALUE_INFOS ( + .value_infos = INT_VALUE_INFOS ( { - .value = 0, + .value.i64 = 0, .nick = "unspec", }, { - .value = 254, + .value.i64 = 254, .nick = "main", - } + }, ), ), ), @@ -6186,15 +6186,15 @@ static const NMMetaPropertyInfo *const property_infos_IP4_CONFIG[] = { PROPERTY_INFO (NM_SETTING_IP_CONFIG_DHCP_TIMEOUT, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_TIMEOUT, .property_type = &_pt_gobject_int, .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, - .value_infos = INT_VALUE_INFOS ( + .value_infos = INT_VALUE_INFOS ( { - .value = 0, + .value.i64 = 0, .nick = "default", }, { - .value = G_MAXINT32, + .value.i64 = G_MAXINT32, .nick = "infinity", - } + }, ), ), ), @@ -6218,13 +6218,13 @@ static const NMMetaPropertyInfo *const property_infos_IP4_CONFIG[] = { .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, .value_infos = INT_VALUE_INFOS ( { - .value = -1, + .value.i64 = -1, .nick = "default", }, { - .value = 0, + .value.i64 = 0, .nick = "off", - } + }, ), ), ), @@ -6325,15 +6325,15 @@ static const NMMetaPropertyInfo *const property_infos_IP6_CONFIG[] = { PROPERTY_INFO (NM_SETTING_IP_CONFIG_ROUTE_TABLE, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ROUTE_TABLE, .property_type = &_pt_gobject_int, .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, - .value_infos = INT_VALUE_INFOS ( + .value_infos = INT_VALUE_INFOS ( { - .value = 0, + .value.i64 = 0, .nick = "unspec", }, { - .value = 254, + .value.i64 = 254, .nick = "main", - } + }, ), ), ), @@ -6360,7 +6360,7 @@ static const NMMetaPropertyInfo *const property_infos_IP6_CONFIG[] = { { .value = NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR, .nick = "enabled, prefer temporary IP", - } + }, ), ), ), @@ -6860,7 +6860,7 @@ static const NMMetaPropertyInfo *const property_infos_SERIAL[] = { { .value = NM_SETTING_SERIAL_PARITY_NONE, .nick = "n", - } + }, ), ), .typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT @@ -6931,44 +6931,44 @@ static const NMMetaPropertyInfo *const property_infos_TEAM[] = { PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_NOTIFY_PEERS_COUNT, .property_type = &_pt_gobject_int, .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, - .value_infos = INT_VALUE_INFOS ( + .value_infos = INT_VALUE_INFOS ( { - .value = 0, + .value.i64 = 0, .nick = "disabled", - } + }, ), ), ), PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_NOTIFY_PEERS_INTERVAL, .property_type = &_pt_gobject_int, .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, - .value_infos = INT_VALUE_INFOS ( + .value_infos = INT_VALUE_INFOS ( { - .value = 0, + .value.i64 = 0, .nick = "default", - } + }, ), ), ), PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_MCAST_REJOIN_COUNT, .property_type = &_pt_gobject_int, .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, - .value_infos = INT_VALUE_INFOS ( + .value_infos = INT_VALUE_INFOS ( { - .value = 0, + .value.i64 = 0, .nick = "disabled", - } + }, ), ), ), PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_MCAST_REJOIN_INTERVAL, .property_type = &_pt_gobject_int, .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, - .value_infos = INT_VALUE_INFOS ( + .value_infos = INT_VALUE_INFOS ( { - .value = 0, + .value.i64 = 0, .nick = "default", - } + }, ), ), ), @@ -7007,11 +7007,11 @@ static const NMMetaPropertyInfo *const property_infos_TEAM[] = { PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_RUNNER_TX_BALANCER_INTERVAL, .property_type = &_pt_gobject_int, .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, - .value_infos = INT_VALUE_INFOS ( + .value_infos = INT_VALUE_INFOS ( { - .value = NM_SETTING_TEAM_RUNNER_TX_BALANCER_INTERVAL_DEFAULT, + .value.i64 = NM_SETTING_TEAM_RUNNER_TX_BALANCER_INTERVAL_DEFAULT, .nick = "default", - } + }, ), ), ), @@ -7024,22 +7024,22 @@ static const NMMetaPropertyInfo *const property_infos_TEAM[] = { PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_RUNNER_SYS_PRIO, .property_type = &_pt_gobject_int, .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, - .value_infos = INT_VALUE_INFOS ( + .value_infos = INT_VALUE_INFOS ( { - .value = NM_SETTING_TEAM_RUNNER_SYS_PRIO_DEFAULT, + .value.i64 = NM_SETTING_TEAM_RUNNER_SYS_PRIO_DEFAULT, .nick = "default", - } + }, ), ), ), PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_RUNNER_MIN_PORTS, .property_type = &_pt_gobject_int, .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, - .value_infos = INT_VALUE_INFOS ( + .value_infos = INT_VALUE_INFOS ( { - .value = 0, + .value.i64 = 0, .nick = "default", - } + }, ), ), ), @@ -7080,22 +7080,22 @@ static const NMMetaPropertyInfo *const property_infos_TEAM_PORT[] = { PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_PORT_QUEUE_ID, .property_type = &_pt_gobject_int, .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, - .value_infos = INT_VALUE_INFOS ( + .value_infos = INT_VALUE_INFOS ( { - .value = NM_SETTING_TEAM_PORT_QUEUE_ID_DEFAULT, + .value.i64 = NM_SETTING_TEAM_PORT_QUEUE_ID_DEFAULT, .nick = "default", - } + }, ), ), ), PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_PORT_PRIO, .property_type = &_pt_gobject_int, .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, - .value_infos = INT_VALUE_INFOS ( + .value_infos = INT_VALUE_INFOS ( { - .value = 0, + .value.i64 = 0, .nick = "default", - } + }, ), ), ), @@ -7105,22 +7105,22 @@ static const NMMetaPropertyInfo *const property_infos_TEAM_PORT[] = { PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_PORT_LACP_PRIO, .property_type = &_pt_gobject_int, .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, - .value_infos = INT_VALUE_INFOS ( + .value_infos = INT_VALUE_INFOS ( { - .value = NM_SETTING_TEAM_PORT_LACP_PRIO_DEFAULT, + .value.i64 = NM_SETTING_TEAM_PORT_LACP_PRIO_DEFAULT, .nick = "default", - } + }, ), ), ), PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_PORT_LACP_KEY, .property_type = &_pt_gobject_int, .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, - .value_infos = INT_VALUE_INFOS ( + .value_infos = INT_VALUE_INFOS ( { - .value = 0, + .value.i64 = 0, .nick = "default", - } + }, ), ), ), @@ -7491,7 +7491,7 @@ static const NMMetaPropertyInfo *const property_infos_WIRED[] = { { .value = NM_SETTING_WIRED_WAKE_ON_LAN_NONE, .nick = "disabled", - } + }, ), ), .typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT @@ -7620,7 +7620,7 @@ static const NMMetaPropertyInfo *const property_infos_WIRELESS[] = { { .value = NM_SETTING_WIRELESS_WAKE_ON_WLAN_NONE, .nick = "disabled", - } + }, ), ), ), @@ -7782,12 +7782,12 @@ static const NMMetaPropertyInfo *const property_infos_WPAN[] = { .prompt = N_("Short address (<0x0000-0xffff>)"), .property_type = &_pt_gobject_int, .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, \ - .base = 16, - .value_infos = INT_VALUE_INFOS ( + .base = 16, + .value_infos = INT_VALUE_INFOS ( { - .value = G_MAXUINT16, + .value.i64 = G_MAXUINT16, .nick = "unset", - } + }, ), ), ), @@ -7798,12 +7798,12 @@ static const NMMetaPropertyInfo *const property_infos_WPAN[] = { .prompt = N_("PAN Identifier (<0x0000-0xffff>)"), .property_type = &_pt_gobject_int, .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, \ - .base = 16, - .value_infos = INT_VALUE_INFOS ( + .base = 16, + .value_infos = INT_VALUE_INFOS ( { - .value = G_MAXUINT16, + .value.i64 = G_MAXUINT16, .nick = "unset", - } + }, ), ), ), @@ -7813,11 +7813,11 @@ static const NMMetaPropertyInfo *const property_infos_WPAN[] = { .prompt = N_("Page ()"), .property_type = &_pt_gobject_int, .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, \ - .value_infos = INT_VALUE_INFOS ( + .value_infos = INT_VALUE_INFOS ( { - .value = NM_SETTING_WPAN_PAGE_DEFAULT, + .value.i64 = NM_SETTING_WPAN_PAGE_DEFAULT, .nick = "default", - } + }, ), ), ), @@ -7827,11 +7827,11 @@ static const NMMetaPropertyInfo *const property_infos_WPAN[] = { .prompt = N_("Channel ()"), .property_type = &_pt_gobject_int, .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, \ - .value_infos = INT_VALUE_INFOS ( + .value_infos = INT_VALUE_INFOS ( { - .value = NM_SETTING_WPAN_CHANNEL_DEFAULT, + .value.i64 = NM_SETTING_WPAN_CHANNEL_DEFAULT, .nick = "default", - } + }, ), ), ), diff --git a/clients/common/nm-vpn-helpers.c b/clients/common/nm-vpn-helpers.c index c3237f12b5..a840d97f97 100644 --- a/clients/common/nm-vpn-helpers.c +++ b/clients/common/nm-vpn-helpers.c @@ -115,27 +115,27 @@ nm_vpn_supports_ipv6 (NMConnection *connection) const VpnPasswordName * nm_vpn_get_secret_names (const char *service_type) { - static const VpnPasswordName const generic_vpn_secrets[] = { + static const VpnPasswordName generic_vpn_secrets[] = { { "password", N_("Password") }, { 0 } }; - static const VpnPasswordName const openvpn_secrets[] = { + static const VpnPasswordName openvpn_secrets[] = { { "password", N_("Password") }, { "cert-pass", N_("Certificate password") }, { "http-proxy-password", N_("HTTP proxy password") }, { 0 } }; - static const VpnPasswordName const vpnc_secrets[] = { + static const VpnPasswordName vpnc_secrets[] = { { "Xauth password", N_("Password") }, { "IPSec secret", N_("Group password") }, { 0 } }; - static const VpnPasswordName const swan_secrets[] = { + static const VpnPasswordName swan_secrets[] = { { "xauthpassword", N_("Password") }, { "pskvalue", N_("Group password") }, { 0 } }; - static const VpnPasswordName const openconnect_secrets[] = { + static const VpnPasswordName openconnect_secrets[] = { { "gateway", N_("Gateway") }, { "cookie", N_("Cookie") }, { "gwcert", N_("Gateway certificate hash") }, diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index aa19505564..a98bd52102 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -475,6 +475,10 @@ by nm-connection-editor and nm-applet in a non-graphical environment. %build %if %{with meson} %meson \ + --warnlevel 2 \ +%if %{with test} + --werror \ +%endif -Ddhcpcanon=no \ -Ddhcpcd=no \ -Dconfig_dhcp_default=%{dhcp_default} \ diff --git a/contrib/scripts/nm-ci-run.sh b/contrib/scripts/nm-ci-run.sh index c3d0cb2e54..7072933677 100755 --- a/contrib/scripts/nm-ci-run.sh +++ b/contrib/scripts/nm-ci-run.sh @@ -45,13 +45,13 @@ else fi _WITH_CRYPTO="gnutls" -_WITH_MORE_WARNINGS="error" +_WITH_WERROR=1 _WITH_LIBTEAM="$_TRUE" _WITH_DOCS="$_TRUE" _WITH_SYSTEMD_LOGIND="$_TRUE" if [ "$CI" == travis ]; then - _WITH_MORE_WARNINGS="no" + _WITH_WERROR=0 _WITH_LIBTEAM="$_FALSE" _WITH_DOCS="$_FALSE" _WITH_SYSTEMD_LOGIND="$_FALSE" @@ -83,13 +83,18 @@ _autotools_test_print_logs() { run_autotools() { NOCONFIGURE=1 ./autogen.sh mkdir ./build + if [ "$_WITH_WERROR" == 1 ]; then + _WITH_WERROR_VAL="error" + else + _WITH_WERROR_VAL="yes" + fi pushd ./build ../configure \ --prefix="$PWD/INST" \ --enable-introspection=$_WITH_DOCS \ --enable-gtk-doc=$_WITH_DOCS \ --with-systemd-logind=$_WITH_SYSTEMD_LOGIND \ - --enable-more-warnings=$_WITH_MORE_WARNINGS \ + --enable-more-warnings="$_WITH_WERROR_VAL" \ --enable-tests=yes \ --with-crypto=$_WITH_CRYPTO \ \ @@ -139,7 +144,15 @@ run_autotools() { ############################################################################### run_meson() { + if [ "$_WITH_WERROR" == 1 ]; then + _WITH_WERROR_VAL="--werror" + else + _WITH_WERROR_VAL="" + fi meson build \ + \ + --warnlevel 2 \ + $_WITH_WERROR_VAL \ \ -D ld_gc=false \ -D session_tracking=no \ diff --git a/libnm-core/nm-setting-team-port.c b/libnm-core/nm-setting-team-port.c index 5277e9c01d..be88eb8350 100644 --- a/libnm-core/nm-setting-team-port.c +++ b/libnm-core/nm-setting-team-port.c @@ -42,7 +42,6 @@ /*****************************************************************************/ -/* Keep aligned with _prop_to_keys[] */ NM_GOBJECT_PROPERTIES_DEFINE (NMSettingTeamPort, PROP_CONFIG, PROP_QUEUE_ID, @@ -53,15 +52,14 @@ NM_GOBJECT_PROPERTIES_DEFINE (NMSettingTeamPort, PROP_LINK_WATCHERS, ); -/* Keep aligned with team-port properties enum */ static const _NMUtilsTeamPropertyKeys _prop_to_keys[_PROPERTY_ENUMS_LAST] = { - [PROP_CONFIG] = { NULL, NULL, NULL, 0 }, - [PROP_QUEUE_ID] = { "queue_id", NULL, NULL, NM_SETTING_TEAM_PORT_QUEUE_ID_DEFAULT }, - [PROP_PRIO] = { "prio", NULL, NULL, 0 }, - [PROP_STICKY] = { "sticky", NULL, NULL, 0 }, - [PROP_LACP_PRIO] = { "lacp_prio", NULL, NULL, NM_SETTING_TEAM_PORT_LACP_PRIO_DEFAULT }, - [PROP_LACP_KEY] = { "lacp_key", NULL, NULL, 0 }, - [PROP_LINK_WATCHERS] = { "link_watch", NULL, NULL, 0 } + [PROP_CONFIG] = { }, + [PROP_QUEUE_ID] = { .key1 = "queue_id", .default_int = NM_SETTING_TEAM_PORT_QUEUE_ID_DEFAULT, }, + [PROP_PRIO] = { .key1 = "prio", }, + [PROP_STICKY] = { .key1 = "sticky", }, + [PROP_LACP_PRIO] = { .key1 = "lacp_prio", .default_int = NM_SETTING_TEAM_PORT_LACP_PRIO_DEFAULT, }, + [PROP_LACP_KEY] = { .key1 = "lacp_key", }, + [PROP_LINK_WATCHERS] = { .key1 = "link_watch", }, }; typedef struct { diff --git a/libnm-core/nm-setting-team.c b/libnm-core/nm-setting-team.c index 867db52276..96fdd10dcb 100644 --- a/libnm-core/nm-setting-team.c +++ b/libnm-core/nm-setting-team.c @@ -625,7 +625,6 @@ nm_team_link_watcher_get_flags (NMTeamLinkWatcher *watcher) /*****************************************************************************/ -/* Keep aligned with _prop_to_keys[] */ NM_GOBJECT_PROPERTIES_DEFINE (NMSettingTeam, PROP_CONFIG, PROP_NOTIFY_PEERS_COUNT, @@ -645,25 +644,23 @@ NM_GOBJECT_PROPERTIES_DEFINE (NMSettingTeam, PROP_LINK_WATCHERS, ); -/* Keep aligned with team properties enum */ static const _NMUtilsTeamPropertyKeys _prop_to_keys[_PROPERTY_ENUMS_LAST] = { - [PROP_CONFIG] = { NULL, NULL, NULL, 0 }, - [PROP_NOTIFY_PEERS_COUNT] = { "notify_peers", "count", NULL, 0 }, - [PROP_NOTIFY_PEERS_INTERVAL] = { "notify_peers", "interval", NULL, 0 }, - [PROP_MCAST_REJOIN_COUNT] = { "mcast_rejoin", "count", NULL, 0 }, - [PROP_MCAST_REJOIN_INTERVAL] = { "mcast_rejoin", "interval", NULL, 0 }, - [PROP_RUNNER] = { "runner", "name", NULL, - {.default_str = NM_SETTING_TEAM_RUNNER_DEFAULT} }, - [PROP_RUNNER_HWADDR_POLICY] = { "runner", "hwaddr_policy", NULL, 0 }, - [PROP_RUNNER_TX_HASH] = { "runner", "tx_hash", NULL, 0 }, - [PROP_RUNNER_TX_BALANCER] = { "runner", "tx_balancer", "name", 0 }, - [PROP_RUNNER_TX_BALANCER_INTERVAL] = { "runner", "tx_balancer", "balancing_interval", -1 }, - [PROP_RUNNER_ACTIVE] = { "runner", "active", NULL, 0 }, - [PROP_RUNNER_FAST_RATE] = { "runner", "fast_rate", NULL, 0 }, - [PROP_RUNNER_SYS_PRIO] = { "runner", "sys_prio", NULL, -1 }, - [PROP_RUNNER_MIN_PORTS] = { "runner", "min_ports", NULL, -1 }, - [PROP_RUNNER_AGG_SELECT_POLICY] = { "runner", "agg_select_policy", NULL, 0 }, - [PROP_LINK_WATCHERS] = { "link_watch", NULL, NULL, 0 } + [PROP_CONFIG] = { }, + [PROP_NOTIFY_PEERS_COUNT] = { .key1 = "notify_peers", .key2 = "count", }, + [PROP_NOTIFY_PEERS_INTERVAL] = { .key1 = "notify_peers", .key2 = "interval", }, + [PROP_MCAST_REJOIN_COUNT] = { .key1 = "mcast_rejoin", .key2 = "count", }, + [PROP_MCAST_REJOIN_INTERVAL] = { .key1 = "mcast_rejoin", .key2 = "interval", }, + [PROP_RUNNER] = { .key1 = "runner", .key2 = "name", .default_str = NM_SETTING_TEAM_RUNNER_DEFAULT, }, + [PROP_RUNNER_HWADDR_POLICY] = { .key1 = "runner", .key2 = "hwaddr_policy", }, + [PROP_RUNNER_TX_HASH] = { .key1 = "runner", .key2 = "tx_hash", }, + [PROP_RUNNER_TX_BALANCER] = { .key1 = "runner", .key2 = "tx_balancer", .key3 = "name", }, + [PROP_RUNNER_TX_BALANCER_INTERVAL] = { .key1 = "runner", .key2 = "tx_balancer", .key3 = "balancing_interval", .default_int = -1 }, + [PROP_RUNNER_ACTIVE] = { .key1 = "runner", .key2 = "active", }, + [PROP_RUNNER_FAST_RATE] = { .key1 = "runner", .key2 = "fast_rate", }, + [PROP_RUNNER_SYS_PRIO] = { .key1 = "runner", .key2 = "sys_prio", .default_int = -1, }, + [PROP_RUNNER_MIN_PORTS] = { .key1 = "runner", .key2 = "min_ports", .default_int = -1, }, + [PROP_RUNNER_AGG_SELECT_POLICY] = { .key1 = "runner", .key2 = "agg_select_policy", }, + [PROP_LINK_WATCHERS] = { .key1 = "link_watch", }, }; typedef struct { diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c index b58a2409b2..b0f84aab22 100644 --- a/libnm-core/nm-utils.c +++ b/libnm-core/nm-utils.c @@ -2892,7 +2892,7 @@ nm_utils_uuid_generate_from_string_bin (NMUuid *uuid, const char *s, gssize slen break; case NM_UTILS_UUID_TYPE_VERSION3: case NM_UTILS_UUID_TYPE_VERSION5: { - NMUuid ns_uuid = { 0 }; + NMUuid ns_uuid = { }; if (type_args) { /* type_args can be a name space UUID. Interpret it as (char *) */ diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c index 0806e7b97b..efbcf6274e 100644 --- a/libnm-core/tests/test-general.c +++ b/libnm-core/tests/test-general.c @@ -5889,7 +5889,7 @@ __test_uuid (const char *expected_uuid, const char *str, gssize slen, char *uuid static void test_nm_utils_uuid_generate_from_strings (void) { - const NMUuid uuid0 = { 0 }; + const NMUuid uuid0 = { }; g_assert_cmpmem (&uuid0, sizeof (uuid0), _uuid ("00000000-0000-0000-0000-000000000000"), 16); diff --git a/m4/compiler_options.m4 b/m4/compiler_options.m4 index 9d0c58814b..bf847bfc91 100644 --- a/m4/compiler_options.m4 +++ b/m4/compiler_options.m4 @@ -124,12 +124,6 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then [int f () { int i = yolo; yolo; return i; }] ) - dnl clang 3.9 would like to see "{ { 0 } }" here, but that does not - dnl look too wise. - NM_COMPILER_WARNING([$1], [missing-braces], - [union { int a[1]; int b[2]; } c = { 0 }] - ) - dnl a new warning in gcc 8, glib 2.55 doesn't play nice yet dnl https://bugzilla.gnome.org/show_bug.cgi?id=793272 NM_COMPILER_WARNING([$1], [cast-function-type], diff --git a/meson.build b/meson.build index 3368289c11..19926aeb12 100644 --- a/meson.build +++ b/meson.build @@ -8,7 +8,7 @@ project( license: 'GPL2+', default_options: [ 'buildtype=debugoptimized', - 'c_std=gnu99', + 'c_std=gnu11', ], meson_version: '>= 0.44.0', ) @@ -158,7 +158,6 @@ endif if nm_debug common_flags += cc.get_supported_arguments([ - '-fno-strict-aliasing', '-Wdeclaration-after-statement', '-Wfloat-equal', '-Wimplicit-fallthrough', @@ -169,7 +168,7 @@ if nm_debug '-Wmissing-prototypes', '-Wno-duplicate-decl-specifier', '-Wno-format-truncation', - '-Wno-missing-braces', + '-Wno-gnu-variable-sized-type-not-at-end', '-Wno-missing-field-initializers', '-Wno-pragmas', '-Wno-sign-compare', @@ -181,6 +180,7 @@ if nm_debug '-Wtypedef-redefinition', '-Wundef', '-Wunknown-attributes', + '-fno-strict-aliasing', ]) endif diff --git a/shared/nm-ethtool-utils.c b/shared/nm-ethtool-utils.c index d50695ae0e..3313274ad1 100644 --- a/shared/nm-ethtool-utils.c +++ b/shared/nm-ethtool-utils.c @@ -90,7 +90,7 @@ const NMEthtoolData *const nm_ethtool_data[_NM_ETHTOOL_ID_NUM + 1] = { [_NM_ETHTOOL_ID_NUM] = NULL, }; -const guint8 const _by_name[_NM_ETHTOOL_ID_NUM] = { +static const guint8 _by_name[_NM_ETHTOOL_ID_NUM] = { /* sorted by optname. */ NM_ETHTOOL_ID_FEATURE_ESP_HW_OFFLOAD, NM_ETHTOOL_ID_FEATURE_ESP_TX_CSUM_HW_OFFLOAD, diff --git a/shared/nm-utils/nm-shared-utils.c b/shared/nm-utils/nm-shared-utils.c index 23c16b6b44..288c96a4f8 100644 --- a/shared/nm-utils/nm-shared-utils.c +++ b/shared/nm-utils/nm-shared-utils.c @@ -35,7 +35,7 @@ const void *const _NM_PTRARRAY_EMPTY[1] = { NULL }; /*****************************************************************************/ -const NMIPAddr nm_ip_addr_zero = { 0 }; +const NMIPAddr nm_ip_addr_zero = { }; /*****************************************************************************/ diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c index fc0c5b8d3b..0fac5eff25 100644 --- a/src/NetworkManagerUtils.c +++ b/src/NetworkManagerUtils.c @@ -377,40 +377,36 @@ check_ip6_method (NMConnection *orig, static int route_compare (NMIPRoute *route1, NMIPRoute *route2, gint64 default_metric) { - gint64 r, metric1, metric2; + NMIPAddr a1; + NMIPAddr a2; + guint64 m1; + guint64 m2; int family; guint plen; - NMIPAddr a1 = { 0 }, a2 = { 0 }; family = nm_ip_route_get_family (route1); - r = family - nm_ip_route_get_family (route2); - if (r) - return r > 0 ? 1 : -1; + NM_CMP_DIRECT (family, nm_ip_route_get_family (route2)); + + nm_assert_addr_family (family); plen = nm_ip_route_get_prefix (route1); - r = plen - nm_ip_route_get_prefix (route2); - if (r) - return r > 0 ? 1 : -1; + NM_CMP_DIRECT (plen, nm_ip_route_get_prefix (route2)); - metric1 = nm_ip_route_get_metric (route1) == -1 ? default_metric : nm_ip_route_get_metric (route1); - metric2 = nm_ip_route_get_metric (route2) == -1 ? default_metric : nm_ip_route_get_metric (route2); + m1 = nm_ip_route_get_metric (route1); + m2 = nm_ip_route_get_metric (route2); + NM_CMP_DIRECT (m1 == -1 ? default_metric : m1, + m2 == -1 ? default_metric : m2); - r = metric1 - metric2; - if (r) - return r > 0 ? 1 : -1; + NM_CMP_DIRECT_STRCMP0 (nm_ip_route_get_next_hop (route1), + nm_ip_route_get_next_hop (route2)); - r = g_strcmp0 (nm_ip_route_get_next_hop (route1), nm_ip_route_get_next_hop (route2)); - if (r) - return r; - - /* NMIPRoute validates family and dest. inet_pton() is not expected to fail. */ - inet_pton (family, nm_ip_route_get_dest (route1), &a1); - inet_pton (family, nm_ip_route_get_dest (route2), &a2); + if (!inet_pton (family, nm_ip_route_get_dest (route1), &a1)) + nm_assert_not_reached (); + if (!inet_pton (family, nm_ip_route_get_dest (route2), &a2)) + nm_assert_not_reached (); nm_utils_ipx_address_clear_host_address (family, &a1, &a1, plen); nm_utils_ipx_address_clear_host_address (family, &a2, &a2, plen); - r = memcmp (&a1, &a2, sizeof (a1)); - if (r) - return r; + NM_CMP_DIRECT_MEMCMP (&a1, &a2, nm_utils_addr_family_to_size (family)); return 0; } diff --git a/src/devices/nm-device-ip-tunnel.c b/src/devices/nm-device-ip-tunnel.c index ca5f9c3f5d..1dc2bc964b 100644 --- a/src/devices/nm-device-ip-tunnel.c +++ b/src/devices/nm-device-ip-tunnel.c @@ -149,9 +149,13 @@ update_properties_from_ifindex (NMDevice *device, int ifindex) NMDeviceIPTunnel *self = NM_DEVICE_IP_TUNNEL (device); NMDeviceIPTunnelPrivate *priv = NM_DEVICE_IP_TUNNEL_GET_PRIVATE (self); int parent_ifindex = 0; - in_addr_t local4 = 0, remote4 = 0; - struct in6_addr local6 = { 0 }, remote6 = { 0 }; - guint8 ttl = 0, tos = 0, encap_limit = 0; + in_addr_t local4 = 0; + in_addr_t remote4 = 0; + struct in6_addr local6 = IN6ADDR_ANY_INIT; + struct in6_addr remote6 = IN6ADDR_ANY_INIT; + guint8 ttl = 0; + guint8 tos = 0; + guint8 encap_limit = 0; gboolean pmtud = FALSE; guint32 flow_label = 0; NMIPTunnelFlags flags = NM_IP_TUNNEL_FLAG_NONE; diff --git a/src/devices/wifi/nm-device-iwd.c b/src/devices/wifi/nm-device-iwd.c index ff28024cec..5b150e0ca4 100644 --- a/src/devices/wifi/nm-device-iwd.c +++ b/src/devices/wifi/nm-device-iwd.c @@ -2401,7 +2401,7 @@ nm_device_iwd_set_dbus_object (NMDeviceIwd *self, GDBusObject *object) gboolean powered; NMDeviceWifiCapabilities capabilities; - if (!nm_g_object_ref_set ((GObject **) &priv->dbus_obj, (GObject *) object)) + if (!nm_g_object_ref_set (&priv->dbus_obj, object)) return; if (priv->dbus_device_proxy) { diff --git a/src/initrd/nmi-cmdline-reader.c b/src/initrd/nmi-cmdline-reader.c index e812b086b9..ffd460509b 100644 --- a/src/initrd/nmi-cmdline-reader.c +++ b/src/initrd/nmi-cmdline-reader.c @@ -518,8 +518,8 @@ parse_rd_route (GHashTable *connections, char *argument) const char *gateway; const char *interface; int family = AF_UNSPEC; - NMIPAddr net_addr = { 0, }; - NMIPAddr gateway_addr = { 0, }; + NMIPAddr net_addr = { }; + NMIPAddr gateway_addr = { }; int net_prefix = -1; NMIPRoute *route; NMSettingIPConfig *s_ip; diff --git a/src/platform/tests/test-link.c b/src/platform/tests/test-link.c index 21f1a80dbb..549b9276ff 100644 --- a/src/platform/tests/test-link.c +++ b/src/platform/tests/test-link.c @@ -860,9 +860,9 @@ _test_wireguard_change (NMPlatform *platform, if ((i % 2) == 1) { endpoint = (NMSockAddrUnion) { .in = { - .sin_family = AF_INET, - .sin_addr = nmtst_inet4_from_string (nm_sprintf_buf (s_addr, "192.168.7.%d", i)), - .sin_port = htons (14000 + i), + .sin_family = AF_INET, + .sin_addr.s_addr = nmtst_inet4_from_string (nm_sprintf_buf (s_addr, "192.168.7.%d", i)), + .sin_port = htons (14000 + i), }, }; } else { diff --git a/src/platform/tests/test-route.c b/src/platform/tests/test-route.c index 4c0f686f4e..2619ec52c2 100644 --- a/src/platform/tests/test-route.c +++ b/src/platform/tests/test-route.c @@ -767,7 +767,7 @@ test_ip (gconstpointer test_data) const int EX_ = -1; struct { int ifindex; - } iface_data[10] = { 0 }; + } iface_data[10] = { { 0 }, }; int order_idx[G_N_ELEMENTS (iface_data)] = { 0 }; guint order_len; guint try; diff --git a/src/tests/test-general.c b/src/tests/test-general.c index f065d12721..79e73cdc55 100644 --- a/src/tests/test-general.c +++ b/src/tests/test-general.c @@ -1666,7 +1666,7 @@ test_duplicate_decl_specifier (void) /* have some static variables, so that the result is certainly not optimized out. */ static const int v_const[1] = { 1 }; static int v_result[1] = { }; - const const int v2 = 3; + const int v2 = 3; /* Test that we don't get a compiler warning about duplicate const specifier. * C99 allows that and it can easily happen in macros. */ @@ -2055,14 +2055,14 @@ test_nm_utils_dhcp_client_id_systemd_node_specific (gconstpointer test_data) guint64 duid_id; } d_array[] = { [0] = { - .machine_id = { 0xcb, 0xc2, 0x2e, 0x47, 0x41, 0x8e, 0x40, 0x2a, 0xa7, 0xb3, 0x0d, 0xea, 0x92, 0x83, 0x94, 0xef }, + .machine_id.uuid = { 0xcb, 0xc2, 0x2e, 0x47, 0x41, 0x8e, 0x40, 0x2a, 0xa7, 0xb3, 0x0d, 0xea, 0x92, 0x83, 0x94, 0xef }, .ifname = "lo", .ifname_hash_1 = 0x7297085c2b12c911llu, .iaid_ifname = htobe32 (0x5985c14du), .duid_id = htobe64 (0x3d769bb2c14d29e1u), }, [1] = { - .machine_id = { 0x11, 0x4e, 0xb4, 0xda, 0xd3, 0x22, 0x4a, 0xff, 0x9f, 0xc3, 0x30, 0x83, 0x38, 0xa0, 0xeb, 0xb7 }, + .machine_id.uuid = { 0x11, 0x4e, 0xb4, 0xda, 0xd3, 0x22, 0x4a, 0xff, 0x9f, 0xc3, 0x30, 0x83, 0x38, 0xa0, 0xeb, 0xb7 }, .ifname = "eth0", .ifname_hash_1 = 0x9e1cb083b54cd7b6llu, .iaid_ifname = htobe32 (0x2b506735u),