mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 12:40:11 +01:00
build: merge branch 'th/update-to-fedora38'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1634
This commit is contained in:
commit
e1ef6dad8a
16 changed files with 190 additions and 172 deletions
|
|
@ -7,3 +7,4 @@
|
|||
740b092fda3d5f45102422f22884c88ea6c42858
|
||||
d8a4b3bec28c48b3b9f2ed7d499922376a2e05c3
|
||||
3fb8c0f614ab0cb3da649e6ca275abfa7ffc9a34
|
||||
c275d24637ce5c35c312fbff76b9adac4cbb099f
|
||||
|
|
|
|||
127
.gitlab-ci.yml
127
.gitlab-ci.yml
|
|
@ -13,7 +13,7 @@
|
|||
########################################
|
||||
|
||||
|
||||
.templates_sha: &template_sha ffe4d1b10aab7534489f0c4bbc4c5899df17d3f2 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
|
||||
.templates_sha: &template_sha fb33e1b244ec2a0b8edf8ee5590a96369c3b4666 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
|
||||
|
||||
|
||||
|
||||
|
|
@ -56,11 +56,11 @@ variables:
|
|||
#
|
||||
# This is done by running `ci-fairy generate-template` and possibly bumping
|
||||
# ".default_tag".
|
||||
ALPINE_TAG: 'tag-372c77b49d01'
|
||||
CENTOS_TAG: 'tag-ab77da6a62d5'
|
||||
DEBIAN_TAG: 'tag-e7368fd611d6'
|
||||
FEDORA_TAG: 'tag-ab77da6a62d5'
|
||||
UBUNTU_TAG: 'tag-e7368fd611d6'
|
||||
ALPINE_TAG: 'tag-8399f83819ed'
|
||||
CENTOS_TAG: 'tag-a5e8e3d94c70'
|
||||
DEBIAN_TAG: 'tag-f97319c5ab59'
|
||||
FEDORA_TAG: 'tag-a5e8e3d94c70'
|
||||
UBUNTU_TAG: 'tag-f97319c5ab59'
|
||||
|
||||
ALPINE_EXEC: 'bash .gitlab-ci/alpine-install.sh'
|
||||
CENTOS_EXEC: 'bash .gitlab-ci/fedora-install.sh'
|
||||
|
|
@ -96,7 +96,17 @@ variables:
|
|||
# Build a container for each distribution + version. The ci-templates
|
||||
# will re-use the containers if the tag doesn't change.
|
||||
|
||||
tier1:fedora:37@prep:
|
||||
tier1: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
|
||||
|
||||
tier2:fedora:37@prep:
|
||||
extends:
|
||||
- .fdo.container-build@fedora
|
||||
stage: prep
|
||||
|
|
@ -105,25 +115,15 @@ tier1:fedora:37@prep:
|
|||
FDO_DISTRIBUTION_VERSION: '37'
|
||||
FDO_DISTRIBUTION_TAG: $FEDORA_TAG
|
||||
FDO_DISTRIBUTION_EXEC: $FEDORA_EXEC
|
||||
|
||||
tier2:fedora:36@prep:
|
||||
extends:
|
||||
- .fdo.container-build@fedora
|
||||
stage: prep
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
FDO_DISTRIBUTION_VERSION: '36'
|
||||
FDO_DISTRIBUTION_TAG: $FEDORA_TAG
|
||||
FDO_DISTRIBUTION_EXEC: $FEDORA_EXEC
|
||||
when: manual
|
||||
|
||||
tier2:fedora:38@prep:
|
||||
tier2:fedora:39@prep:
|
||||
extends:
|
||||
- .fdo.container-build@fedora
|
||||
stage: prep
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
FDO_DISTRIBUTION_VERSION: '38'
|
||||
FDO_DISTRIBUTION_VERSION: '39'
|
||||
FDO_DISTRIBUTION_TAG: $FEDORA_TAG
|
||||
FDO_DISTRIBUTION_EXEC: $FEDORA_EXEC
|
||||
when: manual
|
||||
|
|
@ -194,6 +194,17 @@ tier3:fedora:35@prep:
|
|||
FDO_DISTRIBUTION_EXEC: $FEDORA_EXEC
|
||||
when: manual
|
||||
|
||||
tier3:fedora:36@prep:
|
||||
extends:
|
||||
- .fdo.container-build@fedora
|
||||
stage: prep
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
FDO_DISTRIBUTION_VERSION: '36'
|
||||
FDO_DISTRIBUTION_TAG: $FEDORA_TAG
|
||||
FDO_DISTRIBUTION_EXEC: $FEDORA_EXEC
|
||||
when: manual
|
||||
|
||||
tier2:ubuntu:18.04@prep:
|
||||
extends:
|
||||
- .fdo.container-build@ubuntu
|
||||
|
|
@ -419,7 +430,7 @@ tier2:alpine:latest@prep:
|
|||
dependencies: []
|
||||
|
||||
|
||||
t_fedora:37:
|
||||
t_fedora:38:
|
||||
extends:
|
||||
- .build@template
|
||||
- .fdo.distribution-image@fedora
|
||||
|
|
@ -436,35 +447,35 @@ t_fedora:37:
|
|||
- rpm+meson
|
||||
- tarball
|
||||
- subtree
|
||||
variables:
|
||||
FDO_DISTRIBUTION_VERSION: '37'
|
||||
FDO_DISTRIBUTION_TAG: $FEDORA_TAG
|
||||
needs:
|
||||
- "tier1:fedora:37@prep"
|
||||
|
||||
t_fedora:36:
|
||||
extends:
|
||||
- .build@template
|
||||
- .fdo.distribution-image@fedora
|
||||
- .nm_artifacts_debug
|
||||
stage: tier2
|
||||
variables:
|
||||
FDO_DISTRIBUTION_VERSION: '36'
|
||||
FDO_DISTRIBUTION_TAG: $FEDORA_TAG
|
||||
needs:
|
||||
- "tier2:fedora:36@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"
|
||||
- "tier1:fedora:38@prep"
|
||||
|
||||
t_fedora:37:
|
||||
extends:
|
||||
- .build@template
|
||||
- .fdo.distribution-image@fedora
|
||||
- .nm_artifacts_debug
|
||||
stage: tier2
|
||||
variables:
|
||||
FDO_DISTRIBUTION_VERSION: '37'
|
||||
FDO_DISTRIBUTION_TAG: $FEDORA_TAG
|
||||
needs:
|
||||
- "tier2:fedora:37@prep"
|
||||
|
||||
t_fedora:39:
|
||||
extends:
|
||||
- .build@template
|
||||
- .fdo.distribution-image@fedora
|
||||
- .nm_artifacts_debug
|
||||
stage: tier2
|
||||
variables:
|
||||
FDO_DISTRIBUTION_VERSION: '39'
|
||||
FDO_DISTRIBUTION_TAG: $FEDORA_TAG
|
||||
needs:
|
||||
- "tier2:fedora:39@prep"
|
||||
|
||||
t_fedora:30:
|
||||
extends:
|
||||
|
|
@ -538,6 +549,18 @@ t_fedora:35:
|
|||
needs:
|
||||
- "tier3:fedora:35@prep"
|
||||
|
||||
t_fedora:36:
|
||||
extends:
|
||||
- .build@template
|
||||
- .fdo.distribution-image@fedora
|
||||
- .nm_artifacts_debug
|
||||
stage: tier3
|
||||
variables:
|
||||
FDO_DISTRIBUTION_VERSION: '36'
|
||||
FDO_DISTRIBUTION_TAG: $FEDORA_TAG
|
||||
needs:
|
||||
- "tier3:fedora:36@prep"
|
||||
|
||||
t_ubuntu:18.04:
|
||||
extends:
|
||||
- .build@template
|
||||
|
|
@ -776,10 +799,10 @@ check-patch:
|
|||
extends:
|
||||
- .fdo.distribution-image@fedora
|
||||
variables:
|
||||
FDO_DISTRIBUTION_VERSION: '37'
|
||||
FDO_DISTRIBUTION_VERSION: '38'
|
||||
FDO_DISTRIBUTION_TAG: $FEDORA_TAG
|
||||
needs:
|
||||
- "tier1:fedora:37@prep"
|
||||
- "tier1:fedora:38@prep"
|
||||
stage: tier1
|
||||
script:
|
||||
- date '+%Y%m%d-%H%M%S'; NM_CHECKPATCH_FETCH_UPSTREAM=1 contrib/scripts/checkpatch-feature-branch.sh
|
||||
|
|
@ -789,10 +812,10 @@ check-tree:
|
|||
extends:
|
||||
- .fdo.distribution-image@fedora
|
||||
variables:
|
||||
FDO_DISTRIBUTION_VERSION: '37'
|
||||
FDO_DISTRIBUTION_VERSION: '38'
|
||||
FDO_DISTRIBUTION_TAG: $FEDORA_TAG
|
||||
needs:
|
||||
- "tier1:fedora:37@prep"
|
||||
- "tier1:fedora:38@prep"
|
||||
stage: tier1
|
||||
script:
|
||||
- date '+%Y%m%d-%H%M%S'; contrib/scripts/nm-python-black-format.sh --check
|
||||
|
|
@ -811,9 +834,9 @@ pages:
|
|||
only:
|
||||
- main
|
||||
dependencies:
|
||||
- "t_fedora:37: [autotools+gcc+docs+valgrind]"
|
||||
- "t_fedora:38: [autotools+gcc+docs+valgrind]"
|
||||
needs:
|
||||
- "t_fedora:37: [autotools+gcc+docs+valgrind]"
|
||||
- "t_fedora:38: [autotools+gcc+docs+valgrind]"
|
||||
|
||||
triage:issues:
|
||||
stage: triage
|
||||
|
|
@ -829,4 +852,4 @@ triage:issues:
|
|||
workflow:
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
|
||||
- if: $CI_PIPELINE_SOURCE == 'push'
|
||||
- if: $CI_PIPELINE_SOURCE == 'push'
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
########################################
|
||||
|
||||
|
||||
.templates_sha: &template_sha ffe4d1b10aab7534489f0c4bbc4c5899df17d3f2 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
|
||||
.templates_sha: &template_sha fb33e1b244ec2a0b8edf8ee5590a96369c3b4666 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
|
||||
|
||||
{# Group distros by their common (name,) tuples.#}
|
||||
{% set distro_groups = [] %}
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@ distributions:
|
|||
# The first tier:1 in the list is used to build the pages and check-{tree,patch}
|
||||
tier: 1
|
||||
versions:
|
||||
- '37'
|
||||
- '38'
|
||||
- name: fedora
|
||||
tier: 2
|
||||
versions:
|
||||
- '36'
|
||||
- '38'
|
||||
- '37'
|
||||
- '39'
|
||||
- name: fedora
|
||||
tier: 3
|
||||
versions:
|
||||
|
|
@ -37,6 +37,7 @@ distributions:
|
|||
- '33'
|
||||
- '34'
|
||||
- '35'
|
||||
- '36'
|
||||
- name: ubuntu
|
||||
tier: 2
|
||||
versions:
|
||||
|
|
|
|||
|
|
@ -85,7 +85,6 @@ install \
|
|||
teamd-devel \
|
||||
util-linux \
|
||||
vala \
|
||||
vala-devel \
|
||||
valgrind \
|
||||
which \
|
||||
"${EXTRA_PACKAGES[@]}"
|
||||
|
|
@ -98,9 +97,11 @@ install_ignore_missing \
|
|||
libasan \
|
||||
libpsl-devel \
|
||||
libubsan \
|
||||
libvala-devel \
|
||||
pexpect \
|
||||
pygobject3-base \
|
||||
python-gobject-base \
|
||||
python36-pexpect \
|
||||
qt-devel \
|
||||
vala-devel \
|
||||
#end
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ die() {
|
|||
DIR="$(realpath "$(dirname "$0")/../../")"
|
||||
cd "$DIR"
|
||||
|
||||
FEDORA_VERSION=37
|
||||
FEDORA_VERSION=38
|
||||
|
||||
PODNAME="nm-code-format-f$FEDORA_VERSION"
|
||||
|
||||
|
|
|
|||
|
|
@ -208,8 +208,7 @@ NMDevice *nm_device_factory_create_device(NMDeviceFactory *factory,
|
|||
\
|
||||
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) \
|
||||
{ \
|
||||
|
|
|
|||
|
|
@ -11,12 +11,10 @@
|
|||
#if !_NM_CC_SUPPORT_GENERIC
|
||||
#define _NM_DEVICE_CAST(self) ((NMDevice *) (self))
|
||||
#elif !defined(_NMLOG_DEVICE_TYPE)
|
||||
#define _NM_DEVICE_CAST(self) _Generic((self), NMDevice * : ((NMDevice *) (self)))
|
||||
#define _NM_DEVICE_CAST(self) _Generic((self), NMDevice *: ((NMDevice *) (self)))
|
||||
#else
|
||||
#define _NM_DEVICE_CAST(self) \
|
||||
_Generic((self), _NMLOG_DEVICE_TYPE * \
|
||||
: ((NMDevice *) (self)), NMDevice * \
|
||||
: ((NMDevice *) (self)))
|
||||
#define _NM_DEVICE_CAST(self) \
|
||||
_Generic((self), _NMLOG_DEVICE_TYPE *: ((NMDevice *) (self)), NMDevice *: ((NMDevice *) (self)))
|
||||
#endif
|
||||
|
||||
#undef _NMLOG_ENABLED
|
||||
|
|
|
|||
|
|
@ -262,18 +262,17 @@ _nmtst_auto_utils_host_id_context_pop(const char *const *unused)
|
|||
nmtst_utils_host_id_pop();
|
||||
}
|
||||
|
||||
#define _NMTST_UTILS_HOST_ID_CONTEXT(uniq, host_id) \
|
||||
_nm_unused nm_auto(_nmtst_auto_utils_host_id_context_pop) const char *const NM_UNIQ_T( \
|
||||
_host_id_context_, \
|
||||
uniq) = ({ \
|
||||
const gint64 _timestamp_ns = 1631000672; \
|
||||
\
|
||||
nmtst_utils_host_id_push((const guint8 *) "" host_id "", \
|
||||
NM_STRLEN(host_id), \
|
||||
TRUE, \
|
||||
&_timestamp_ns); \
|
||||
"" host_id ""; \
|
||||
})
|
||||
#define _NMTST_UTILS_HOST_ID_CONTEXT(uniq, host_id) \
|
||||
_nm_unused nm_auto(_nmtst_auto_utils_host_id_context_pop) \
|
||||
const char *const NM_UNIQ_T(_host_id_context_, uniq) = ({ \
|
||||
const gint64 _timestamp_ns = 1631000672; \
|
||||
\
|
||||
nmtst_utils_host_id_push((const guint8 *) "" host_id "", \
|
||||
NM_STRLEN(host_id), \
|
||||
TRUE, \
|
||||
&_timestamp_ns); \
|
||||
"" host_id ""; \
|
||||
})
|
||||
|
||||
#define NMTST_UTILS_HOST_ID_CONTEXT(host_id) _NMTST_UTILS_HOST_ID_CONTEXT(NM_UNIQ, host_id)
|
||||
|
||||
|
|
|
|||
|
|
@ -500,7 +500,7 @@ _nm_g_variant_new_take_string(char *string)
|
|||
return value;
|
||||
#elif !GLIB_CHECK_VERSION(2, 38, 0)
|
||||
GVariant *value;
|
||||
GBytes *bytes;
|
||||
GBytes *bytes;
|
||||
|
||||
g_return_val_if_fail(string != NULL, NULL);
|
||||
g_return_val_if_fail(g_utf8_validate(string, -1, NULL), NULL);
|
||||
|
|
|
|||
|
|
@ -185,10 +185,10 @@ nm_hash_update_str(NMHashState *state, const char *str)
|
|||
/* Like nm_hash_update_str(), but restricted to arrays only. nm_hash_update_str() only works
|
||||
* with a @str argument that cannot be NULL. If you have a string pointer, that is never NULL, use
|
||||
* nm_hash_update() instead. */
|
||||
#define nm_hash_update_strarr(state, str) \
|
||||
(_Generic(&(str), const char(*)[sizeof(str)] \
|
||||
: nm_hash_update_str((state), (str)), char(*)[sizeof(str)] \
|
||||
: nm_hash_update_str((state), (str))))
|
||||
#define nm_hash_update_strarr(state, str) \
|
||||
(_Generic(&(str), \
|
||||
const char(*)[sizeof(str)]: nm_hash_update_str((state), (str)), \
|
||||
char(*)[sizeof(str)]: nm_hash_update_str((state), (str))))
|
||||
#else
|
||||
#define nm_hash_update_strarr(state, str) nm_hash_update_str((state), (str))
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -259,41 +259,41 @@ NM_G_ERROR_MSG(GError *error)
|
|||
|
||||
#if _NM_CC_SUPPORT_GENERIC
|
||||
#define _NM_CONSTCAST_FULL_1(type, obj_expr, obj) \
|
||||
(_Generic ((obj_expr), \
|
||||
const void *: ((const type *) (obj)), \
|
||||
void *: (( type *) (obj)), \
|
||||
const type *: ((const type *) (obj)), \
|
||||
type *: (( type *) (obj))))
|
||||
(_Generic((obj_expr), \
|
||||
const void *: ((const type *) (obj)), \
|
||||
void *: ((type *) (obj)), \
|
||||
const type *: ((const type *) (obj)), \
|
||||
type *: ((type *) (obj))))
|
||||
#define _NM_CONSTCAST_FULL_2(type, obj_expr, obj, alias_type2) \
|
||||
(_Generic ((obj_expr), \
|
||||
const void *: ((const type *) (obj)), \
|
||||
void *: (( type *) (obj)), \
|
||||
const alias_type2 *: ((const type *) (obj)), \
|
||||
alias_type2 *: (( type *) (obj)), \
|
||||
const type *: ((const type *) (obj)), \
|
||||
type *: (( type *) (obj))))
|
||||
(_Generic((obj_expr), \
|
||||
const void *: ((const type *) (obj)), \
|
||||
void *: ((type *) (obj)), \
|
||||
const alias_type2 *: ((const type *) (obj)), \
|
||||
alias_type2 *: ((type *) (obj)), \
|
||||
const type *: ((const type *) (obj)), \
|
||||
type *: ((type *) (obj))))
|
||||
#define _NM_CONSTCAST_FULL_3(type, obj_expr, obj, alias_type2, alias_type3) \
|
||||
(_Generic ((obj_expr), \
|
||||
const void *: ((const type *) (obj)), \
|
||||
void *: (( type *) (obj)), \
|
||||
const alias_type2 *: ((const type *) (obj)), \
|
||||
alias_type2 *: (( type *) (obj)), \
|
||||
const alias_type3 *: ((const type *) (obj)), \
|
||||
alias_type3 *: (( type *) (obj)), \
|
||||
const type *: ((const type *) (obj)), \
|
||||
type *: (( type *) (obj))))
|
||||
(_Generic((obj_expr), \
|
||||
const void *: ((const type *) (obj)), \
|
||||
void *: ((type *) (obj)), \
|
||||
const alias_type2 *: ((const type *) (obj)), \
|
||||
alias_type2 *: ((type *) (obj)), \
|
||||
const alias_type3 *: ((const type *) (obj)), \
|
||||
alias_type3 *: ((type *) (obj)), \
|
||||
const type *: ((const type *) (obj)), \
|
||||
type *: ((type *) (obj))))
|
||||
#define _NM_CONSTCAST_FULL_4(type, obj_expr, obj, alias_type2, alias_type3, alias_type4) \
|
||||
(_Generic ((obj_expr), \
|
||||
const void *: ((const type *) (obj)), \
|
||||
void *: (( type *) (obj)), \
|
||||
const alias_type2 *: ((const type *) (obj)), \
|
||||
alias_type2 *: (( type *) (obj)), \
|
||||
const alias_type3 *: ((const type *) (obj)), \
|
||||
alias_type3 *: (( type *) (obj)), \
|
||||
const alias_type4 *: ((const type *) (obj)), \
|
||||
alias_type4 *: (( type *) (obj)), \
|
||||
const type *: ((const type *) (obj)), \
|
||||
type *: (( type *) (obj))))
|
||||
(_Generic((obj_expr), \
|
||||
const void *: ((const type *) (obj)), \
|
||||
void *: ((type *) (obj)), \
|
||||
const alias_type2 *: ((const type *) (obj)), \
|
||||
alias_type2 *: ((type *) (obj)), \
|
||||
const alias_type3 *: ((const type *) (obj)), \
|
||||
alias_type3 *: ((type *) (obj)), \
|
||||
const alias_type4 *: ((const type *) (obj)), \
|
||||
alias_type4 *: ((type *) (obj)), \
|
||||
const type *: ((const type *) (obj)), \
|
||||
type *: ((type *) (obj))))
|
||||
#define _NM_CONSTCAST_FULL_x(type, obj_expr, obj, n, ...) \
|
||||
(_NM_CONSTCAST_FULL_##n(type, obj_expr, obj, ##__VA_ARGS__))
|
||||
#define _NM_CONSTCAST_FULL_y(type, obj_expr, obj, n, ...) \
|
||||
|
|
@ -308,18 +308,18 @@ NM_G_ERROR_MSG(GError *error)
|
|||
|
||||
#if _NM_CC_SUPPORT_GENERIC
|
||||
#define NM_UNCONST_PTR(type, arg) \
|
||||
_Generic((arg), const type * : ((type *) (arg)), type * : ((type *) (arg)))
|
||||
_Generic((arg), const type *: ((type *) (arg)), type *: ((type *) (arg)))
|
||||
#else
|
||||
#define NM_UNCONST_PTR(type, arg) ((type *) (arg))
|
||||
#endif
|
||||
|
||||
#if _NM_CC_SUPPORT_GENERIC
|
||||
#define NM_UNCONST_PPTR(type, arg) \
|
||||
_Generic ((arg), \
|
||||
const type * *: ((type **) (arg)), \
|
||||
type * *: ((type **) (arg)), \
|
||||
const type *const*: ((type **) (arg)), \
|
||||
type *const*: ((type **) (arg)))
|
||||
#define NM_UNCONST_PPTR(type, arg) \
|
||||
_Generic((arg), \
|
||||
const type **: ((type **) (arg)), \
|
||||
type **: ((type **) (arg)), \
|
||||
const type *const *: ((type **) (arg)), \
|
||||
type *const *: ((type **) (arg)))
|
||||
#else
|
||||
#define NM_UNCONST_PPTR(type, arg) ((type **) (arg))
|
||||
#endif
|
||||
|
|
@ -377,30 +377,29 @@ NM_G_ERROR_MSG(GError *error)
|
|||
* These macros do the cast, but they only accept a compatible input
|
||||
* type, otherwise they will fail compilation.
|
||||
*/
|
||||
#define NM_CAST_STRV_MC(value) \
|
||||
(_Generic ((value), \
|
||||
const char * *: (const char * *) (value), \
|
||||
char * *: (const char * *) (value), \
|
||||
void *: (const char * *) (value)))
|
||||
#define NM_CAST_STRV_CC(value) \
|
||||
(_Generic ((value), \
|
||||
const char *const*: (const char *const*) (value), \
|
||||
const char * *: (const char *const*) (value), \
|
||||
char *const*: (const char *const*) (value), \
|
||||
char * *: (const char *const*) (value), \
|
||||
const void *: (const char *const*) (value), \
|
||||
void *: (const char *const*) (value)))
|
||||
#define NM_CAST_STRV_MC(value) \
|
||||
(_Generic((value), \
|
||||
const char **: (const char **) (value), \
|
||||
char **: (const char **) (value), \
|
||||
void *: (const char **) (value)))
|
||||
#define NM_CAST_STRV_CC(value) \
|
||||
(_Generic((value), \
|
||||
const char *const *: (const char *const *) (value), \
|
||||
const char **: (const char *const *) (value), \
|
||||
char *const *: (const char *const *) (value), \
|
||||
char **: (const char *const *) (value), \
|
||||
const void *: (const char *const *) (value), \
|
||||
void *: (const char *const *) (value)))
|
||||
#else
|
||||
#define NM_CAST_STRV_MC(value) ((const char **) (value))
|
||||
#define NM_CAST_STRV_CC(value) ((const char *const *) (value))
|
||||
#endif
|
||||
|
||||
#if _NM_CC_SUPPORT_GENERIC
|
||||
#define NM_PROPAGATE_CONST(test_expr, ptr) \
|
||||
(_Generic ((test_expr), \
|
||||
const typeof (*(test_expr)) *: ((const typeof (*(ptr)) *) (ptr)), \
|
||||
default: (_Generic ((test_expr), \
|
||||
typeof (*(test_expr)) *: (ptr)))))
|
||||
#define NM_PROPAGATE_CONST(test_expr, ptr) \
|
||||
(_Generic((test_expr), \
|
||||
const typeof(*(test_expr)) *: ((const typeof(*(ptr)) *) (ptr)), \
|
||||
default: (_Generic((test_expr), typeof(*(test_expr)) *: (ptr)))))
|
||||
#else
|
||||
#define NM_PROPAGATE_CONST(test_expr, ptr) (ptr)
|
||||
#endif
|
||||
|
|
@ -1499,23 +1498,21 @@ _nm_strndup_a_step(char *s, const char *str, gsize len)
|
|||
*
|
||||
* Instead, this generic macro is supposed to handle all integers correctly. */
|
||||
#if _NM_CC_SUPPORT_GENERIC
|
||||
#define nm_strdup_int(val) \
|
||||
_Generic((val), char \
|
||||
: g_strdup_printf("%d", (int) (val)), \
|
||||
\
|
||||
signed char \
|
||||
: g_strdup_printf("%d", (signed) (val)), signed short \
|
||||
: g_strdup_printf("%d", (signed) (val)), signed \
|
||||
: g_strdup_printf("%d", (signed) (val)), signed long \
|
||||
: g_strdup_printf("%ld", (signed long) (val)), signed long long \
|
||||
: g_strdup_printf("%lld", (signed long long) (val)), \
|
||||
\
|
||||
unsigned char \
|
||||
: g_strdup_printf("%u", (unsigned) (val)), unsigned short \
|
||||
: g_strdup_printf("%u", (unsigned) (val)), unsigned \
|
||||
: g_strdup_printf("%u", (unsigned) (val)), unsigned long \
|
||||
: g_strdup_printf("%lu", (unsigned long) (val)), unsigned long long \
|
||||
: g_strdup_printf("%llu", (unsigned long long) (val)))
|
||||
#define nm_strdup_int(val) \
|
||||
_Generic((val), \
|
||||
char: g_strdup_printf("%d", (int) (val)), \
|
||||
\
|
||||
signed char: g_strdup_printf("%d", (signed) (val)), \
|
||||
signed short: g_strdup_printf("%d", (signed) (val)), \
|
||||
signed: g_strdup_printf("%d", (signed) (val)), \
|
||||
signed long: g_strdup_printf("%ld", (signed long) (val)), \
|
||||
signed long long: g_strdup_printf("%lld", (signed long long) (val)), \
|
||||
\
|
||||
unsigned char: g_strdup_printf("%u", (unsigned) (val)), \
|
||||
unsigned short: g_strdup_printf("%u", (unsigned) (val)), \
|
||||
unsigned: g_strdup_printf("%u", (unsigned) (val)), \
|
||||
unsigned long: g_strdup_printf("%lu", (unsigned long) (val)), \
|
||||
unsigned long long: g_strdup_printf("%llu", (unsigned long long) (val)))
|
||||
#else
|
||||
#define nm_strdup_int(val) \
|
||||
((sizeof(val) == sizeof(guint64) && ((typeof(val)) -1) > 0) \
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ G_STATIC_ASSERT(sizeof(int) == sizeof(gint32));
|
|||
({ \
|
||||
_nm_unused typeof(value) _value = (value); \
|
||||
\
|
||||
_Generic((value), int : TRUE); \
|
||||
_Generic((value), int: TRUE); \
|
||||
})
|
||||
#else
|
||||
#define _NM_INT_LE_MAXINT32(value) \
|
||||
|
|
|
|||
|
|
@ -2887,8 +2887,7 @@ _nmtst_variant_new_vardict(int dummy, ...)
|
|||
G_STMT_END
|
||||
#else
|
||||
#define _nmtst_assert_variant_bytestring_cmp_str(_ptr, _ptr2, _len) \
|
||||
G_STMT_START \
|
||||
{} \
|
||||
G_STMT_START {} \
|
||||
G_STMT_END
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -93,19 +93,19 @@ struct nla_policy {
|
|||
|
||||
/* static asserts that @tb and @policy are suitable arguments to nla_parse(). */
|
||||
#if _NM_CC_SUPPORT_GENERIC
|
||||
#define _nl_static_assert_tb(tb, policy) \
|
||||
G_STMT_START \
|
||||
{ \
|
||||
G_STATIC_ASSERT_EXPR(G_N_ELEMENTS(tb) > 0); \
|
||||
\
|
||||
#define _nl_static_assert_tb(tb, policy) \
|
||||
G_STMT_START \
|
||||
{ \
|
||||
G_STATIC_ASSERT_EXPR(G_N_ELEMENTS(tb) > 0); \
|
||||
\
|
||||
/* We allow @policy to be either a C array or NULL. The sizeof()
|
||||
* must either match the expected array size or we check that
|
||||
* "policy" has typeof(NULL). This isn't a perfect compile time check,
|
||||
* but good enough. */ \
|
||||
G_STATIC_ASSERT_EXPR( \
|
||||
_Generic((policy), typeof(NULL) : 1, default \
|
||||
: (sizeof(policy) == G_N_ELEMENTS(tb) * sizeof(struct nla_policy)))); \
|
||||
} \
|
||||
* but good enough. */ \
|
||||
G_STATIC_ASSERT_EXPR(_Generic((policy), \
|
||||
typeof(NULL): 1, \
|
||||
default: (sizeof(policy) == G_N_ELEMENTS(tb) * sizeof(struct nla_policy)))); \
|
||||
} \
|
||||
G_STMT_END
|
||||
#else
|
||||
#define _nl_static_assert_tb(tb, policy) G_STATIC_ASSERT_EXPR(G_N_ELEMENTS(tb) > 0)
|
||||
|
|
|
|||
|
|
@ -327,9 +327,9 @@ typedef uint64_t _nm_bitwise nm_be64_t;
|
|||
*
|
||||
* It's useful to check the let the compiler ensure that @value is
|
||||
* of a certain type. */
|
||||
#define _NM_ENSURE_TYPE(type, value) (_Generic((value), type : (value)))
|
||||
#define _NM_ENSURE_TYPE(type, value) (_Generic((value), type: (value)))
|
||||
#define _NM_ENSURE_TYPE_CONST(type, value) \
|
||||
(_Generic((value), const type : ((const type)(value)), type : ((const type)(value))))
|
||||
(_Generic((value), const type: ((const type)(value)), type: ((const type)(value))))
|
||||
#else
|
||||
#define _NM_ENSURE_TYPE(type, value) (value)
|
||||
#define _NM_ENSURE_TYPE_CONST(type, value) ((const type)(value))
|
||||
|
|
@ -348,7 +348,7 @@ typedef uint64_t _nm_bitwise nm_be64_t;
|
|||
|
||||
#if _NM_CC_SUPPORT_GENERIC && (!defined(__clang__) || __clang_major__ > 3)
|
||||
#define NM_STRUCT_OFFSET_ENSURE_TYPE(type, container, field) \
|
||||
(_Generic((&(((container *) NULL)->field))[0], type : nm_offsetof(container, field)))
|
||||
(_Generic((&(((container *) NULL)->field))[0], type: nm_offsetof(container, field)))
|
||||
#else
|
||||
#define NM_STRUCT_OFFSET_ENSURE_TYPE(type, container, field) nm_offsetof(container, field)
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue