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:
@@ -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)))
|
||||
_Generic((self), _NMLOG_DEVICE_TYPE *: ((NMDevice *) (self)), NMDevice *: ((NMDevice *) (self)))
|
||||
#endif
|
||||
|
||||
#undef _NMLOG_ENABLED
|
||||
|
@@ -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 "", \
|
||||
|
@@ -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
|
||||
|
@@ -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), \
|
||||
(_Generic((obj_expr), \
|
||||
const void *: ((const type *) (obj)), \
|
||||
void *: (( type *) (obj)), \
|
||||
void *: ((type *) (obj)), \
|
||||
const type *: ((const type *) (obj)), \
|
||||
type *: (( type *) (obj))))
|
||||
type *: ((type *) (obj))))
|
||||
#define _NM_CONSTCAST_FULL_2(type, obj_expr, obj, alias_type2) \
|
||||
(_Generic ((obj_expr), \
|
||||
(_Generic((obj_expr), \
|
||||
const void *: ((const type *) (obj)), \
|
||||
void *: (( type *) (obj)), \
|
||||
void *: ((type *) (obj)), \
|
||||
const alias_type2 *: ((const type *) (obj)), \
|
||||
alias_type2 *: (( type *) (obj)), \
|
||||
alias_type2 *: ((type *) (obj)), \
|
||||
const type *: ((const type *) (obj)), \
|
||||
type *: (( type *) (obj))))
|
||||
type *: ((type *) (obj))))
|
||||
#define _NM_CONSTCAST_FULL_3(type, obj_expr, obj, alias_type2, alias_type3) \
|
||||
(_Generic ((obj_expr), \
|
||||
(_Generic((obj_expr), \
|
||||
const void *: ((const type *) (obj)), \
|
||||
void *: (( type *) (obj)), \
|
||||
void *: ((type *) (obj)), \
|
||||
const alias_type2 *: ((const type *) (obj)), \
|
||||
alias_type2 *: (( type *) (obj)), \
|
||||
alias_type2 *: ((type *) (obj)), \
|
||||
const alias_type3 *: ((const type *) (obj)), \
|
||||
alias_type3 *: (( type *) (obj)), \
|
||||
alias_type3 *: ((type *) (obj)), \
|
||||
const type *: ((const type *) (obj)), \
|
||||
type *: (( type *) (obj))))
|
||||
type *: ((type *) (obj))))
|
||||
#define _NM_CONSTCAST_FULL_4(type, obj_expr, obj, alias_type2, alias_type3, alias_type4) \
|
||||
(_Generic ((obj_expr), \
|
||||
(_Generic((obj_expr), \
|
||||
const void *: ((const type *) (obj)), \
|
||||
void *: (( type *) (obj)), \
|
||||
void *: ((type *) (obj)), \
|
||||
const alias_type2 *: ((const type *) (obj)), \
|
||||
alias_type2 *: (( type *) (obj)), \
|
||||
alias_type2 *: ((type *) (obj)), \
|
||||
const alias_type3 *: ((const type *) (obj)), \
|
||||
alias_type3 *: (( type *) (obj)), \
|
||||
alias_type3 *: ((type *) (obj)), \
|
||||
const alias_type4 *: ((const type *) (obj)), \
|
||||
alias_type4 *: (( type *) (obj)), \
|
||||
alias_type4 *: ((type *) (obj)), \
|
||||
const type *: ((const type *) (obj)), \
|
||||
type *: (( 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)))
|
||||
_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
|
||||
@@ -378,18 +378,18 @@ NM_G_ERROR_MSG(GError *error)
|
||||
* 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)))
|
||||
(_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)))
|
||||
(_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))
|
||||
@@ -397,10 +397,9 @@ NM_G_ERROR_MSG(GError *error)
|
||||
|
||||
#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)))))
|
||||
(_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
|
||||
@@ -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) \
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user