From ff101ada3ab65ce452f0ef235e486432fd9160fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Thu, 4 Apr 2024 12:15:06 +0200 Subject: [PATCH 1/2] ci: update distributions that we test in the CI We had an agreement on what distributions should we test and when. We'll test in Tier 2 those distros that can potentially use the current version of NM and in Tier 3 those distros that are still maintained (not EOL'd). So, Tier 2 is to catch errors that might be severe because might be blocking for the distributions planning to use the current NM version, they must be fixed ASAP, before doing the release if possible. These "distribution versions" will be different for main branch than for stable branches: - Debian 12 uses NM-1.42, so Debian 12 should be Tier 2 in the branch nm-1-42. - However, Debian 12 will never use newer stable versions, so it should be Tier 3 in main branch. We want to run the Tier 3 tests even if those distros won't use newer vesions of NM because they are useful to test NM compilation with older compilers and tools. Fixing failures here might not be considered urgent, though. To save resources from Freedesktop we'll run Tier 1 on every MR and Tiers 2 and 3 before doing a release, or on demand if we need. --- .gitlab-ci.yml | 456 ++++++++++++++++++++++++------------------ .gitlab-ci/config.yml | 66 +++--- 2 files changed, 305 insertions(+), 217 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c283cc2769..8e2a4e171a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -57,11 +57,11 @@ variables: # # This is done by running `ci-fairy generate-template` and possibly bumping # ".default_tag". - ALPINE_TAG: 'tag-84d008505f54' - CENTOS_TAG: 'tag-eb0b116664f7' - DEBIAN_TAG: 'tag-183208b2b592' - FEDORA_TAG: 'tag-eb0b116664f7' - UBUNTU_TAG: 'tag-183208b2b592' + ALPINE_TAG: 'tag-ec0f564800e3' + CENTOS_TAG: 'tag-b114f45d4a4e' + DEBIAN_TAG: 'tag-318ea804326f' + FEDORA_TAG: 'tag-b114f45d4a4e' + UBUNTU_TAG: 'tag-318ea804326f' ALPINE_EXEC: 'bash .gitlab-ci/alpine-install.sh' CENTOS_EXEC: 'bash .gitlab-ci/fedora-install.sh' @@ -97,28 +97,7 @@ variables: # Build a container for each distribution + version. The ci-templates # will re-use the containers if the tag doesn't change. -tier1:fedora:39@prep: - extends: - - .fdo.container-build@fedora - stage: prep - variables: - GIT_STRATEGY: none - FDO_DISTRIBUTION_VERSION: '39' - FDO_DISTRIBUTION_TAG: $FEDORA_TAG - FDO_DISTRIBUTION_EXEC: $FEDORA_EXEC - -tier2:fedora:38@prep: - extends: - - .fdo.container-build@fedora - stage: prep - variables: - GIT_STRATEGY: none - FDO_DISTRIBUTION_VERSION: '38' - FDO_DISTRIBUTION_TAG: $FEDORA_TAG - FDO_DISTRIBUTION_EXEC: $FEDORA_EXEC - when: manual - -tier2:fedora:40@prep: +tier1:fedora:40@prep: extends: - .fdo.container-build@fedora stage: prep @@ -127,28 +106,47 @@ tier2:fedora:40@prep: FDO_DISTRIBUTION_VERSION: '40' FDO_DISTRIBUTION_TAG: $FEDORA_TAG FDO_DISTRIBUTION_EXEC: $FEDORA_EXEC - when: manual -tier2:ubuntu:20.04@prep: +tier1:fedora:rawhide@prep: extends: - - .fdo.container-build@ubuntu + - .fdo.container-build@fedora stage: prep variables: GIT_STRATEGY: none - FDO_DISTRIBUTION_VERSION: '20.04' - FDO_DISTRIBUTION_TAG: $UBUNTU_TAG - FDO_DISTRIBUTION_EXEC: $UBUNTU_EXEC - when: manual + FDO_DISTRIBUTION_VERSION: 'rawhide' + FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FDO_DISTRIBUTION_EXEC: $FEDORA_EXEC -tier2:ubuntu:22.04@prep: +tier1:centos:stream9@prep: extends: - - .fdo.container-build@ubuntu + - .fdo.container-build@centos stage: prep variables: GIT_STRATEGY: none - FDO_DISTRIBUTION_VERSION: '22.04' - FDO_DISTRIBUTION_TAG: $UBUNTU_TAG - FDO_DISTRIBUTION_EXEC: $UBUNTU_EXEC + FDO_DISTRIBUTION_VERSION: 'stream9' + FDO_DISTRIBUTION_TAG: $CENTOS_TAG + FDO_DISTRIBUTION_EXEC: $CENTOS_EXEC + +tier2:debian:sid@prep: + extends: + - .fdo.container-build@debian + stage: prep + variables: + GIT_STRATEGY: none + FDO_DISTRIBUTION_VERSION: 'sid' + FDO_DISTRIBUTION_TAG: $DEBIAN_TAG + FDO_DISTRIBUTION_EXEC: $DEBIAN_EXEC + when: manual + +tier2:debian:testing@prep: + extends: + - .fdo.container-build@debian + stage: prep + variables: + GIT_STRATEGY: none + FDO_DISTRIBUTION_VERSION: 'testing' + FDO_DISTRIBUTION_TAG: $DEBIAN_TAG + FDO_DISTRIBUTION_EXEC: $DEBIAN_EXEC when: manual tier2:ubuntu:devel@prep: @@ -162,7 +160,62 @@ tier2:ubuntu:devel@prep: FDO_DISTRIBUTION_EXEC: $UBUNTU_EXEC when: manual -tier2:ubuntu:rolling@prep: +tier2:alpine:edge@prep: + extends: + - .fdo.container-build@alpine + stage: prep + variables: + GIT_STRATEGY: none + FDO_DISTRIBUTION_VERSION: 'edge' + FDO_DISTRIBUTION_TAG: $ALPINE_TAG + FDO_DISTRIBUTION_EXEC: $ALPINE_EXEC + when: manual + +tier3:fedora:39@prep: + extends: + - .fdo.container-build@fedora + stage: prep + variables: + GIT_STRATEGY: none + FDO_DISTRIBUTION_VERSION: '39' + FDO_DISTRIBUTION_TAG: $FEDORA_TAG + FDO_DISTRIBUTION_EXEC: $FEDORA_EXEC + when: manual + +tier3:ubuntu:20.04@prep: + extends: + - .fdo.container-build@ubuntu + stage: prep + variables: + GIT_STRATEGY: none + FDO_DISTRIBUTION_VERSION: '20.04' + FDO_DISTRIBUTION_TAG: $UBUNTU_TAG + FDO_DISTRIBUTION_EXEC: $UBUNTU_EXEC + when: manual + +tier3:ubuntu:22.04@prep: + extends: + - .fdo.container-build@ubuntu + stage: prep + variables: + GIT_STRATEGY: none + FDO_DISTRIBUTION_VERSION: '22.04' + FDO_DISTRIBUTION_TAG: $UBUNTU_TAG + FDO_DISTRIBUTION_EXEC: $UBUNTU_EXEC + when: manual + +tier3:ubuntu:24.04@prep: + extends: + - .fdo.container-build@ubuntu + stage: prep + variables: + GIT_STRATEGY: none + FDO_DISTRIBUTION_VERSION: '24.04' + FDO_DISTRIBUTION_TAG: $UBUNTU_TAG + FDO_DISTRIBUTION_EXEC: $UBUNTU_EXEC + when: manual + +tier3:ubuntu:rolling@prep: extends: - .fdo.container-build@ubuntu stage: prep @@ -173,51 +226,29 @@ tier2:ubuntu:rolling@prep: FDO_DISTRIBUTION_EXEC: $UBUNTU_EXEC when: manual -tier2:debian:10@prep: +tier3:debian:stable@prep: extends: - .fdo.container-build@debian stage: prep variables: GIT_STRATEGY: none - FDO_DISTRIBUTION_VERSION: '10' + FDO_DISTRIBUTION_VERSION: 'stable' FDO_DISTRIBUTION_TAG: $DEBIAN_TAG FDO_DISTRIBUTION_EXEC: $DEBIAN_EXEC when: manual -tier2:debian:11@prep: +tier3:debian:oldstable@prep: extends: - .fdo.container-build@debian stage: prep variables: GIT_STRATEGY: none - FDO_DISTRIBUTION_VERSION: '11' + FDO_DISTRIBUTION_VERSION: 'oldstable' FDO_DISTRIBUTION_TAG: $DEBIAN_TAG FDO_DISTRIBUTION_EXEC: $DEBIAN_EXEC when: manual -tier2:debian:sid@prep: - extends: - - .fdo.container-build@debian - stage: prep - variables: - GIT_STRATEGY: none - FDO_DISTRIBUTION_VERSION: 'sid' - FDO_DISTRIBUTION_TAG: $DEBIAN_TAG - FDO_DISTRIBUTION_EXEC: $DEBIAN_EXEC - when: manual - -tier3:debian:testing@prep: - extends: - - .fdo.container-build@debian - stage: prep - variables: - GIT_STRATEGY: none - FDO_DISTRIBUTION_VERSION: 'testing' - FDO_DISTRIBUTION_TAG: $DEBIAN_TAG - FDO_DISTRIBUTION_EXEC: $DEBIAN_EXEC - when: manual - -tier2:centos:stream8@prep: +tier3:centos:stream8@prep: extends: - .fdo.container-build@centos stage: prep @@ -228,18 +259,7 @@ tier2:centos:stream8@prep: FDO_DISTRIBUTION_EXEC: $CENTOS_EXEC when: manual -tier2:centos:stream9@prep: - extends: - - .fdo.container-build@centos - stage: prep - variables: - GIT_STRATEGY: none - FDO_DISTRIBUTION_VERSION: 'stream9' - FDO_DISTRIBUTION_TAG: $CENTOS_TAG - FDO_DISTRIBUTION_EXEC: $CENTOS_EXEC - when: manual - -tier2:alpine:latest@prep: +tier3:alpine:latest@prep: extends: - .fdo.container-build@alpine stage: prep @@ -266,7 +286,7 @@ tier2:alpine:latest@prep: dependencies: [] -t_fedora:39: +t_fedora:40: extends: - .build@template - .fdo.distribution-image@fedora @@ -285,107 +305,61 @@ t_fedora:39: - tarball+meson - tarball - subtree - variables: - FDO_DISTRIBUTION_VERSION: '39' - FDO_DISTRIBUTION_TAG: $FEDORA_TAG - needs: - - "tier1:fedora:39@prep" - -t_fedora:38: - extends: - - .build@template - - .fdo.distribution-image@fedora - - .nm_artifacts_debug - stage: tier2 - variables: - FDO_DISTRIBUTION_VERSION: '38' - FDO_DISTRIBUTION_TAG: $FEDORA_TAG - needs: - - "tier2:fedora:38@prep" - -t_fedora:40: - extends: - - .build@template - - .fdo.distribution-image@fedora - - .nm_artifacts_debug - stage: tier2 variables: FDO_DISTRIBUTION_VERSION: '40' FDO_DISTRIBUTION_TAG: $FEDORA_TAG needs: - - "tier2:fedora:40@prep" + - "tier1:fedora:40@prep" -t_ubuntu:20.04: +t_fedora:rawhide: extends: - .build@template - - .fdo.distribution-image@ubuntu - - .nm_artifacts_debug - stage: tier2 + - .fdo.distribution-image@fedora + - .nm_artifacts + stage: tier1 + parallel: + matrix: + - NM_TEST_SELECT_RUN: + - autotools+gcc+docs+valgrind + - meson+gcc+docs+valgrind + - autotools+clang + - meson+clang + - rpm+autotools + - rpm+meson + - tarball+autotools + - tarball+meson + - tarball + - subtree variables: - FDO_DISTRIBUTION_VERSION: '20.04' - FDO_DISTRIBUTION_TAG: $UBUNTU_TAG + FDO_DISTRIBUTION_VERSION: 'rawhide' + FDO_DISTRIBUTION_TAG: $FEDORA_TAG needs: - - "tier2:ubuntu:20.04@prep" + - "tier1:fedora:rawhide@prep" -t_ubuntu:22.04: +t_centos:stream9: extends: - .build@template - - .fdo.distribution-image@ubuntu + - .fdo.distribution-image@centos - .nm_artifacts_debug - stage: tier2 + stage: tier1 + parallel: + matrix: + - NM_TEST_SELECT_RUN: + - autotools+gcc+docs+valgrind + - meson+gcc+docs+valgrind + - autotools+clang + - meson+clang + - rpm+autotools + - rpm+meson + - tarball+autotools + - tarball+meson + - tarball + - subtree variables: - FDO_DISTRIBUTION_VERSION: '22.04' - FDO_DISTRIBUTION_TAG: $UBUNTU_TAG + FDO_DISTRIBUTION_VERSION: 'stream9' + FDO_DISTRIBUTION_TAG: $CENTOS_TAG needs: - - "tier2:ubuntu:22.04@prep" - -t_ubuntu:devel: - extends: - - .build@template - - .fdo.distribution-image@ubuntu - - .nm_artifacts_debug - stage: tier2 - variables: - FDO_DISTRIBUTION_VERSION: 'devel' - FDO_DISTRIBUTION_TAG: $UBUNTU_TAG - needs: - - "tier2:ubuntu:devel@prep" - -t_ubuntu:rolling: - extends: - - .build@template - - .fdo.distribution-image@ubuntu - - .nm_artifacts_debug - stage: tier2 - variables: - FDO_DISTRIBUTION_VERSION: 'rolling' - FDO_DISTRIBUTION_TAG: $UBUNTU_TAG - needs: - - "tier2:ubuntu:rolling@prep" - -t_debian:10: - extends: - - .build@template - - .fdo.distribution-image@debian - - .nm_artifacts_debug - stage: tier2 - variables: - FDO_DISTRIBUTION_VERSION: '10' - FDO_DISTRIBUTION_TAG: $DEBIAN_TAG - needs: - - "tier2:debian:10@prep" - -t_debian:11: - extends: - - .build@template - - .fdo.distribution-image@debian - - .nm_artifacts_debug - stage: tier2 - variables: - FDO_DISTRIBUTION_VERSION: '11' - FDO_DISTRIBUTION_TAG: $DEBIAN_TAG - needs: - - "tier2:debian:11@prep" + - "tier1:centos:stream9@prep" t_debian:sid: extends: @@ -404,48 +378,144 @@ t_debian:testing: - .build@template - .fdo.distribution-image@debian - .nm_artifacts_debug - stage: tier3 + stage: tier2 variables: FDO_DISTRIBUTION_VERSION: 'testing' FDO_DISTRIBUTION_TAG: $DEBIAN_TAG needs: - - "tier3:debian:testing@prep" + - "tier2:debian:testing@prep" -t_centos:stream8: +t_ubuntu:devel: extends: - .build@template - - .fdo.distribution-image@centos + - .fdo.distribution-image@ubuntu - .nm_artifacts_debug stage: tier2 variables: - FDO_DISTRIBUTION_VERSION: 'stream8' - FDO_DISTRIBUTION_TAG: $CENTOS_TAG + FDO_DISTRIBUTION_VERSION: 'devel' + FDO_DISTRIBUTION_TAG: $UBUNTU_TAG needs: - - "tier2:centos:stream8@prep" + - "tier2:ubuntu:devel@prep" -t_centos:stream9: - extends: - - .build@template - - .fdo.distribution-image@centos - - .nm_artifacts_debug - stage: tier2 - variables: - FDO_DISTRIBUTION_VERSION: 'stream9' - FDO_DISTRIBUTION_TAG: $CENTOS_TAG - needs: - - "tier2:centos:stream9@prep" - -t_alpine:latest: +t_alpine:edge: extends: - .build@template - .fdo.distribution-image@alpine - .nm_artifacts_debug stage: tier2 + variables: + FDO_DISTRIBUTION_VERSION: 'edge' + FDO_DISTRIBUTION_TAG: $ALPINE_TAG + needs: + - "tier2:alpine:edge@prep" + +t_fedora:39: + extends: + - .build@template + - .fdo.distribution-image@fedora + - .nm_artifacts_debug + stage: tier3 + variables: + FDO_DISTRIBUTION_VERSION: '39' + FDO_DISTRIBUTION_TAG: $FEDORA_TAG + needs: + - "tier3:fedora:39@prep" + +t_ubuntu:20.04: + extends: + - .build@template + - .fdo.distribution-image@ubuntu + - .nm_artifacts_debug + stage: tier3 + variables: + FDO_DISTRIBUTION_VERSION: '20.04' + FDO_DISTRIBUTION_TAG: $UBUNTU_TAG + needs: + - "tier3:ubuntu:20.04@prep" + +t_ubuntu:22.04: + extends: + - .build@template + - .fdo.distribution-image@ubuntu + - .nm_artifacts_debug + stage: tier3 + variables: + FDO_DISTRIBUTION_VERSION: '22.04' + FDO_DISTRIBUTION_TAG: $UBUNTU_TAG + needs: + - "tier3:ubuntu:22.04@prep" + +t_ubuntu:24.04: + extends: + - .build@template + - .fdo.distribution-image@ubuntu + - .nm_artifacts_debug + stage: tier3 + variables: + FDO_DISTRIBUTION_VERSION: '24.04' + FDO_DISTRIBUTION_TAG: $UBUNTU_TAG + needs: + - "tier3:ubuntu:24.04@prep" + +t_ubuntu:rolling: + extends: + - .build@template + - .fdo.distribution-image@ubuntu + - .nm_artifacts_debug + stage: tier3 + variables: + FDO_DISTRIBUTION_VERSION: 'rolling' + FDO_DISTRIBUTION_TAG: $UBUNTU_TAG + needs: + - "tier3:ubuntu:rolling@prep" + +t_debian:stable: + extends: + - .build@template + - .fdo.distribution-image@debian + - .nm_artifacts_debug + stage: tier3 + variables: + FDO_DISTRIBUTION_VERSION: 'stable' + FDO_DISTRIBUTION_TAG: $DEBIAN_TAG + needs: + - "tier3:debian:stable@prep" + +t_debian:oldstable: + extends: + - .build@template + - .fdo.distribution-image@debian + - .nm_artifacts_debug + stage: tier3 + variables: + FDO_DISTRIBUTION_VERSION: 'oldstable' + FDO_DISTRIBUTION_TAG: $DEBIAN_TAG + needs: + - "tier3:debian:oldstable@prep" + +t_centos:stream8: + extends: + - .build@template + - .fdo.distribution-image@centos + - .nm_artifacts_debug + stage: tier3 + variables: + FDO_DISTRIBUTION_VERSION: 'stream8' + FDO_DISTRIBUTION_TAG: $CENTOS_TAG + needs: + - "tier3:centos:stream8@prep" + +t_alpine:latest: + extends: + - .build@template + - .fdo.distribution-image@alpine + - .nm_artifacts_debug + stage: tier3 variables: FDO_DISTRIBUTION_VERSION: 'latest' FDO_DISTRIBUTION_TAG: $ALPINE_TAG needs: - - "tier2:alpine:latest@prep" + - "tier3:alpine:latest@prep" ################################################################# # # @@ -457,10 +527,10 @@ check-patch: extends: - .fdo.distribution-image@fedora variables: - FDO_DISTRIBUTION_VERSION: '39' + FDO_DISTRIBUTION_VERSION: '40' FDO_DISTRIBUTION_TAG: $FEDORA_TAG needs: - - "tier1:fedora:39@prep" + - "tier1:fedora:40@prep" stage: tier1 script: - date '+%Y%m%d-%H%M%S'; NM_CHECKPATCH_FETCH_UPSTREAM=1 contrib/scripts/checkpatch-feature-branch.sh @@ -470,10 +540,10 @@ check-tree: extends: - .fdo.distribution-image@fedora variables: - FDO_DISTRIBUTION_VERSION: '39' + FDO_DISTRIBUTION_VERSION: '40' FDO_DISTRIBUTION_TAG: $FEDORA_TAG needs: - - "tier1:fedora:39@prep" + - "tier1:fedora:40@prep" stage: tier1 script: - date '+%Y%m%d-%H%M%S'; clang-format --version @@ -495,9 +565,9 @@ pages: only: - main dependencies: - - "t_fedora:39: [autotools+gcc+docs+valgrind]" + - "t_fedora:40: [autotools+gcc+docs+valgrind]" needs: - - "t_fedora:39: [autotools+gcc+docs+valgrind]" + - "t_fedora:40: [autotools+gcc+docs+valgrind]" triage:issues: stage: triage diff --git a/.gitlab-ci/config.yml b/.gitlab-ci/config.yml index 3e83f48073..4e97ecf187 100644 --- a/.gitlab-ci/config.yml +++ b/.gitlab-ci/config.yml @@ -18,39 +18,57 @@ base_types: # The list of all distributions we want to create job for. distributions: + # TIER 1: CI run for all MRs. + # The first tier:1 in the list is used to build the pages and check-{tree,patch}. - name: fedora - # The first tier:1 in the list is used to build the pages and check-{tree,patch} tier: 1 versions: - - '39' - - name: fedora + - '40' + - rawhide + - name: centos + tier: 1 + versions: + - 'stream9' + + # TIER 2: distribution versions that will or might use the current NM version. + # Run when doing a release. + - name: debian tier: 2 versions: - - '38' - - '40' + - sid + - testing - name: ubuntu tier: 2 versions: - - '20.04' - - '22.04' - - 'devel' - - 'rolling' - - name: debian - tier: 2 - versions: - - '10' - - '11' - - 'sid' - - name: debian - tier: 3 - versions: - - 'testing' - - name: centos - tier: 2 - versions: - - 'stream8' - - 'stream9' + - devel - name: alpine tier: 2 + versions: + - edge + + # TIER 3: distribution versions not in EOL but don't use the current NM version. + # Run when doing a release, but a failure won't be blocking for the release. + - name: fedora + tier: 3 + versions: + - '39' + - name: ubuntu + tier: 3 + versions: + - '20.04' + - '22.04' + - '24.04' + - 'rolling' # latest non-LTS + - name: debian + tier: 3 + versions: + - 'stable' + - 'oldstable' + - name: centos + tier: 3 + versions: + - 'stream8' + - name: alpine + tier: 3 versions: - 'latest' From 56179465dfa375805af1f36e9012e9575516189f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Fri, 5 Apr 2024 08:20:02 +0200 Subject: [PATCH 2/2] Updated code format The CI will use Fedora 40 for code formatting check. Update the code formatting so it passes. --- src/core/devices/nm-device-factory.c | 3 +- src/core/devices/nm-device.c | 2 +- src/core/devices/wifi/nm-wifi-ap.c | 15 +++--- src/core/dhcp/nm-dhcp-client.c | 7 +-- src/core/ndisc/nm-ndisc.h | 2 +- src/core/nm-connectivity.h | 8 ++-- src/core/nm-core-utils.c | 3 +- src/core/nm-core-utils.h | 2 +- src/core/nm-manager.c | 7 +-- src/core/nm-types.h | 2 +- src/libnm-base/nm-base.h | 4 +- src/libnm-client-impl/nm-conn-utils.c | 4 +- src/libnm-client-impl/tests/test-libnm.c | 8 ++-- src/libnm-client-impl/tests/test-nm-client.c | 2 +- src/libnm-core-impl/nm-setting-private.h | 2 +- src/libnm-core-impl/nm-team-utils.c | 48 ++++++++++---------- src/libnm-core-impl/nm-utils.c | 3 +- src/libnm-crypto/nm-crypto.c | 10 ++-- src/libnm-glib-aux/nm-macros-internal.h | 6 +-- src/libnm-platform/nm-platform.c | 17 +++---- src/libnm-std-aux/nm-linux-compat.h | 2 +- 21 files changed, 82 insertions(+), 75 deletions(-) diff --git a/src/core/devices/nm-device-factory.c b/src/core/devices/nm-device-factory.c index 69c2a38f13..22c8fa5aa5 100644 --- a/src/core/devices/nm-device-factory.c +++ b/src/core/devices/nm-device-factory.c @@ -183,7 +183,8 @@ nm_device_factory_class_init(NMDeviceFactoryClass *klass) static GHashTable *factories_by_link = NULL; static GHashTable *factories_by_setting = NULL; -static void __attribute__((destructor)) _cleanup(void) +static void __attribute__((destructor)) +_cleanup(void) { nm_clear_pointer(&factories_by_link, g_hash_table_unref); nm_clear_pointer(&factories_by_setting, g_hash_table_unref); diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index b26b13e861..5b377529f8 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -15693,7 +15693,7 @@ nm_device_update_firewall_zone(NMDevice *self) void nm_device_update_metered(NMDevice *self) { -#define NM_METERED_INVALID ((NMMetered) -1) +#define NM_METERED_INVALID ((NMMetered) - 1) NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self); NMSettingConnection *setting; NMMetered conn_value, value = NM_METERED_INVALID; diff --git a/src/core/devices/wifi/nm-wifi-ap.c b/src/core/devices/wifi/nm-wifi-ap.c index d4d3815e7a..ceb954b797 100644 --- a/src/core/devices/wifi/nm-wifi-ap.c +++ b/src/core/devices/wifi/nm-wifi-ap.c @@ -719,13 +719,14 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) g_value_set_uchar(value, priv->strength); break; case PROP_LAST_SEEN: - g_value_set_int(value, - priv->last_seen_msec != G_MININT64 ? (int) NM_MAX( - nm_utils_monotonic_timestamp_as_boottime(priv->last_seen_msec, - NM_UTILS_NSEC_PER_MSEC) - / 1000, - 1) - : -1); + g_value_set_int( + value, + priv->last_seen_msec != G_MININT64 + ? (int) NM_MAX(nm_utils_monotonic_timestamp_as_boottime(priv->last_seen_msec, + NM_UTILS_NSEC_PER_MSEC) + / 1000, + 1) + : -1); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); diff --git a/src/core/dhcp/nm-dhcp-client.c b/src/core/dhcp/nm-dhcp-client.c index 8770656b73..4ebc17543f 100644 --- a/src/core/dhcp/nm-dhcp-client.c +++ b/src/core/dhcp/nm-dhcp-client.c @@ -824,9 +824,10 @@ _nm_dhcp_client_notify(NMDhcpClient *self, _acd_check_lease(self, &acd_state); - options = priv->l3cd_next ? nm_dhcp_lease_get_options( - nm_l3_config_data_get_dhcp_lease(priv->l3cd_next, priv->config.addr_family)) - : NULL; + options = priv->l3cd_next + ? nm_dhcp_lease_get_options( + nm_l3_config_data_get_dhcp_lease(priv->l3cd_next, priv->config.addr_family)) + : NULL; if (_LOGI_ENABLED()) { const char *req_str = diff --git a/src/core/ndisc/nm-ndisc.h b/src/core/ndisc/nm-ndisc.h index 8f1a12a267..b8f8b06eed 100644 --- a/src/core/ndisc/nm-ndisc.h +++ b/src/core/ndisc/nm-ndisc.h @@ -40,7 +40,7 @@ typedef enum { const char *nm_ndisc_dhcp_level_to_string(NMNDiscDHCPLevel level); -#define NM_NDISC_INFINITY_U32 ((uint32_t) -1) +#define NM_NDISC_INFINITY_U32 ((uint32_t) - 1) /* It's important that this is G_MAXINT64, so that we can meaningfully do * MIN(e1, e2) to find the minimum expiry time (and properly handle if any diff --git a/src/core/nm-connectivity.h b/src/core/nm-connectivity.h index d9ea95c269..e0353f9fd9 100644 --- a/src/core/nm-connectivity.h +++ b/src/core/nm-connectivity.h @@ -25,10 +25,10 @@ nm_connectivity_state_cmp(NMConnectivityState a, NMConnectivityState b) /*****************************************************************************/ -#define NM_CONNECTIVITY_ERROR ((NMConnectivityState) -1) -#define NM_CONNECTIVITY_FAKE ((NMConnectivityState) -2) -#define NM_CONNECTIVITY_CANCELLED ((NMConnectivityState) -3) -#define NM_CONNECTIVITY_DISPOSING ((NMConnectivityState) -4) +#define NM_CONNECTIVITY_ERROR ((NMConnectivityState) - 1) +#define NM_CONNECTIVITY_FAKE ((NMConnectivityState) - 2) +#define NM_CONNECTIVITY_CANCELLED ((NMConnectivityState) - 3) +#define NM_CONNECTIVITY_DISPOSING ((NMConnectivityState) - 4) #define NM_TYPE_CONNECTIVITY (nm_connectivity_get_type()) #define NM_CONNECTIVITY(obj) \ diff --git a/src/core/nm-core-utils.c b/src/core/nm-core-utils.c index 178ea3c4c6..dd1e9939d9 100644 --- a/src/core/nm-core-utils.c +++ b/src/core/nm-core-utils.c @@ -121,7 +121,8 @@ _nm_singleton_instance_weak_cb(gpointer data, GObject *where_the_object_was) _singletons = g_slist_remove(_singletons, where_the_object_was); } -static void __attribute__((destructor)) _nm_singleton_instance_destroy(void) +static void __attribute__((destructor)) +_nm_singleton_instance_destroy(void) { _singletons_shutdown = TRUE; diff --git a/src/core/nm-core-utils.h b/src/core/nm-core-utils.h index f015236de8..fdfed5f65d 100644 --- a/src/core/nm-core-utils.h +++ b/src/core/nm-core-utils.h @@ -306,7 +306,7 @@ typedef enum { NM_UTILS_STABLE_TYPE_RANDOM = 3, } NMUtilsStableType; -#define NM_UTILS_STABLE_TYPE_NONE ((NMUtilsStableType) -1) +#define NM_UTILS_STABLE_TYPE_NONE ((NMUtilsStableType) - 1) NMUtilsStableType nm_utils_stable_id_parse(const char *stable_id, const char *deviceid, diff --git a/src/core/nm-manager.c b/src/core/nm-manager.c index 198b7e14c4..b2a827e38b 100644 --- a/src/core/nm-manager.c +++ b/src/core/nm-manager.c @@ -9045,9 +9045,10 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) case PROP_CHECKPOINTS: g_value_take_boxed( value, - priv->checkpoint_mgr ? nm_strv_make_deep_copied( - nm_checkpoint_manager_get_checkpoint_paths(priv->checkpoint_mgr, NULL)) - : NULL); + priv->checkpoint_mgr + ? nm_strv_make_deep_copied( + nm_checkpoint_manager_get_checkpoint_paths(priv->checkpoint_mgr, NULL)) + : NULL); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); diff --git a/src/core/nm-types.h b/src/core/nm-types.h index 29b391fc88..6dfdc8e240 100644 --- a/src/core/nm-types.h +++ b/src/core/nm-types.h @@ -96,6 +96,6 @@ typedef struct _NMSecretAgent NMSecretAgent; typedef struct _NMSettings NMSettings; typedef struct _NMSettingsConnection NMSettingsConnection; -#define NM_SETTING_CONNECTION_MDNS_UNKNOWN ((NMSettingConnectionMdns) -42) +#define NM_SETTING_CONNECTION_MDNS_UNKNOWN ((NMSettingConnectionMdns) - 42) #endif /* NM_TYPES_H */ diff --git a/src/libnm-base/nm-base.h b/src/libnm-base/nm-base.h index e1cc27332e..4b1bff547c 100644 --- a/src/libnm-base/nm-base.h +++ b/src/libnm-base/nm-base.h @@ -147,8 +147,8 @@ typedef enum { _NM_ETHTOOL_ID_NUM = (_NM_ETHTOOL_ID_LAST - _NM_ETHTOOL_ID_FIRST + 1), } NMEthtoolID; -#define _NM_ETHTOOL_ID_FEATURE_AS_IDX(ethtool_id) ((ethtool_id) -_NM_ETHTOOL_ID_FEATURE_FIRST) -#define _NM_ETHTOOL_ID_COALESCE_AS_IDX(ethtool_id) ((ethtool_id) -_NM_ETHTOOL_ID_COALESCE_FIRST) +#define _NM_ETHTOOL_ID_FEATURE_AS_IDX(ethtool_id) ((ethtool_id) - _NM_ETHTOOL_ID_FEATURE_FIRST) +#define _NM_ETHTOOL_ID_COALESCE_AS_IDX(ethtool_id) ((ethtool_id) - _NM_ETHTOOL_ID_COALESCE_FIRST) typedef enum { NM_ETHTOOL_TYPE_UNKNOWN, diff --git a/src/libnm-client-impl/nm-conn-utils.c b/src/libnm-client-impl/nm-conn-utils.c index 08f8403c07..e548a96185 100644 --- a/src/libnm-client-impl/nm-conn-utils.c +++ b/src/libnm-client-impl/nm-conn-utils.c @@ -194,8 +194,8 @@ nm_conn_wireguard_import(const char *filename, GError **error) * This code here instead generates a NetworkManager connection profile so that * NetworkManager will apply a similar configuration when later activating the profile. */ -#define _TABLE_AUTO ((gint64) -1) -#define _TABLE_OFF ((gint64) -2) +#define _TABLE_AUTO ((gint64) - 1) +#define _TABLE_OFF ((gint64) - 2) data_table = _TABLE_AUTO; diff --git a/src/libnm-client-impl/tests/test-libnm.c b/src/libnm-client-impl/tests/test-libnm.c index 59774f966b..687e6c1717 100644 --- a/src/libnm-client-impl/tests/test-libnm.c +++ b/src/libnm-client-impl/tests/test-libnm.c @@ -2397,10 +2397,10 @@ _do_read_vpn_details_impl1(const char *file, g_print(">>>> n_read=%zd; \"%s\"", n_read, - n_read > 0 ? ( - ss = nm_utils_buf_utf8safe_escape_cp(read_buf, - n_read, - NM_UTILS_STR_UTF8_SAFE_FLAG_ESCAPE_CTRL)) + n_read > 0 ? (ss = nm_utils_buf_utf8safe_escape_cp( + read_buf, + n_read, + NM_UTILS_STR_UTF8_SAFE_FLAG_ESCAPE_CTRL)) : ""); } diff --git a/src/libnm-client-impl/tests/test-nm-client.c b/src/libnm-client-impl/tests/test-nm-client.c index 216e3e426c..3d52732456 100644 --- a/src/libnm-client-impl/tests/test-nm-client.c +++ b/src/libnm-client-impl/tests/test-nm-client.c @@ -1023,7 +1023,7 @@ _test_connection_invalid_find_connections(gpointer element, gpointer needle, gpo G_STMT_START \ { \ g_assert_cmpint(idx[i], >=, 0); \ - g_assert(path##i &&*path##i); \ + g_assert(path##i && *path##i); \ g_assert(NM_IS_REMOTE_CONNECTION(connections->pdata[idx[i]])); \ g_assert_cmpstr(nm_connection_get_path(connections->pdata[idx[i]]), ==, path##i); \ } \ diff --git a/src/libnm-core-impl/nm-setting-private.h b/src/libnm-core-impl/nm-setting-private.h index f784fc0eec..a1ae6825ed 100644 --- a/src/libnm-core-impl/nm-setting-private.h +++ b/src/libnm-core-impl/nm-setting-private.h @@ -755,7 +755,7 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p !NM_FLAGS_ANY((param_flags), \ ~(NM_SETTING_PARAM_FUZZY_IGNORE | NM_SETTING_PARAM_INFERRABLE))); \ G_STATIC_ASSERT((min_value) <= (default_value)); \ - G_STATIC_ASSERT((default_value) == 0 || (default_value) -1u < (max_value)); \ + G_STATIC_ASSERT((default_value) == 0 || (default_value) - 1u < (max_value)); \ G_STATIC_ASSERT((max_value) <= G_MAXUINT64); \ \ _param_spec = g_param_spec_uint64("" prop_name "", \ diff --git a/src/libnm-core-impl/nm-team-utils.c b/src/libnm-core-impl/nm-team-utils.c index 21562163d2..83452569b0 100644 --- a/src/libnm-core-impl/nm-team-utils.c +++ b/src/libnm-core-impl/nm-team-utils.c @@ -172,17 +172,17 @@ static const TeamAttrData team_attr_datas[] = { #define _VAL_INT32_RANGE(_default, _min, _max) \ _VAL_INT32(_default), .has_range = TRUE, \ - .range.r_int32 = { \ - .min = _min, \ - .max = _max, \ + .range.r_int32 = { \ + .min = _min, \ + .max = _max, \ } #define _VAL_STRING() .default_val.v_string = NULL -#define _VAL_STRING_RANGE(_valid_names) \ - _VAL_STRING(), .has_range = TRUE, \ - .range.r_string = { \ - .valid_names = (_valid_names), \ +#define _VAL_STRING_RANGE(_valid_names) \ + _VAL_STRING(), .has_range = TRUE, \ + .range.r_string = { \ + .valid_names = (_valid_names), \ } #define _VAL_UNSPEC() .default_val.v_string = (NULL) @@ -1957,23 +1957,23 @@ _js_parse_locate_keys(const NMJsonVt *vt, nm_assert(vt); -#define _handle(_self, _cur_key, _cur_val, _keys, _level, _found_keys, _out_unrecognized_content) \ - ({ \ - const TeamAttrData *_attr_data; \ - gboolean _handled = FALSE; \ - \ - (_keys)[(_level) -1] = (_cur_key); \ - _attr_data = _attr_data_find_by_json_key((_self)->d.is_port, (_keys), (_level)); \ - if (_attr_data && _attr_data->js_keys_len == (_level)) { \ - if ((_found_keys)[_attr_data->team_attr]) \ - *(_out_unrecognized_content) = TRUE; \ - (_found_keys)[_attr_data->team_attr] = (_cur_val); \ - _handled = TRUE; \ - } else if (!_attr_data || !nm_json_is_object((_cur_val))) { \ - *(_out_unrecognized_content) = TRUE; \ - _handled = TRUE; \ - } \ - _handled; \ +#define _handle(_self, _cur_key, _cur_val, _keys, _level, _found_keys, _out_unrecognized_content) \ + ({ \ + const TeamAttrData *_attr_data; \ + gboolean _handled = FALSE; \ + \ + (_keys)[(_level) - 1] = (_cur_key); \ + _attr_data = _attr_data_find_by_json_key((_self)->d.is_port, (_keys), (_level)); \ + if (_attr_data && _attr_data->js_keys_len == (_level)) { \ + if ((_found_keys)[_attr_data->team_attr]) \ + *(_out_unrecognized_content) = TRUE; \ + (_found_keys)[_attr_data->team_attr] = (_cur_val); \ + _handled = TRUE; \ + } else if (!_attr_data || !nm_json_is_object((_cur_val))) { \ + *(_out_unrecognized_content) = TRUE; \ + _handled = TRUE; \ + } \ + _handled; \ }) nm_json_object_foreach (vt, root_js_obj, cur_key1, cur_val1) { diff --git a/src/libnm-core-impl/nm-utils.c b/src/libnm-core-impl/nm-utils.c index 761f74bdf1..b6e2414106 100644 --- a/src/libnm-core-impl/nm-utils.c +++ b/src/libnm-core-impl/nm-utils.c @@ -506,7 +506,8 @@ nmtst_system_encodings_get(void) /*****************************************************************************/ -static void __attribute__((constructor)) _nm_utils_init(void) +static void __attribute__((constructor)) +_nm_utils_init(void) { static int initialized = 0; diff --git a/src/libnm-crypto/nm-crypto.c b/src/libnm-crypto/nm-crypto.c index 7fcff4a9f7..883cf3c9cd 100644 --- a/src/libnm-crypto/nm-crypto.c +++ b/src/libnm-crypto/nm-crypto.c @@ -47,11 +47,11 @@ static const NMCryptoCipherInfo cipher_infos[] = { #define _CI(_cipher, _name, _digest_len, _real_iv_len) \ - [(_cipher) -1] = {.cipher = _cipher, \ - .name = ""_name \ - "", \ - .digest_len = _digest_len, \ - .real_iv_len = _real_iv_len} + [(_cipher) - 1] = {.cipher = _cipher, \ + .name = ""_name \ + "", \ + .digest_len = _digest_len, \ + .real_iv_len = _real_iv_len} _CI(NM_CRYPTO_CIPHER_DES_EDE3_CBC, "DES-EDE3-CBC", 24, 8), _CI(NM_CRYPTO_CIPHER_DES_CBC, "DES-CBC", 8, 8), _CI(NM_CRYPTO_CIPHER_AES_128_CBC, "AES-128-CBC", 16, 16), diff --git a/src/libnm-glib-aux/nm-macros-internal.h b/src/libnm-glib-aux/nm-macros-internal.h index 1c8c85e668..0b39271e1e 100644 --- a/src/libnm-glib-aux/nm-macros-internal.h +++ b/src/libnm-glib-aux/nm-macros-internal.h @@ -964,8 +964,8 @@ nm_g_variant_equal(GVariant *a, GVariant *b) /* check if @flags has exactly one flag (@check) set. You should call this * only with @check being a compile time constant and a power of two. */ -#define NM_FLAGS_HAS(flags, check) \ - (G_STATIC_ASSERT_EXPR((check) > 0 && ((check) & ((check) -1)) == 0), \ +#define NM_FLAGS_HAS(flags, check) \ + (G_STATIC_ASSERT_EXPR((check) > 0 && ((check) & ((check) - 1)) == 0), \ NM_FLAGS_ANY((flags), (check))) #define NM_FLAGS_ANY(flags, check) (((flags) & (check)) != 0) @@ -1695,7 +1695,7 @@ nm_decode_version(guint version, guint *major, guint *minor, guint *micro) /*****************************************************************************/ -#define NM_PID_T_INVAL ((pid_t) -1) +#define NM_PID_T_INVAL ((pid_t) - 1) /*****************************************************************************/ diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c index b89b035925..cd5a54bb87 100644 --- a/src/libnm-platform/nm-platform.c +++ b/src/libnm-platform/nm-platform.c @@ -6147,9 +6147,9 @@ nm_platform_link_to_string(const NMPlatformLink *link, char *buf, gsize len) link->initialized ? " init" : " not-init", link->inet6_addr_gen_mode_inv ? " addrgenmode " : "", link->inet6_addr_gen_mode_inv ? nm_platform_link_inet6_addrgenmode2str( - _nm_platform_uint8_inv(link->inet6_addr_gen_mode_inv), - str_addrmode, - sizeof(str_addrmode)) + _nm_platform_uint8_inv(link->inet6_addr_gen_mode_inv), + str_addrmode, + sizeof(str_addrmode)) : "", str_address[0] ? " addr " : "", str_address[0] ? str_address : "", @@ -7385,11 +7385,12 @@ nm_platform_ip6_route_to_string(const NMPlatformIP6Route *route, char *buf, gsiz route->lock_mtu ? "lock " : "", route->mtu) : "", - route->rt_pref ? nm_sprintf_buf( - str_pref, - " pref %s", - nm_icmpv6_router_pref_to_string(route->rt_pref, str_pref2, sizeof(str_pref2))) - : ""); + route->rt_pref + ? nm_sprintf_buf( + str_pref, + " pref %s", + nm_icmpv6_router_pref_to_string(route->rt_pref, str_pref2, sizeof(str_pref2))) + : ""); return buf; } diff --git a/src/libnm-std-aux/nm-linux-compat.h b/src/libnm-std-aux/nm-linux-compat.h index 2b04b0dfb6..9bfdb36562 100644 --- a/src/libnm-std-aux/nm-linux-compat.h +++ b/src/libnm-std-aux/nm-linux-compat.h @@ -16,7 +16,7 @@ #include #ifndef __KERNEL_DIV_ROUND_UP -#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) -1) / (d)) +#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) #endif #include "linux-headers/ethtool.h"