Coverage Report

Created: 2026-10-31 08:12

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/qemu/build-oss-fuzz/qapi/qapi-visit-compat.c
Line
Count
Source
1
/* AUTOMATICALLY GENERATED by qapi-gen.py DO NOT MODIFY */
2
3
/*
4
 * Schema-defined QAPI visitors
5
 *
6
 * Copyright IBM, Corp. 2011
7
 * Copyright (C) 2014-2018 Red Hat, Inc.
8
 *
9
 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
10
 * See the COPYING.LIB file in the top-level directory.
11
 */
12
13
#include "qemu/osdep.h"
14
#include "qapi/error.h"
15
#include "qapi-visit-compat.h"
16
#include "qapi-features.h"
17
18
bool visit_type_CompatPolicyInput(Visitor *v, const char *name,
19
                 CompatPolicyInput *obj, Error **errp)
20
0
{
21
0
    int value = *obj;
22
0
    bool ok = visit_type_enum(v, name, &value, &CompatPolicyInput_lookup, errp);
23
0
    *obj = value;
24
0
    return ok;
25
0
}
26
27
bool visit_type_CompatPolicyOutput(Visitor *v, const char *name,
28
                 CompatPolicyOutput *obj, Error **errp)
29
0
{
30
0
    int value = *obj;
31
0
    bool ok = visit_type_enum(v, name, &value, &CompatPolicyOutput_lookup, errp);
32
0
    *obj = value;
33
0
    return ok;
34
0
}
35
36
bool visit_type_CompatPolicySecurity(Visitor *v, const char *name,
37
                 CompatPolicySecurity *obj, Error **errp)
38
0
{
39
0
    int value = *obj;
40
0
    bool ok = visit_type_enum(v, name, &value, &CompatPolicySecurity_lookup, errp);
41
0
    *obj = value;
42
0
    return ok;
43
0
}
44
45
bool visit_type_CompatPolicy_members(Visitor *v, CompatPolicy *obj, Error **errp)
46
0
{
47
0
    if (visit_optional(v, "deprecated-input", &obj->has_deprecated_input)) {
48
0
        if (!visit_type_CompatPolicyInput(v, "deprecated-input", &obj->deprecated_input, errp)) {
49
0
            return false;
50
0
        }
51
0
    }
52
0
    if (visit_optional(v, "deprecated-output", &obj->has_deprecated_output)) {
53
0
        if (!visit_type_CompatPolicyOutput(v, "deprecated-output", &obj->deprecated_output, errp)) {
54
0
            return false;
55
0
        }
56
0
    }
57
0
    if (visit_optional(v, "unstable-input", &obj->has_unstable_input)) {
58
0
        if (!visit_type_CompatPolicyInput(v, "unstable-input", &obj->unstable_input, errp)) {
59
0
            return false;
60
0
        }
61
0
    }
62
0
    if (visit_optional(v, "unstable-output", &obj->has_unstable_output)) {
63
0
        if (!visit_type_CompatPolicyOutput(v, "unstable-output", &obj->unstable_output, errp)) {
64
0
            return false;
65
0
        }
66
0
    }
67
0
    if (visit_optional(v, "insecure-types", &obj->has_insecure_types)) {
68
0
        if (!visit_type_CompatPolicySecurity(v, "insecure-types", &obj->insecure_types, errp)) {
69
0
            return false;
70
0
        }
71
0
    }
72
0
    return true;
73
0
}
74
75
bool visit_type_CompatPolicy(Visitor *v, const char *name,
76
                 CompatPolicy **obj, Error **errp)
77
0
{
78
0
    bool ok = false;
79
80
0
    if (!visit_start_struct(v, name, (void **)obj, sizeof(CompatPolicy), errp)) {
81
0
        return false;
82
0
    }
83
0
    if (!*obj) {
84
        /* incomplete */
85
0
        assert(visit_is_dealloc(v));
86
0
        ok = true;
87
0
        goto out_obj;
88
0
    }
89
0
    if (!visit_type_CompatPolicy_members(v, *obj, errp)) {
90
0
        goto out_obj;
91
0
    }
92
0
    ok = visit_check_struct(v, errp);
93
0
out_obj:
94
0
    visit_end_struct(v, (void **)obj);
95
0
    if (!ok && visit_is_input(v)) {
96
0
        qapi_free_CompatPolicy(*obj);
97
        *obj = NULL;
98
0
    }
99
0
    return ok;
100
0
}
101
102
/* Dummy declaration to prevent empty .o file */
103
char qapi_dummy_qapi_visit_compat_c;