We had some pointless differences in the generated code for visit, command marshalling, and events; unifying them makes it easier for future patches to consolidate to common helper functions.
This is patch 3/4, focusing on naming the goto labels 'out' (not 'clean') and 'out_obj' (not 'out_end'). Additionally, the generator was inconsistent on whether labels had a leading space; prefer the emacs style of including the space, so that only function names and comments occur in column 1 of the generated file [HACKING gives no preference, and both styles occur elsewhere in qemu.git]. No change in semantics to the generated code. Signed-off-by: Eric Blake <ebl...@redhat.com> --- v6: split 9/46 into four patches, update docs where they are affected, pick consistent spacing of label Signed-off-by: Eric Blake <ebl...@redhat.com> --- docs/qapi-code-gen.txt | 8 ++++---- scripts/qapi-commands.py | 4 ++-- scripts/qapi-event.py | 8 ++++---- scripts/qapi-visit.py | 14 +++++++------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/qapi-code-gen.txt b/docs/qapi-code-gen.txt index 2afab20..fd390ef 100644 --- a/docs/qapi-code-gen.txt +++ b/docs/qapi-code-gen.txt @@ -836,7 +836,7 @@ Example: goto out; } - out: + out: error_propagate(errp, err); } @@ -874,7 +874,7 @@ Example: error_propagate(errp, err); err = NULL; visit_end_list(v, &err); - out: + out: error_propagate(errp, err); } $ cat qapi-generated/example-qapi-visit.h @@ -928,7 +928,7 @@ Example: } *ret_out = qmp_output_get_qobject(qov); - out: + out: error_propagate(errp, err); qmp_output_visitor_cleanup(qov); qdv = qapi_dealloc_visitor_new(); @@ -959,7 +959,7 @@ Example: qmp_marshal_output_UserDefOne(retval, ret, &err); - out: + out: error_propagate(errp, err); qmp_input_visitor_cleanup(qiv); qdv = qapi_dealloc_visitor_new(); diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py index 475735d..8fab1ce 100644 --- a/scripts/qapi-commands.py +++ b/scripts/qapi-commands.py @@ -183,7 +183,7 @@ static void qmp_marshal_output_%(c_name)s(%(c_type)s ret_in, QObject **ret_out, } *ret_out = qmp_output_get_qobject(qov); -out: + out: error_propagate(errp, err); qmp_output_visitor_cleanup(qov); qdv = qapi_dealloc_visitor_new(); @@ -224,7 +224,7 @@ def gen_marshal(name, arg_type, ret_type): if re.search('^ *goto out;', ret, re.MULTILINE): ret += mcgen(''' -out: + out: ''') ret += mcgen(''' error_propagate(errp, err); diff --git a/scripts/qapi-event.py b/scripts/qapi-event.py index d41af40..b43bbc2 100644 --- a/scripts/qapi-event.py +++ b/scripts/qapi-event.py @@ -69,7 +69,7 @@ def gen_event_send(name, arg_type): /* Fake visit, as if all members are under a structure */ visit_start_struct(v, NULL, "", "%(name)s", 0, &err); if (err) { - goto clean; + goto out; } ''', @@ -92,7 +92,7 @@ def gen_event_send(name, arg_type): ret += mcgen(''' visit_type_%(c_type)s(v, %(cast)s&%(c_name)s, "%(name)s", &err); if (err) { - goto clean; + goto out; } ''', cast=cast, @@ -110,7 +110,7 @@ def gen_event_send(name, arg_type): visit_end_struct(v, &err); if (err) { - goto clean; + goto out; } obj = qmp_output_get_qobject(qov); @@ -127,7 +127,7 @@ def gen_event_send(name, arg_type): if arg_type and arg_type.members: ret += mcgen(''' - clean: + out: qmp_output_visitor_cleanup(qov); ''') ret += mcgen(''' diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py index 348efe0..a5d7be1 100644 --- a/scripts/qapi-visit.py +++ b/scripts/qapi-visit.py @@ -118,7 +118,7 @@ if (err) { if re.search('^ *goto out;', ret, re.MULTILINE): ret += mcgen(''' -out: + out: ''') ret += mcgen(''' error_propagate(errp, err); @@ -178,7 +178,7 @@ void visit_type_%(c_name)s(Visitor *v, %(c_name)s **obj, const char *name, Error error_propagate(errp, err); err = NULL; visit_end_list(v, &err); -out: + out: error_propagate(errp, err); } ''', @@ -209,7 +209,7 @@ void visit_type_%(c_name)s(Visitor *v, %(c_name)s **obj, const char *name, Error } visit_get_next_type(v, (int*) &(*obj)->kind, %(c_name)s_qtypes, name, &err); if (err) { - goto out_end; + goto out_obj; } switch ((*obj)->kind) { ''', @@ -230,11 +230,11 @@ void visit_type_%(c_name)s(Visitor *v, %(c_name)s **obj, const char *name, Error default: abort(); } -out_end: + out_obj: error_propagate(errp, err); err = NULL; visit_end_implicit_struct(v, &err); -out: + out: error_propagate(errp, err); } ''') @@ -326,7 +326,7 @@ void visit_type_%(c_name)s(Visitor *v, %(c_name)s **obj, const char *name, Error default: abort(); } -out_obj: + out_obj: error_propagate(errp, err); err = NULL; visit_end_union(v, !!(*obj)->data, &err); @@ -334,7 +334,7 @@ out_obj: err = NULL; } visit_end_struct(v, &err); -out: + out: error_propagate(errp, err); } ''') -- 2.4.3