format: reformat source tree with clang-format 13.0

We use clang-format for automatic formatting of our source files.
Since clang-format is actively maintained software, the actual
formatting depends on the used version of clang-format. That is
unfortunate and painful, but really unavoidable unless clang-format
would be strictly bug-compatible.

So the version that we must use is from the current Fedora release, which
is also tested by our gitlab-ci. Previously, we were using Fedora 34 with
clang-tools-extra-12.0.1-1.fc34.x86_64.

As Fedora 35 comes along, we need to update our formatting as Fedora 35
comes with version "13.0.0~rc1-1.fc35".
An alternative would be to freeze on version 12, but that has different
problems (like, it's cumbersome to rebuild clang 12 on Fedora 35 and it
would be cumbersome for our developers which are on Fedora 35 to use a
clang that they cannot easily install).

The (differently painful) solution is to reformat from time to time, as we
switch to a new Fedora (and thus clang) version.
Usually we would expect that such a reformatting brings minor changes.
But this time, the changes are huge. That is mentioned in the release
notes [1] as

  Makes PointerAligment: Right working with AlignConsecutiveDeclarations. (Fixes https://llvm.org/PR27353)

[1] https://releases.llvm.org/13.0.0/tools/clang/docs/ReleaseNotes.html#clang-format
This commit is contained in:
Thomas Haller
2021-11-09 13:28:54 +01:00
committed by Beniamino Galvani
parent e44cdc7981
commit 615221a99c
633 changed files with 21047 additions and 20964 deletions

View File

@@ -24,7 +24,7 @@ G_DEFINE_BOXED_TYPE(NMTCQdisc, nm_tc_qdisc, nm_tc_qdisc_dup, nm_tc_qdisc_unref)
struct NMTCQdisc {
guint refcount;
char * kind;
char *kind;
guint32 handle;
guint32 parent;
GHashTable *attributes;
@@ -138,8 +138,8 @@ gboolean
nm_tc_qdisc_equal(NMTCQdisc *qdisc, NMTCQdisc *other)
{
GHashTableIter iter;
const char * key;
GVariant * value, *value2;
const char *key;
GVariant *value, *value2;
guint n;
g_return_val_if_fail(qdisc != NULL, FALSE);
@@ -172,9 +172,9 @@ nm_tc_qdisc_equal(NMTCQdisc *qdisc, NMTCQdisc *other)
static guint
_nm_tc_qdisc_hash(NMTCQdisc *qdisc)
{
NMUtilsNamedValue attrs_static[30];
NMUtilsNamedValue attrs_static[30];
gs_free NMUtilsNamedValue *attrs_free = NULL;
const NMUtilsNamedValue * attrs;
const NMUtilsNamedValue *attrs;
NMHashState h;
guint length;
guint i;
@@ -186,8 +186,8 @@ _nm_tc_qdisc_hash(NMTCQdisc *qdisc)
nm_hash_update_vals(&h, qdisc->handle, qdisc->parent, length);
nm_hash_update_str0(&h, qdisc->kind);
for (i = 0; i < length; i++) {
const char * key = attrs[i].name;
GVariant * variant = attrs[i].value_ptr;
const char *key = attrs[i].name;
GVariant *variant = attrs[i].value_ptr;
const GVariantType *vtype;
vtype = g_variant_get_type(variant);
@@ -224,8 +224,8 @@ nm_tc_qdisc_dup(NMTCQdisc *qdisc)
if (qdisc->attributes) {
GHashTableIter iter;
const char * key;
GVariant * value;
const char *key;
GVariant *value;
g_hash_table_iter_init(&iter, qdisc->attributes);
while (g_hash_table_iter_next(&iter, (gpointer *) &key, (gpointer *) &value))
@@ -495,8 +495,8 @@ gboolean
nm_tc_action_equal(NMTCAction *action, NMTCAction *other)
{
GHashTableIter iter;
const char * key;
GVariant * value, *value2;
const char *key;
GVariant *value, *value2;
guint n;
g_return_val_if_fail(!action || action->refcount > 0, FALSE);
@@ -549,8 +549,8 @@ nm_tc_action_dup(NMTCAction *action)
if (action->attributes) {
GHashTableIter iter;
const char * key;
GVariant * value;
const char *key;
GVariant *value;
g_hash_table_iter_init(&iter, action->attributes);
while (g_hash_table_iter_next(&iter, (gpointer *) &key, (gpointer *) &value))
@@ -667,7 +667,7 @@ G_DEFINE_BOXED_TYPE(NMTCTfilter, nm_tc_tfilter, nm_tc_tfilter_dup, nm_tc_tfilter
struct NMTCTfilter {
guint refcount;
char * kind;
char *kind;
guint32 handle;
guint32 parent;
NMTCAction *action;
@@ -806,7 +806,7 @@ _nm_tc_tfilter_hash(NMTCTfilter *tfilter)
if (tfilter->action) {
gs_free NMUtilsNamedValue *attrs_free = NULL;
NMUtilsNamedValue attrs_static[30];
const NMUtilsNamedValue * attrs;
const NMUtilsNamedValue *attrs;
guint length;
guint i;
@@ -1370,10 +1370,10 @@ _qdiscs_to_variant(GPtrArray *qdiscs)
if (qdiscs) {
for (i = 0; i < qdiscs->len; i++) {
NMUtilsNamedValue attrs_static[30];
NMUtilsNamedValue attrs_static[30];
gs_free NMUtilsNamedValue *attrs_free = NULL;
const NMUtilsNamedValue * attrs;
NMTCQdisc * qdisc = qdiscs->pdata[i];
const NMUtilsNamedValue *attrs;
NMTCQdisc *qdisc = qdiscs->pdata[i];
guint length;
GVariantBuilder qdisc_builder;
guint y;
@@ -1423,10 +1423,10 @@ _qdiscs_to_variant(GPtrArray *qdiscs)
static GPtrArray *
_qdiscs_from_variant(GVariant *value)
{
GPtrArray * qdiscs;
GVariant * qdisc_var;
GPtrArray *qdiscs;
GVariant *qdisc_var;
GVariantIter iter;
GError * error = NULL;
GError *error = NULL;
g_return_val_if_fail(g_variant_is_of_type(value, G_VARIANT_TYPE("aa{sv}")), NULL);
@@ -1434,12 +1434,12 @@ _qdiscs_from_variant(GVariant *value)
qdiscs = g_ptr_array_new_with_free_func((GDestroyNotify) nm_tc_qdisc_unref);
while (g_variant_iter_next(&iter, "@a{sv}", &qdisc_var)) {
const char * kind;
const char *kind;
guint32 parent;
NMTCQdisc * qdisc;
NMTCQdisc *qdisc;
GVariantIter qdisc_iter;
const char * key;
GVariant * attr_value;
const char *key;
GVariant *attr_value;
if (!g_variant_lookup(qdisc_var, "kind", "&s", &kind)
|| !g_variant_lookup(qdisc_var, "parent", "u", &parent)) {
@@ -1537,8 +1537,8 @@ _tfilters_to_variant(GPtrArray *tfilters)
if (tfilters) {
for (i = 0; i < tfilters->len; i++) {
NMTCTfilter * tfilter = tfilters->pdata[i];
NMTCAction * action = nm_tc_tfilter_get_action(tfilter);
NMTCTfilter *tfilter = tfilters->pdata[i];
NMTCAction *action = nm_tc_tfilter_get_action(tfilter);
GVariantBuilder tfilter_builder;
g_variant_builder_init(&tfilter_builder, G_VARIANT_TYPE("a{sv}"));
@@ -1583,10 +1583,10 @@ _tfilters_to_variant(GPtrArray *tfilters)
static GPtrArray *
_tfilters_from_variant(GVariant *value)
{
GPtrArray * tfilters;
GVariant * tfilter_var;
GPtrArray *tfilters;
GVariant *tfilter_var;
GVariantIter iter;
GError * error = NULL;
GError *error = NULL;
g_return_val_if_fail(g_variant_is_of_type(value, G_VARIANT_TYPE("aa{sv}")), NULL);
@@ -1595,15 +1595,15 @@ _tfilters_from_variant(GVariant *value)
while (g_variant_iter_next(&iter, "@a{sv}", &tfilter_var)) {
NMTCTfilter *tfilter = NULL;
const char * kind;
const char *kind;
guint32 handle;
guint32 parent;
NMTCAction * action;
const char * action_kind = NULL;
char * action_key;
NMTCAction *action;
const char *action_kind = NULL;
char *action_key;
GVariantIter action_iter;
GVariant * action_var = NULL;
GVariant * action_val;
GVariant *action_var = NULL;
GVariant *action_val;
if (!g_variant_lookup(tfilter_var, "kind", "&s", &kind)
|| !g_variant_lookup(tfilter_var, "parent", "u", &parent)) {
@@ -1767,9 +1767,9 @@ finalize(GObject *object)
static void
nm_setting_tc_config_class_init(NMSettingTCConfigClass *klass)
{
GObjectClass * object_class = G_OBJECT_CLASS(klass);
GObjectClass *object_class = G_OBJECT_CLASS(klass);
NMSettingClass *setting_class = NM_SETTING_CLASS(klass);
GArray * properties_override = _nm_sett_info_property_override_create_array();
GArray *properties_override = _nm_sett_info_property_override_create_array();
object_class->get_property = get_property;
object_class->set_property = set_property;