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")/../../")"
cd "$DIR"
FEDORA_VERSION=37
FEDORA_VERSION=38
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) \
\
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) \
{ \

View File

@@ -14,9 +14,7 @@
#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)))
_Generic((self), _NMLOG_DEVICE_TYPE *: ((NMDevice *) (self)), NMDevice *: ((NMDevice *) (self)))
#endif
#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) \
_nm_unused nm_auto(_nmtst_auto_utils_host_id_context_pop) const char *const NM_UNIQ_T( \
_host_id_context_, \
uniq) = ({ \
_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 "", \

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
* 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))))
(_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

View File

@@ -399,8 +399,7 @@ NM_G_ERROR_MSG(GError *error)
#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)))))
default: (_Generic((test_expr), typeof(*(test_expr)) *: (ptr)))))
#else
#define NM_PROPAGATE_CONST(test_expr, ptr) (ptr)
#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. */
#if _NM_CC_SUPPORT_GENERIC
#define nm_strdup_int(val) \
_Generic((val), char \
: g_strdup_printf("%d", (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)), \
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)))
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) \

View File

@@ -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

View File

@@ -102,9 +102,9 @@ struct nla_policy {
* 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)))); \
G_STATIC_ASSERT_EXPR(_Generic((policy), \
typeof(NULL): 1, \
default: (sizeof(policy) == G_N_ELEMENTS(tb) * sizeof(struct nla_policy)))); \
} \
G_STMT_END
#else