src: fix code formatting to last clang version

This commit is contained in:
Fernando Fernandez Mancera
2024-05-28 17:27:47 +02:00
parent 4e50d7d53f
commit a4bbdeaf54
15 changed files with 137 additions and 133 deletions

View File

@@ -299,13 +299,11 @@ typedef struct {
} Option;
#define OPTION(_name, _sysname, ...) \
{ \
.name = ""_name \
"", \
.sysname = ""_sysname \
"", \
__VA_ARGS__ \
}
{.name = ""_name \
"", \
.sysname = ""_sysname \
"", \
__VA_ARGS__}
#define OPTION_TYPE_INT(min, max, def) .nm_min = (min), .nm_max = (max), .nm_default = (def)

View File

@@ -11,9 +11,11 @@
/*****************************************************************************/
#define REQ(_num, _name, _include) \
{ \
.name = NM_DHCP_OPTION_REQPREFIX ""_name, .option_num = _num, .include = _include, \
#define REQ(_num, _name, _include) \
{ \
.name = NM_DHCP_OPTION_REQPREFIX ""_name, \
.option_num = _num, \
.include = _include, \
}
const NMDhcpOption _nm_dhcp_option_dhcp4_options[] = {

View File

@@ -59,10 +59,8 @@ typedef struct {
} IPTunnelModInfo;
#define INF(_module_name, _iftype, _ifname, ...) \
{ \
.module_name = ""_module_name, .iftype = _iftype, .ifname = ""_ifname, __VA_ARGS__ \
}
#define INF(_module_name, _iftype, _ifname, ...) \
{.module_name = ""_module_name, .iftype = _iftype, .ifname = ""_ifname, __VA_ARGS__}
static const IPTunnelModInfo ip_tunnel_mod_infos[] = {
INF("ip_gre", NM_LINK_TYPE_GRE, "gre0"),

View File

@@ -700,9 +700,10 @@ nms_ifcfg_rh_utils_is_numbered_tag_impl(const char *key,
/*****************************************************************************/
#define _KEY_TYPE(key, flags) \
{ \
.key_name = "" key "", .key_flags = ((NMS_IFCFG_KEY_TYPE_WELL_KNOWN) | (flags)), \
#define _KEY_TYPE(key, flags) \
{ \
.key_name = "" key "", \
.key_flags = ((NMS_IFCFG_KEY_TYPE_WELL_KNOWN) | (flags)), \
}
const NMSIfcfgKeyTypeInfo nms_ifcfg_well_known_keys[] = {

View File

@@ -20,21 +20,30 @@ struct Opt {
typedef gboolean (*validate_func)(const struct Opt *, const char *, const guint32);
#define OPT_INT(_key, _int_low, _int_high) \
{ \
.key = _key, .type = NM_SUPPL_OPT_TYPE_INT, .int_high = _int_high, .int_low = _int_low, \
#define OPT_INT(_key, _int_low, _int_high) \
{ \
.key = _key, \
.type = NM_SUPPL_OPT_TYPE_INT, \
.int_high = _int_high, \
.int_low = _int_low, \
}
#define OPT_BYTES(_key, _int_high) \
{ \
.key = _key, .type = NM_SUPPL_OPT_TYPE_BYTES, .int_high = _int_high, \
#define OPT_BYTES(_key, _int_high) \
{ \
.key = _key, \
.type = NM_SUPPL_OPT_TYPE_BYTES, \
.int_high = _int_high, \
}
#define OPT_UTF8(_key, _int_high) \
{ \
.key = _key, .type = NM_SUPPL_OPT_TYPE_UTF8, .int_high = _int_high, \
#define OPT_UTF8(_key, _int_high) \
{ \
.key = _key, \
.type = NM_SUPPL_OPT_TYPE_UTF8, \
.int_high = _int_high, \
}
#define OPT_KEYWORD(_key, _str_allowed) \
{ \
.key = _key, .type = NM_SUPPL_OPT_TYPE_KEYWORD, .str_allowed = _str_allowed, \
#define OPT_KEYWORD(_key, _str_allowed) \
{ \
.key = _key, \
.type = NM_SUPPL_OPT_TYPE_KEYWORD, \
.str_allowed = _str_allowed, \
}
static const struct Opt opt_table[] = {

View File

@@ -379,11 +379,10 @@ typedef struct {
} NMLDBusMetaProperty;
#define NML_DBUS_META_PROPERTY_INIT(v_dbus_property_name, v_dbus_type, v_obj_properties_idx, ...) \
{ \
.dbus_property_name = "" v_dbus_property_name "", \
.dbus_type = NM_G_VARIANT_TYPE("" v_dbus_type ""), \
.obj_properties_idx = v_obj_properties_idx, ##__VA_ARGS__ \
}
{.dbus_property_name = "" v_dbus_property_name "", \
.dbus_type = NM_G_VARIANT_TYPE("" v_dbus_type ""), \
.obj_properties_idx = v_obj_properties_idx, \
##__VA_ARGS__}
#define _NML_DBUS_META_PROPERTY_INIT_DEFAULT(v_dbus_type, \
v_exp_type, \
@@ -568,10 +567,10 @@ struct _NMLDBusMetaIface {
(sizeof((const NMLDBusMetaProperty[]){__VA_ARGS__}) / sizeof(NMLDBusMetaProperty))
#define NML_DBUS_META_IFACE_INIT(v_dbus_iface_name, v_get_type_fcn, v_interface_prio, ...) \
{ \
.dbus_iface_name = "" v_dbus_iface_name "", .get_type_fcn = v_get_type_fcn, \
.interface_prio = v_interface_prio, ##__VA_ARGS__ \
}
{.dbus_iface_name = "" v_dbus_iface_name "", \
.get_type_fcn = v_get_type_fcn, \
.interface_prio = v_interface_prio, \
##__VA_ARGS__}
#define NML_DBUS_META_IFACE_INIT_PROP(v_dbus_iface_name, v_get_type_fcn, v_interface_prio, ...) \
NML_DBUS_META_IFACE_INIT(v_dbus_iface_name, \

View File

@@ -57,9 +57,11 @@ _test_fixup_string(const TestFixupData *data, guint n_data, char *(*func)(const
}
}
#define T_DATA(_desc, _expected) \
{ \
.desc = _desc, .expected = _expected, .line = __LINE__, \
#define T_DATA(_desc, _expected) \
{ \
.desc = _desc, \
.expected = _expected, \
.line = __LINE__, \
}
static void

View File

@@ -484,10 +484,7 @@ void _nm_setting_class_commit(NMSettingClass *setting_class,
#define NM_SETT_INFO_SETT_DETAIL(...) (&((const NMSettInfoSettDetail){__VA_ARGS__}))
#define NM_SETT_INFO_PROPERT_TYPE_DBUS_INIT(_dbus_type, ...) \
{ \
.dbus_type = _dbus_type, __VA_ARGS__ \
}
#define NM_SETT_INFO_PROPERT_TYPE_DBUS_INIT(_dbus_type, ...) {.dbus_type = _dbus_type, __VA_ARGS__}
#define NM_SETT_INFO_PROPERT_TYPE_GPROP_INIT(_dbus_type, ...) \
NM_SETT_INFO_PROPERT_TYPE_DBUS_INIT(_dbus_type, \

View File

@@ -329,9 +329,10 @@ good:
typedef const char *const StrvArray4Type[4];
#define LL(l, ...) \
{ \
.name = l, .value = {__VA_ARGS__, NULL}, \
#define LL(l, ...) \
{ \
.name = l, \
.value = {__VA_ARGS__, NULL}, \
}
/* 5-letter language codes */

View File

@@ -25,11 +25,12 @@ typedef struct {
} _priv;
} NMPrioq;
#define NM_PRIOQ_ZERO \
{ \
._priv = { \
.compare_func = NULL, \
}, \
#define NM_PRIOQ_ZERO \
{ \
._priv = \
{ \
.compare_func = NULL, \
}, \
}
void nm_prioq_init(NMPrioq *q, GCompareFunc compare_func);

View File

@@ -198,14 +198,15 @@ typedef struct {
#define _NM_ETHER_ADDR_INIT(a0, a1, a2, a3, a4, a5) \
{ \
.ether_addr_octet = { \
(a0), \
(a1), \
(a2), \
(a3), \
(a4), \
(a5), \
}, \
.ether_addr_octet = \
{ \
(a0), \
(a1), \
(a2), \
(a3), \
(a4), \
(a5), \
}, \
}
#define NM_ETHER_ADDR_INIT(...) ((NMEtherAddr) _NM_ETHER_ADDR_INIT(__VA_ARGS__))
@@ -806,7 +807,8 @@ typedef struct {
#define NM_UTILS_FLAGS2STR(f, n) \
{ \
.flag = f, .name = "" n, \
.flag = f, \
.name = "" n, \
}
#define NM_UTILS_FLAGS2STR_DEFINE(fcn_name, flags_type, ...) \
@@ -1749,10 +1751,7 @@ typedef struct {
};
} NMUtilsNamedValue;
#define NM_UTILS_NAMED_VALUE_INIT(n, v) \
{ \
.name = (n), .value_ptr = (v) \
}
#define NM_UTILS_NAMED_VALUE_INIT(n, v) {.name = (n), .value_ptr = (v)}
NMUtilsNamedValue *nm_utils_hash_to_array_full(GHashTable *hash,
guint *out_len,
@@ -2444,10 +2443,7 @@ int nm_utils_fd_read_loop_exact(int fd, void *buf, size_t nbytes, bool do_po
__VA_ARGS__ NULL, \
}))
#define NM_DEFINE_GDBUS_SIGNAL_INFO_INIT(name_, ...) \
{ \
.ref_count = -1, .name = name_, __VA_ARGS__ \
}
#define NM_DEFINE_GDBUS_SIGNAL_INFO_INIT(name_, ...) {.ref_count = -1, .name = name_, __VA_ARGS__}
#define NM_DEFINE_GDBUS_SIGNAL_INFO(name_, ...) \
((GDBusSignalInfo *) (&( \
@@ -2458,10 +2454,7 @@ int nm_utils_fd_read_loop_exact(int fd, void *buf, size_t nbytes, bool do_po
__VA_ARGS__ NULL, \
}))
#define NM_DEFINE_GDBUS_METHOD_INFO_INIT(name_, ...) \
{ \
.ref_count = -1, .name = name_, __VA_ARGS__ \
}
#define NM_DEFINE_GDBUS_METHOD_INFO_INIT(name_, ...) {.ref_count = -1, .name = name_, __VA_ARGS__}
#define NM_DEFINE_GDBUS_METHOD_INFO(name_, ...) \
((GDBusMethodInfo *) (&( \
@@ -2473,9 +2466,7 @@ int nm_utils_fd_read_loop_exact(int fd, void *buf, size_t nbytes, bool do_po
}))
#define NM_DEFINE_GDBUS_INTERFACE_INFO_INIT(name_, ...) \
{ \
.ref_count = -1, .name = name_, __VA_ARGS__ \
}
{.ref_count = -1, .name = name_, __VA_ARGS__}
#define NM_DEFINE_GDBUS_INTERFACE_INFO(name_, ...) \
((GDBusInterfaceInfo *) (&( \

View File

@@ -68,9 +68,10 @@ typedef struct {
char ifname[IFNAMSIZ];
} SocketHandle;
#define SOCKET_HANDLE_INIT(_ifindex) \
{ \
.fd = -1, .ifindex = (_ifindex), \
#define SOCKET_HANDLE_INIT(_ifindex) \
{ \
.fd = -1, \
.ifindex = (_ifindex), \
}
static void
@@ -430,10 +431,11 @@ ethtool_get_stringset_index(SocketHandle *shandle, int stringset_id, const char
/*****************************************************************************/
static const NMEthtoolFeatureInfo _ethtool_feature_infos[_NM_ETHTOOL_ID_FEATURE_NUM] = {
#define ETHT_FEAT(eid, ...) \
{ \
.ethtool_id = eid, .n_kernel_names = NM_NARG(__VA_ARGS__), \
.kernel_names = ((const char *const[]){__VA_ARGS__}), \
#define ETHT_FEAT(eid, ...) \
{ \
.ethtool_id = eid, \
.n_kernel_names = NM_NARG(__VA_ARGS__), \
.kernel_names = ((const char *const[]){__VA_ARGS__}), \
}
/* the order does only matter for one thing: if it happens that more than one NMEthtoolID

View File

@@ -2002,7 +2002,8 @@ _vt_dedup_obj_clone(const NMDedupMultiObj *obj)
#define DEDUP_MULTI_OBJ_CLASS_INIT() \
{ \
.obj_clone = _vt_dedup_obj_clone, .obj_destroy = _vt_dedup_obj_destroy, \
.obj_clone = _vt_dedup_obj_clone, \
.obj_destroy = _vt_dedup_obj_destroy, \
.obj_full_hash_update = \
(void (*)(const NMDedupMultiObj *obj, NMHashState *h)) nmp_object_hash_update, \
.obj_full_equal = (gboolean(*)(const NMDedupMultiObj *obj_a, \

View File

@@ -38,11 +38,12 @@ G_STATIC_ASSERT(sizeof(NMSockAddrUnion) == sizeof(((NMSockAddrUnion *) NULL)->in
/* we initialize the largest union member, to ensure that all fields are initialized. */
#define NM_SOCK_ADDR_UNION_INIT_UNSPEC \
{ \
.in6 = { \
.sin6_family = AF_UNSPEC, \
}, \
#define NM_SOCK_ADDR_UNION_INIT_UNSPEC \
{ \
.in6 = \
{ \
.sin6_family = AF_UNSPEC, \
}, \
}
int nm_sock_addr_union_cmp(const NMSockAddrUnion *a, const NMSockAddrUnion *b);

View File

@@ -35,49 +35,50 @@
#define NMCLI_VERSION VERSION
#endif
#define _NMC_COLOR_PALETTE_INIT() \
{ \
.ansi_seq = { \
[NM_META_COLOR_CONNECTION_ACTIVATED] = "32", \
[NM_META_COLOR_CONNECTION_ACTIVATING] = "33", \
[NM_META_COLOR_CONNECTION_DISCONNECTING] = "31", \
[NM_META_COLOR_CONNECTION_INVISIBLE] = "2", \
[NM_META_COLOR_CONNECTION_EXTERNAL] = "32;2", \
[NM_META_COLOR_CONNECTION_DEPRECATED] = "2", \
[NM_META_COLOR_CONNECTIVITY_FULL] = "32", \
[NM_META_COLOR_CONNECTIVITY_LIMITED] = "33", \
[NM_META_COLOR_CONNECTIVITY_NONE] = "31", \
[NM_META_COLOR_CONNECTIVITY_PORTAL] = "33", \
[NM_META_COLOR_DEVICE_ACTIVATED] = "32", \
[NM_META_COLOR_DEVICE_ACTIVATING] = "33", \
[NM_META_COLOR_DEVICE_DISCONNECTED] = "31", \
[NM_META_COLOR_DEVICE_FIRMWARE_MISSING] = "31", \
[NM_META_COLOR_DEVICE_PLUGIN_MISSING] = "31", \
[NM_META_COLOR_DEVICE_UNAVAILABLE] = "2", \
[NM_META_COLOR_DEVICE_DISABLED] = "31", \
[NM_META_COLOR_DEVICE_EXTERNAL] = "32;2", \
[NM_META_COLOR_MANAGER_RUNNING] = "32", \
[NM_META_COLOR_MANAGER_STARTING] = "33", \
[NM_META_COLOR_MANAGER_STOPPED] = "31", \
[NM_META_COLOR_PERMISSION_AUTH] = "33", \
[NM_META_COLOR_PERMISSION_NO] = "31", \
[NM_META_COLOR_PERMISSION_YES] = "32", \
[NM_META_COLOR_STATE_ASLEEP] = "31", \
[NM_META_COLOR_STATE_CONNECTED_GLOBAL] = "32", \
[NM_META_COLOR_STATE_CONNECTED_LOCAL] = "32", \
[NM_META_COLOR_STATE_CONNECTED_SITE] = "32", \
[NM_META_COLOR_STATE_CONNECTING] = "33", \
[NM_META_COLOR_STATE_DISCONNECTED] = "31", \
[NM_META_COLOR_STATE_DISCONNECTING] = "33", \
[NM_META_COLOR_WIFI_SIGNAL_EXCELLENT] = "32", \
[NM_META_COLOR_WIFI_SIGNAL_FAIR] = "35", \
[NM_META_COLOR_WIFI_SIGNAL_GOOD] = "33", \
[NM_META_COLOR_WIFI_SIGNAL_POOR] = "36", \
[NM_META_COLOR_WIFI_SIGNAL_UNKNOWN] = "2", \
[NM_META_COLOR_WIFI_DEPRECATED] = "2", \
[NM_META_COLOR_ENABLED] = "32", \
[NM_META_COLOR_DISABLED] = "31", \
}, \
#define _NMC_COLOR_PALETTE_INIT() \
{ \
.ansi_seq = \
{ \
[NM_META_COLOR_CONNECTION_ACTIVATED] = "32", \
[NM_META_COLOR_CONNECTION_ACTIVATING] = "33", \
[NM_META_COLOR_CONNECTION_DISCONNECTING] = "31", \
[NM_META_COLOR_CONNECTION_INVISIBLE] = "2", \
[NM_META_COLOR_CONNECTION_EXTERNAL] = "32;2", \
[NM_META_COLOR_CONNECTION_DEPRECATED] = "2", \
[NM_META_COLOR_CONNECTIVITY_FULL] = "32", \
[NM_META_COLOR_CONNECTIVITY_LIMITED] = "33", \
[NM_META_COLOR_CONNECTIVITY_NONE] = "31", \
[NM_META_COLOR_CONNECTIVITY_PORTAL] = "33", \
[NM_META_COLOR_DEVICE_ACTIVATED] = "32", \
[NM_META_COLOR_DEVICE_ACTIVATING] = "33", \
[NM_META_COLOR_DEVICE_DISCONNECTED] = "31", \
[NM_META_COLOR_DEVICE_FIRMWARE_MISSING] = "31", \
[NM_META_COLOR_DEVICE_PLUGIN_MISSING] = "31", \
[NM_META_COLOR_DEVICE_UNAVAILABLE] = "2", \
[NM_META_COLOR_DEVICE_DISABLED] = "31", \
[NM_META_COLOR_DEVICE_EXTERNAL] = "32;2", \
[NM_META_COLOR_MANAGER_RUNNING] = "32", \
[NM_META_COLOR_MANAGER_STARTING] = "33", \
[NM_META_COLOR_MANAGER_STOPPED] = "31", \
[NM_META_COLOR_PERMISSION_AUTH] = "33", \
[NM_META_COLOR_PERMISSION_NO] = "31", \
[NM_META_COLOR_PERMISSION_YES] = "32", \
[NM_META_COLOR_STATE_ASLEEP] = "31", \
[NM_META_COLOR_STATE_CONNECTED_GLOBAL] = "32", \
[NM_META_COLOR_STATE_CONNECTED_LOCAL] = "32", \
[NM_META_COLOR_STATE_CONNECTED_SITE] = "32", \
[NM_META_COLOR_STATE_CONNECTING] = "33", \
[NM_META_COLOR_STATE_DISCONNECTED] = "31", \
[NM_META_COLOR_STATE_DISCONNECTING] = "33", \
[NM_META_COLOR_WIFI_SIGNAL_EXCELLENT] = "32", \
[NM_META_COLOR_WIFI_SIGNAL_FAIR] = "35", \
[NM_META_COLOR_WIFI_SIGNAL_GOOD] = "33", \
[NM_META_COLOR_WIFI_SIGNAL_POOR] = "36", \
[NM_META_COLOR_WIFI_SIGNAL_UNKNOWN] = "2", \
[NM_META_COLOR_WIFI_DEPRECATED] = "2", \
[NM_META_COLOR_ENABLED] = "32", \
[NM_META_COLOR_DISABLED] = "31", \
}, \
}
static NmCli nm_cli = {