clang-format: reformat code with clang-format 16.0.2-1.fc38

This is the version shipped in Fedora 38. As Fedora 38 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. This change
in isolation will break the "check-tree" test.
This commit is contained in:
Thomas Haller
2023-05-19 10:53:13 +02:00
parent 94d651067a
commit c275d24637
11 changed files with 107 additions and 115 deletions

View File

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

View File

@@ -208,8 +208,7 @@ 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

@@ -14,9 +14,7 @@
#define _NM_DEVICE_CAST(self) _Generic((self), NMDevice *: ((NMDevice *) (self))) #define _NM_DEVICE_CAST(self) _Generic((self), NMDevice *: ((NMDevice *) (self)))
#else #else
#define _NM_DEVICE_CAST(self) \ #define _NM_DEVICE_CAST(self) \
_Generic((self), _NMLOG_DEVICE_TYPE * \ _Generic((self), _NMLOG_DEVICE_TYPE *: ((NMDevice *) (self)), NMDevice *: ((NMDevice *) (self)))
: ((NMDevice *) (self)), NMDevice * \
: ((NMDevice *) (self)))
#endif #endif
#undef _NMLOG_ENABLED #undef _NMLOG_ENABLED

View File

@@ -263,9 +263,8 @@ _nmtst_auto_utils_host_id_context_pop(const char *const *unused)
} }
#define _NMTST_UTILS_HOST_ID_CONTEXT(uniq, 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( \ _nm_unused nm_auto(_nmtst_auto_utils_host_id_context_pop) \
_host_id_context_, \ const char *const NM_UNIQ_T(_host_id_context_, uniq) = ({ \
uniq) = ({ \
const gint64 _timestamp_ns = 1631000672; \ const gint64 _timestamp_ns = 1631000672; \
\ \
nmtst_utils_host_id_push((const guint8 *) "" host_id "", \ nmtst_utils_host_id_push((const guint8 *) "" host_id "", \

View File

@@ -186,9 +186,9 @@ nm_hash_update_str(NMHashState *state, const char *str)
* with a @str argument that cannot be NULL. If you have a string pointer, that is never NULL, use * with a @str argument that cannot be NULL. If you have a string pointer, that is never NULL, use
* nm_hash_update() instead. */ * nm_hash_update() instead. */
#define nm_hash_update_strarr(state, str) \ #define nm_hash_update_strarr(state, str) \
(_Generic(&(str), const char(*)[sizeof(str)] \ (_Generic(&(str), \
: nm_hash_update_str((state), (str)), char(*)[sizeof(str)] \ const char(*)[sizeof(str)]: nm_hash_update_str((state), (str)), \
: nm_hash_update_str((state), (str)))) char(*)[sizeof(str)]: nm_hash_update_str((state), (str))))
#else #else
#define nm_hash_update_strarr(state, str) nm_hash_update_str((state), (str)) #define nm_hash_update_strarr(state, str) nm_hash_update_str((state), (str))
#endif #endif

View File

@@ -399,8 +399,7 @@ NM_G_ERROR_MSG(GError *error)
#define NM_PROPAGATE_CONST(test_expr, ptr) \ #define NM_PROPAGATE_CONST(test_expr, ptr) \
(_Generic((test_expr), \ (_Generic((test_expr), \
const typeof(*(test_expr)) *: ((const typeof(*(ptr)) *) (ptr)), \ const typeof(*(test_expr)) *: ((const typeof(*(ptr)) *) (ptr)), \
default: (_Generic ((test_expr), \ default: (_Generic((test_expr), typeof(*(test_expr)) *: (ptr)))))
typeof (*(test_expr)) *: (ptr)))))
#else #else
#define NM_PROPAGATE_CONST(test_expr, ptr) (ptr) #define NM_PROPAGATE_CONST(test_expr, ptr) (ptr)
#endif #endif
@@ -1500,22 +1499,20 @@ _nm_strndup_a_step(char *s, const char *str, gsize len)
* Instead, this generic macro is supposed to handle all integers correctly. */ * Instead, this generic macro is supposed to handle all integers correctly. */
#if _NM_CC_SUPPORT_GENERIC #if _NM_CC_SUPPORT_GENERIC
#define nm_strdup_int(val) \ #define nm_strdup_int(val) \
_Generic((val), char \ _Generic((val), \
: g_strdup_printf("%d", (int) (val)), \ char: g_strdup_printf("%d", (int) (val)), \
\ \
signed char \ signed char: g_strdup_printf("%d", (signed) (val)), \
: g_strdup_printf("%d", (signed) (val)), signed short \ signed short: g_strdup_printf("%d", (signed) (val)), \
: g_strdup_printf("%d", (signed) (val)), signed \ signed: g_strdup_printf("%d", (signed) (val)), \
: g_strdup_printf("%d", (signed) (val)), signed long \ signed long: g_strdup_printf("%ld", (signed long) (val)), \
: g_strdup_printf("%ld", (signed long) (val)), signed long long \ signed long long: g_strdup_printf("%lld", (signed long long) (val)), \
: g_strdup_printf("%lld", (signed long long) (val)), \
\ \
unsigned char \ unsigned char: g_strdup_printf("%u", (unsigned) (val)), \
: g_strdup_printf("%u", (unsigned) (val)), unsigned short \ unsigned short: g_strdup_printf("%u", (unsigned) (val)), \
: g_strdup_printf("%u", (unsigned) (val)), unsigned \ unsigned: g_strdup_printf("%u", (unsigned) (val)), \
: g_strdup_printf("%u", (unsigned) (val)), unsigned long \ unsigned long: g_strdup_printf("%lu", (unsigned long) (val)), \
: g_strdup_printf("%lu", (unsigned long) (val)), unsigned long long \ unsigned long long: g_strdup_printf("%llu", (unsigned long long) (val)))
: g_strdup_printf("%llu", (unsigned long long) (val)))
#else #else
#define nm_strdup_int(val) \ #define nm_strdup_int(val) \
((sizeof(val) == sizeof(guint64) && ((typeof(val)) -1) > 0) \ ((sizeof(val) == sizeof(guint64) && ((typeof(val)) -1) > 0) \

View File

@@ -2887,8 +2887,7 @@ _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

@@ -102,9 +102,9 @@ struct nla_policy {
* must either match the expected array size or we check that * must either match the expected array size or we check that
* "policy" has typeof(NULL). This isn't a perfect compile time check, * "policy" has typeof(NULL). This isn't a perfect compile time check,
* but good enough. */ \ * but good enough. */ \
G_STATIC_ASSERT_EXPR( \ G_STATIC_ASSERT_EXPR(_Generic((policy), \
_Generic((policy), typeof(NULL) : 1, default \ typeof(NULL): 1, \
: (sizeof(policy) == G_N_ELEMENTS(tb) * sizeof(struct nla_policy)))); \ default: (sizeof(policy) == G_N_ELEMENTS(tb) * sizeof(struct nla_policy)))); \
} \ } \
G_STMT_END G_STMT_END
#else #else