diff --git a/.gitignore b/.gitignore index 809e8e47..87b0608e 100644 --- a/.gitignore +++ b/.gitignore @@ -28,10 +28,10 @@ qemu/sparc-softmmu/ qemu/i386-softmmu/ qemu/x86_64-softmmu/ -qemu/qapi-types.h -qemu/qapi-visit.h -qemu/qapi-types.c -qemu/qapi-visit.c +qemu/qapi-builtin-types.[ch] +qemu/qapi-builtin-visit.[ch] +qemu/qapi-types.[ch] +qemu/qapi-visit.[ch] qemu/qapi-gen-timestamp tags qemu/config-host.ld diff --git a/msvc/unicorn/qapi-builtin-types.c b/msvc/unicorn/qapi-builtin-types.c new file mode 100644 index 00000000..380b6c45 --- /dev/null +++ b/msvc/unicorn/qapi-builtin-types.c @@ -0,0 +1,222 @@ +/* AUTOMATICALLY GENERATED, DO NOT MODIFY */ + +/* + * Built-in QAPI types + * + * Copyright IBM, Corp. 2011 + * Copyright (c) 2013-2018 Red Hat Inc. + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "qapi/dealloc-visitor.h" +#include "qapi-builtin-types.h" +#include "qapi-builtin-visit.h" + +void qapi_free_strList(strList *obj) +{ + Visitor *v; + + if (!obj) { + return; + } + + v = qapi_dealloc_visitor_new(); + visit_type_strList(v, NULL, &obj, NULL); + visit_free(v); +} + +void qapi_free_numberList(numberList *obj) +{ + Visitor *v; + + if (!obj) { + return; + } + + v = qapi_dealloc_visitor_new(); + visit_type_numberList(v, NULL, &obj, NULL); + visit_free(v); +} + +void qapi_free_intList(intList *obj) +{ + Visitor *v; + + if (!obj) { + return; + } + + v = qapi_dealloc_visitor_new(); + visit_type_intList(v, NULL, &obj, NULL); + visit_free(v); +} + +void qapi_free_int8List(int8List *obj) +{ + Visitor *v; + + if (!obj) { + return; + } + + v = qapi_dealloc_visitor_new(); + visit_type_int8List(v, NULL, &obj, NULL); + visit_free(v); +} + +void qapi_free_int16List(int16List *obj) +{ + Visitor *v; + + if (!obj) { + return; + } + + v = qapi_dealloc_visitor_new(); + visit_type_int16List(v, NULL, &obj, NULL); + visit_free(v); +} + +void qapi_free_int32List(int32List *obj) +{ + Visitor *v; + + if (!obj) { + return; + } + + v = qapi_dealloc_visitor_new(); + visit_type_int32List(v, NULL, &obj, NULL); + visit_free(v); +} + +void qapi_free_int64List(int64List *obj) +{ + Visitor *v; + + if (!obj) { + return; + } + + v = qapi_dealloc_visitor_new(); + visit_type_int64List(v, NULL, &obj, NULL); + visit_free(v); +} + +void qapi_free_uint8List(uint8List *obj) +{ + Visitor *v; + + if (!obj) { + return; + } + + v = qapi_dealloc_visitor_new(); + visit_type_uint8List(v, NULL, &obj, NULL); + visit_free(v); +} + +void qapi_free_uint16List(uint16List *obj) +{ + Visitor *v; + + if (!obj) { + return; + } + + v = qapi_dealloc_visitor_new(); + visit_type_uint16List(v, NULL, &obj, NULL); + visit_free(v); +} + +void qapi_free_uint32List(uint32List *obj) +{ + Visitor *v; + + if (!obj) { + return; + } + + v = qapi_dealloc_visitor_new(); + visit_type_uint32List(v, NULL, &obj, NULL); + visit_free(v); +} + +void qapi_free_uint64List(uint64List *obj) +{ + Visitor *v; + + if (!obj) { + return; + } + + v = qapi_dealloc_visitor_new(); + visit_type_uint64List(v, NULL, &obj, NULL); + visit_free(v); +} + +void qapi_free_sizeList(sizeList *obj) +{ + Visitor *v; + + if (!obj) { + return; + } + + v = qapi_dealloc_visitor_new(); + visit_type_sizeList(v, NULL, &obj, NULL); + visit_free(v); +} + +void qapi_free_boolList(boolList *obj) +{ + Visitor *v; + + if (!obj) { + return; + } + + v = qapi_dealloc_visitor_new(); + visit_type_boolList(v, NULL, &obj, NULL); + visit_free(v); +} + +void qapi_free_anyList(anyList *obj) +{ + Visitor *v; + + if (!obj) { + return; + } + + v = qapi_dealloc_visitor_new(); + visit_type_anyList(v, NULL, &obj, NULL); + visit_free(v); +} + +void qapi_free_nullList(nullList *obj) +{ + Visitor *v; + + if (!obj) { + return; + } + + v = qapi_dealloc_visitor_new(); + visit_type_nullList(v, NULL, &obj, NULL); + visit_free(v); +} + +const char *const QType_lookup[] = { + "none", + "qnull", + "qnum", + "qstring", + "qdict", + "qlist", + "qbool", + NULL, +}; diff --git a/msvc/unicorn/qapi-builtin-types.h b/msvc/unicorn/qapi-builtin-types.h new file mode 100644 index 00000000..de60985e --- /dev/null +++ b/msvc/unicorn/qapi-builtin-types.h @@ -0,0 +1,166 @@ +/* AUTOMATICALLY GENERATED, DO NOT MODIFY */ + +/* + * Built-in QAPI types + * + * Copyright IBM, Corp. 2011 + * Copyright (c) 2013-2018 Red Hat Inc. + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + */ + +#ifndef QAPI_BUILTIN_TYPES_H +#define QAPI_BUILTIN_TYPES_H + +/* #include "qapi/util.h" */ + +typedef struct strList strList; + +typedef struct numberList numberList; + +typedef struct intList intList; + +typedef struct int8List int8List; + +typedef struct int16List int16List; + +typedef struct int32List int32List; + +typedef struct int64List int64List; + +typedef struct uint8List uint8List; + +typedef struct uint16List uint16List; + +typedef struct uint32List uint32List; + +typedef struct uint64List uint64List; + +typedef struct sizeList sizeList; + +typedef struct boolList boolList; + +typedef struct anyList anyList; + +typedef struct nullList nullList; + +typedef enum QType { + QTYPE_NONE = 0, + QTYPE_QNULL = 1, + QTYPE_QNUM = 2, + QTYPE_QSTRING = 3, + QTYPE_QDICT = 4, + QTYPE_QLIST = 5, + QTYPE_QBOOL = 6, + QTYPE__MAX = 7, +} QType; + +extern const char *const QType_lookup[]; + +struct strList { + strList *next; + char *value; +}; + +void qapi_free_strList(strList *obj); + +struct numberList { + numberList *next; + double value; +}; + +void qapi_free_numberList(numberList *obj); + +struct intList { + intList *next; + int64_t value; +}; + +void qapi_free_intList(intList *obj); + +struct int8List { + int8List *next; + int8_t value; +}; + +void qapi_free_int8List(int8List *obj); + +struct int16List { + int16List *next; + int16_t value; +}; + +void qapi_free_int16List(int16List *obj); + +struct int32List { + int32List *next; + int32_t value; +}; + +void qapi_free_int32List(int32List *obj); + +struct int64List { + int64List *next; + int64_t value; +}; + +void qapi_free_int64List(int64List *obj); + +struct uint8List { + uint8List *next; + uint8_t value; +}; + +void qapi_free_uint8List(uint8List *obj); + +struct uint16List { + uint16List *next; + uint16_t value; +}; + +void qapi_free_uint16List(uint16List *obj); + +struct uint32List { + uint32List *next; + uint32_t value; +}; + +void qapi_free_uint32List(uint32List *obj); + +struct uint64List { + uint64List *next; + uint64_t value; +}; + +void qapi_free_uint64List(uint64List *obj); + +struct sizeList { + sizeList *next; + uint64_t value; +}; + +void qapi_free_sizeList(sizeList *obj); + +struct boolList { + boolList *next; + bool value; +}; + +void qapi_free_boolList(boolList *obj); + +struct anyList { + anyList *next; + QObject *value; +}; + +void qapi_free_anyList(anyList *obj); + +struct nullList { + nullList *next; + QNull *value; +}; + +void qapi_free_nullList(nullList *obj); + +#endif /* QAPI_BUILTIN_TYPES_H */ diff --git a/msvc/unicorn/qapi-builtin-visit.c b/msvc/unicorn/qapi-builtin-visit.c new file mode 100644 index 00000000..6801bb97 --- /dev/null +++ b/msvc/unicorn/qapi-builtin-visit.c @@ -0,0 +1,488 @@ +/* AUTOMATICALLY GENERATED, DO NOT MODIFY */ + +/* + * Built-in QAPI visitors + * + * Copyright IBM, Corp. 2011 + * Copyright (C) 2014-2018 Red Hat, Inc. + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "qemu-common.h" +#include "qapi/error.h" +#include "qapi-builtin-visit.h" + +void visit_type_strList(Visitor *v, const char *name, strList **obj, Error **errp) +{ + Error *err = NULL; + strList *tail; + size_t size = sizeof(**obj); + + visit_start_list(v, name, (GenericList **)obj, size, &err); + if (err) { + goto out; + } + + for (tail = *obj; tail; + tail = (strList *)visit_next_list(v, (GenericList *)tail, size)) { + visit_type_str(v, NULL, &tail->value, &err); + if (err) { + break; + } + } + + if (!err) { + visit_check_list(v, &err); + } + visit_end_list(v, (void **)obj); + if (err && visit_is_input(v)) { + qapi_free_strList(*obj); + *obj = NULL; + } +out: + error_propagate(errp, err); +} + +void visit_type_numberList(Visitor *v, const char *name, numberList **obj, Error **errp) +{ + Error *err = NULL; + numberList *tail; + size_t size = sizeof(**obj); + + visit_start_list(v, name, (GenericList **)obj, size, &err); + if (err) { + goto out; + } + + for (tail = *obj; tail; + tail = (numberList *)visit_next_list(v, (GenericList *)tail, size)) { + visit_type_number(v, NULL, &tail->value, &err); + if (err) { + break; + } + } + + if (!err) { + visit_check_list(v, &err); + } + visit_end_list(v, (void **)obj); + if (err && visit_is_input(v)) { + qapi_free_numberList(*obj); + *obj = NULL; + } +out: + error_propagate(errp, err); +} + +void visit_type_intList(Visitor *v, const char *name, intList **obj, Error **errp) +{ + Error *err = NULL; + intList *tail; + size_t size = sizeof(**obj); + + visit_start_list(v, name, (GenericList **)obj, size, &err); + if (err) { + goto out; + } + + for (tail = *obj; tail; + tail = (intList *)visit_next_list(v, (GenericList *)tail, size)) { + visit_type_int(v, NULL, &tail->value, &err); + if (err) { + break; + } + } + + if (!err) { + visit_check_list(v, &err); + } + visit_end_list(v, (void **)obj); + if (err && visit_is_input(v)) { + qapi_free_intList(*obj); + *obj = NULL; + } +out: + error_propagate(errp, err); +} + +void visit_type_int8List(Visitor *v, const char *name, int8List **obj, Error **errp) +{ + Error *err = NULL; + int8List *tail; + size_t size = sizeof(**obj); + + visit_start_list(v, name, (GenericList **)obj, size, &err); + if (err) { + goto out; + } + + for (tail = *obj; tail; + tail = (int8List *)visit_next_list(v, (GenericList *)tail, size)) { + visit_type_int8(v, NULL, &tail->value, &err); + if (err) { + break; + } + } + + if (!err) { + visit_check_list(v, &err); + } + visit_end_list(v, (void **)obj); + if (err && visit_is_input(v)) { + qapi_free_int8List(*obj); + *obj = NULL; + } +out: + error_propagate(errp, err); +} + +void visit_type_int16List(Visitor *v, const char *name, int16List **obj, Error **errp) +{ + Error *err = NULL; + int16List *tail; + size_t size = sizeof(**obj); + + visit_start_list(v, name, (GenericList **)obj, size, &err); + if (err) { + goto out; + } + + for (tail = *obj; tail; + tail = (int16List *)visit_next_list(v, (GenericList *)tail, size)) { + visit_type_int16(v, NULL, &tail->value, &err); + if (err) { + break; + } + } + + if (!err) { + visit_check_list(v, &err); + } + visit_end_list(v, (void **)obj); + if (err && visit_is_input(v)) { + qapi_free_int16List(*obj); + *obj = NULL; + } +out: + error_propagate(errp, err); +} + +void visit_type_int32List(Visitor *v, const char *name, int32List **obj, Error **errp) +{ + Error *err = NULL; + int32List *tail; + size_t size = sizeof(**obj); + + visit_start_list(v, name, (GenericList **)obj, size, &err); + if (err) { + goto out; + } + + for (tail = *obj; tail; + tail = (int32List *)visit_next_list(v, (GenericList *)tail, size)) { + visit_type_int32(v, NULL, &tail->value, &err); + if (err) { + break; + } + } + + if (!err) { + visit_check_list(v, &err); + } + visit_end_list(v, (void **)obj); + if (err && visit_is_input(v)) { + qapi_free_int32List(*obj); + *obj = NULL; + } +out: + error_propagate(errp, err); +} + +void visit_type_int64List(Visitor *v, const char *name, int64List **obj, Error **errp) +{ + Error *err = NULL; + int64List *tail; + size_t size = sizeof(**obj); + + visit_start_list(v, name, (GenericList **)obj, size, &err); + if (err) { + goto out; + } + + for (tail = *obj; tail; + tail = (int64List *)visit_next_list(v, (GenericList *)tail, size)) { + visit_type_int64(v, NULL, &tail->value, &err); + if (err) { + break; + } + } + + if (!err) { + visit_check_list(v, &err); + } + visit_end_list(v, (void **)obj); + if (err && visit_is_input(v)) { + qapi_free_int64List(*obj); + *obj = NULL; + } +out: + error_propagate(errp, err); +} + +void visit_type_uint8List(Visitor *v, const char *name, uint8List **obj, Error **errp) +{ + Error *err = NULL; + uint8List *tail; + size_t size = sizeof(**obj); + + visit_start_list(v, name, (GenericList **)obj, size, &err); + if (err) { + goto out; + } + + for (tail = *obj; tail; + tail = (uint8List *)visit_next_list(v, (GenericList *)tail, size)) { + visit_type_uint8(v, NULL, &tail->value, &err); + if (err) { + break; + } + } + + if (!err) { + visit_check_list(v, &err); + } + visit_end_list(v, (void **)obj); + if (err && visit_is_input(v)) { + qapi_free_uint8List(*obj); + *obj = NULL; + } +out: + error_propagate(errp, err); +} + +void visit_type_uint16List(Visitor *v, const char *name, uint16List **obj, Error **errp) +{ + Error *err = NULL; + uint16List *tail; + size_t size = sizeof(**obj); + + visit_start_list(v, name, (GenericList **)obj, size, &err); + if (err) { + goto out; + } + + for (tail = *obj; tail; + tail = (uint16List *)visit_next_list(v, (GenericList *)tail, size)) { + visit_type_uint16(v, NULL, &tail->value, &err); + if (err) { + break; + } + } + + if (!err) { + visit_check_list(v, &err); + } + visit_end_list(v, (void **)obj); + if (err && visit_is_input(v)) { + qapi_free_uint16List(*obj); + *obj = NULL; + } +out: + error_propagate(errp, err); +} + +void visit_type_uint32List(Visitor *v, const char *name, uint32List **obj, Error **errp) +{ + Error *err = NULL; + uint32List *tail; + size_t size = sizeof(**obj); + + visit_start_list(v, name, (GenericList **)obj, size, &err); + if (err) { + goto out; + } + + for (tail = *obj; tail; + tail = (uint32List *)visit_next_list(v, (GenericList *)tail, size)) { + visit_type_uint32(v, NULL, &tail->value, &err); + if (err) { + break; + } + } + + if (!err) { + visit_check_list(v, &err); + } + visit_end_list(v, (void **)obj); + if (err && visit_is_input(v)) { + qapi_free_uint32List(*obj); + *obj = NULL; + } +out: + error_propagate(errp, err); +} + +void visit_type_uint64List(Visitor *v, const char *name, uint64List **obj, Error **errp) +{ + Error *err = NULL; + uint64List *tail; + size_t size = sizeof(**obj); + + visit_start_list(v, name, (GenericList **)obj, size, &err); + if (err) { + goto out; + } + + for (tail = *obj; tail; + tail = (uint64List *)visit_next_list(v, (GenericList *)tail, size)) { + visit_type_uint64(v, NULL, &tail->value, &err); + if (err) { + break; + } + } + + if (!err) { + visit_check_list(v, &err); + } + visit_end_list(v, (void **)obj); + if (err && visit_is_input(v)) { + qapi_free_uint64List(*obj); + *obj = NULL; + } +out: + error_propagate(errp, err); +} + +void visit_type_sizeList(Visitor *v, const char *name, sizeList **obj, Error **errp) +{ + Error *err = NULL; + sizeList *tail; + size_t size = sizeof(**obj); + + visit_start_list(v, name, (GenericList **)obj, size, &err); + if (err) { + goto out; + } + + for (tail = *obj; tail; + tail = (sizeList *)visit_next_list(v, (GenericList *)tail, size)) { + visit_type_size(v, NULL, &tail->value, &err); + if (err) { + break; + } + } + + if (!err) { + visit_check_list(v, &err); + } + visit_end_list(v, (void **)obj); + if (err && visit_is_input(v)) { + qapi_free_sizeList(*obj); + *obj = NULL; + } +out: + error_propagate(errp, err); +} + +void visit_type_boolList(Visitor *v, const char *name, boolList **obj, Error **errp) +{ + Error *err = NULL; + boolList *tail; + size_t size = sizeof(**obj); + + visit_start_list(v, name, (GenericList **)obj, size, &err); + if (err) { + goto out; + } + + for (tail = *obj; tail; + tail = (boolList *)visit_next_list(v, (GenericList *)tail, size)) { + visit_type_bool(v, NULL, &tail->value, &err); + if (err) { + break; + } + } + + if (!err) { + visit_check_list(v, &err); + } + visit_end_list(v, (void **)obj); + if (err && visit_is_input(v)) { + qapi_free_boolList(*obj); + *obj = NULL; + } +out: + error_propagate(errp, err); +} + +void visit_type_anyList(Visitor *v, const char *name, anyList **obj, Error **errp) +{ + Error *err = NULL; + anyList *tail; + size_t size = sizeof(**obj); + + visit_start_list(v, name, (GenericList **)obj, size, &err); + if (err) { + goto out; + } + + for (tail = *obj; tail; + tail = (anyList *)visit_next_list(v, (GenericList *)tail, size)) { + visit_type_any(v, NULL, &tail->value, &err); + if (err) { + break; + } + } + + if (!err) { + visit_check_list(v, &err); + } + visit_end_list(v, (void **)obj); + if (err && visit_is_input(v)) { + qapi_free_anyList(*obj); + *obj = NULL; + } +out: + error_propagate(errp, err); +} + +void visit_type_nullList(Visitor *v, const char *name, nullList **obj, Error **errp) +{ + Error *err = NULL; + nullList *tail; + size_t size = sizeof(**obj); + + visit_start_list(v, name, (GenericList **)obj, size, &err); + if (err) { + goto out; + } + + for (tail = *obj; tail; + tail = (nullList *)visit_next_list(v, (GenericList *)tail, size)) { + visit_type_null(v, NULL, &tail->value, &err); + if (err) { + break; + } + } + + if (!err) { + visit_check_list(v, &err); + } + visit_end_list(v, (void **)obj); + if (err && visit_is_input(v)) { + qapi_free_nullList(*obj); + *obj = NULL; + } +out: + error_propagate(errp, err); +} + +void visit_type_QType(Visitor *v, const char *name, QType *obj, Error **errp) +{ + int value = *obj; + visit_type_enum(v, name, &value, QType_lookup, errp); + *obj = value; +} diff --git a/msvc/unicorn/qapi-builtin-visit.h b/msvc/unicorn/qapi-builtin-visit.h new file mode 100644 index 00000000..d9402e67 --- /dev/null +++ b/msvc/unicorn/qapi-builtin-visit.h @@ -0,0 +1,36 @@ +/* AUTOMATICALLY GENERATED, DO NOT MODIFY */ + +/* + * Built-in QAPI visitors + * + * Copyright IBM, Corp. 2011 + * Copyright (C) 2014-2018 Red Hat, Inc. + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + */ + +#ifndef QAPI_BUILTIN_VISIT_H +#define QAPI_BUILTIN_VISIT_H + +#include "qapi/visitor.h" +#include "qapi-builtin-types.h" + +void visit_type_strList(Visitor *v, const char *name, strList **obj, Error **errp); +void visit_type_numberList(Visitor *v, const char *name, numberList **obj, Error **errp); +void visit_type_intList(Visitor *v, const char *name, intList **obj, Error **errp); +void visit_type_int8List(Visitor *v, const char *name, int8List **obj, Error **errp); +void visit_type_int16List(Visitor *v, const char *name, int16List **obj, Error **errp); +void visit_type_int32List(Visitor *v, const char *name, int32List **obj, Error **errp); +void visit_type_int64List(Visitor *v, const char *name, int64List **obj, Error **errp); +void visit_type_uint8List(Visitor *v, const char *name, uint8List **obj, Error **errp); +void visit_type_uint16List(Visitor *v, const char *name, uint16List **obj, Error **errp); +void visit_type_uint32List(Visitor *v, const char *name, uint32List **obj, Error **errp); +void visit_type_uint64List(Visitor *v, const char *name, uint64List **obj, Error **errp); +void visit_type_sizeList(Visitor *v, const char *name, sizeList **obj, Error **errp); +void visit_type_boolList(Visitor *v, const char *name, boolList **obj, Error **errp); +void visit_type_anyList(Visitor *v, const char *name, anyList **obj, Error **errp); +void visit_type_nullList(Visitor *v, const char *name, nullList **obj, Error **errp); +void visit_type_QType(Visitor *v, const char *name, QType *obj, Error **errp); + +#endif /* QAPI_BUILTIN_VISIT_H */ diff --git a/msvc/unicorn/qapi-types.c b/msvc/unicorn/qapi-types.c index ea58db39..05fccd92 100644 --- a/msvc/unicorn/qapi-types.c +++ b/msvc/unicorn/qapi-types.c @@ -15,30 +15,6 @@ #include "qapi-types.h" #include "qapi-visit.h" -void qapi_free_DummyForceArrays(DummyForceArrays *obj) -{ - Visitor *v; - - if (!obj) { - return; - } - - v = qapi_dealloc_visitor_new(); - visit_type_DummyForceArrays(v, NULL, &obj, NULL); - visit_free(v); -} - -const char *const QType_lookup[] = { - "none", - "qnull", - "qnum", - "qstring", - "qdict", - "qlist", - "qbool", - NULL, -}; - const char *const QapiErrorClass_lookup[] = { "GenericError", "CommandNotFound", @@ -49,6 +25,18 @@ const char *const QapiErrorClass_lookup[] = { NULL, }; +const char *const X86CPURegister32_lookup[] = { + "EAX", + "EBX", + "ECX", + "EDX", + "ESP", + "EBP", + "ESI", + "EDI", + NULL, +}; + void qapi_free_X86CPUFeatureWordInfo(X86CPUFeatureWordInfo *obj) { Visitor *v; @@ -75,19 +63,7 @@ void qapi_free_X86CPUFeatureWordInfoList(X86CPUFeatureWordInfoList *obj) visit_free(v); } -const char *const X86CPURegister32_lookup[] = { - "EAX", - "EBX", - "ECX", - "EDX", - "ESP", - "EBP", - "ESI", - "EDI", - NULL, -}; - -void qapi_free_anyList(anyList *obj) +void qapi_free_DummyForceArrays(DummyForceArrays *obj) { Visitor *v; @@ -96,188 +72,6 @@ void qapi_free_anyList(anyList *obj) } v = qapi_dealloc_visitor_new(); - visit_type_anyList(v, NULL, &obj, NULL); - visit_free(v); -} - -void qapi_free_boolList(boolList *obj) -{ - Visitor *v; - - if (!obj) { - return; - } - - v = qapi_dealloc_visitor_new(); - visit_type_boolList(v, NULL, &obj, NULL); - visit_free(v); -} - -void qapi_free_int16List(int16List *obj) -{ - Visitor *v; - - if (!obj) { - return; - } - - v = qapi_dealloc_visitor_new(); - visit_type_int16List(v, NULL, &obj, NULL); - visit_free(v); -} - -void qapi_free_int32List(int32List *obj) -{ - Visitor *v; - - if (!obj) { - return; - } - - v = qapi_dealloc_visitor_new(); - visit_type_int32List(v, NULL, &obj, NULL); - visit_free(v); -} - -void qapi_free_int64List(int64List *obj) -{ - Visitor *v; - - if (!obj) { - return; - } - - v = qapi_dealloc_visitor_new(); - visit_type_int64List(v, NULL, &obj, NULL); - visit_free(v); -} - -void qapi_free_int8List(int8List *obj) -{ - Visitor *v; - - if (!obj) { - return; - } - - v = qapi_dealloc_visitor_new(); - visit_type_int8List(v, NULL, &obj, NULL); - visit_free(v); -} - -void qapi_free_intList(intList *obj) -{ - Visitor *v; - - if (!obj) { - return; - } - - v = qapi_dealloc_visitor_new(); - visit_type_intList(v, NULL, &obj, NULL); - visit_free(v); -} - -void qapi_free_nullList(nullList *obj) -{ - Visitor *v; - - if (!obj) { - return; - } - - v = qapi_dealloc_visitor_new(); - visit_type_nullList(v, NULL, &obj, NULL); - visit_free(v); -} - -void qapi_free_numberList(numberList *obj) -{ - Visitor *v; - - if (!obj) { - return; - } - - v = qapi_dealloc_visitor_new(); - visit_type_numberList(v, NULL, &obj, NULL); - visit_free(v); -} - -void qapi_free_sizeList(sizeList *obj) -{ - Visitor *v; - - if (!obj) { - return; - } - - v = qapi_dealloc_visitor_new(); - visit_type_sizeList(v, NULL, &obj, NULL); - visit_free(v); -} - -void qapi_free_strList(strList *obj) -{ - Visitor *v; - - if (!obj) { - return; - } - - v = qapi_dealloc_visitor_new(); - visit_type_strList(v, NULL, &obj, NULL); - visit_free(v); -} - -void qapi_free_uint16List(uint16List *obj) -{ - Visitor *v; - - if (!obj) { - return; - } - - v = qapi_dealloc_visitor_new(); - visit_type_uint16List(v, NULL, &obj, NULL); - visit_free(v); -} - -void qapi_free_uint32List(uint32List *obj) -{ - Visitor *v; - - if (!obj) { - return; - } - - v = qapi_dealloc_visitor_new(); - visit_type_uint32List(v, NULL, &obj, NULL); - visit_free(v); -} - -void qapi_free_uint64List(uint64List *obj) -{ - Visitor *v; - - if (!obj) { - return; - } - - v = qapi_dealloc_visitor_new(); - visit_type_uint64List(v, NULL, &obj, NULL); - visit_free(v); -} - -void qapi_free_uint8List(uint8List *obj) -{ - Visitor *v; - - if (!obj) { - return; - } - - v = qapi_dealloc_visitor_new(); - visit_type_uint8List(v, NULL, &obj, NULL); + visit_type_DummyForceArrays(v, NULL, &obj, NULL); visit_free(v); } diff --git a/msvc/unicorn/qapi-types.h b/msvc/unicorn/qapi-types.h index c9ea4ec1..dfab1b92 100644 --- a/msvc/unicorn/qapi-types.h +++ b/msvc/unicorn/qapi-types.h @@ -13,163 +13,7 @@ #ifndef QAPI_TYPES_H #define QAPI_TYPES_H -/* #include "qapi/util.h" */ - -#ifndef QAPI_TYPES_BUILTIN -#define QAPI_TYPES_BUILTIN - - -typedef enum QType { - QTYPE_NONE = 0, - QTYPE_QNULL = 1, - QTYPE_QNUM = 2, - QTYPE_QSTRING = 3, - QTYPE_QDICT = 4, - QTYPE_QLIST = 5, - QTYPE_QBOOL = 6, - QTYPE__MAX = 7, -} QType; - -extern const char *const QType_lookup[]; - -typedef struct anyList anyList; - -struct anyList { - anyList *next; - QObject *value; -}; - -void qapi_free_anyList(anyList *obj); - -typedef struct boolList boolList; - -struct boolList { - boolList *next; - bool value; -}; - -void qapi_free_boolList(boolList *obj); - -typedef struct int16List int16List; - -struct int16List { - int16List *next; - int16_t value; -}; - -void qapi_free_int16List(int16List *obj); - -typedef struct int32List int32List; - -struct int32List { - int32List *next; - int32_t value; -}; - -void qapi_free_int32List(int32List *obj); - -typedef struct int64List int64List; - -struct int64List { - int64List *next; - int64_t value; -}; - -void qapi_free_int64List(int64List *obj); - -typedef struct int8List int8List; - -struct int8List { - int8List *next; - int8_t value; -}; - -void qapi_free_int8List(int8List *obj); - -typedef struct intList intList; - -struct intList { - intList *next; - int64_t value; -}; - -void qapi_free_intList(intList *obj); - -typedef struct nullList nullList; - -struct nullList { - nullList *next; - QNull *value; -}; - -void qapi_free_nullList(nullList *obj); - -typedef struct numberList numberList; - -struct numberList { - numberList *next; - double value; -}; - -void qapi_free_numberList(numberList *obj); - -typedef struct sizeList sizeList; - -struct sizeList { - sizeList *next; - uint64_t value; -}; - -void qapi_free_sizeList(sizeList *obj); - -typedef struct strList strList; - -struct strList { - strList *next; - char *value; -}; - -void qapi_free_strList(strList *obj); - -typedef struct uint16List uint16List; - -struct uint16List { - uint16List *next; - uint16_t value; -}; - -void qapi_free_uint16List(uint16List *obj); - -typedef struct uint32List uint32List; - -struct uint32List { - uint32List *next; - uint32_t value; -}; - -void qapi_free_uint32List(uint32List *obj); - -typedef struct uint64List uint64List; - -struct uint64List { - uint64List *next; - uint64_t value; -}; - -void qapi_free_uint64List(uint64List *obj); - -typedef struct uint8List uint8List; - -struct uint8List { - uint8List *next; - uint8_t value; -}; - -void qapi_free_uint8List(uint8List *obj); - -#endif /* QAPI_TYPES_BUILTIN */ - -typedef struct DummyForceArrays DummyForceArrays; +#include "qapi-builtin-types.h" typedef enum QapiErrorClass { QAPI_ERROR_CLASS_GENERICERROR = 0, @@ -183,10 +27,6 @@ typedef enum QapiErrorClass { extern const char *const QapiErrorClass_lookup[]; -typedef struct X86CPUFeatureWordInfo X86CPUFeatureWordInfo; - -typedef struct X86CPUFeatureWordInfoList X86CPUFeatureWordInfoList; - typedef enum X86CPURegister32 { X86_CPU_REGISTER32_EAX = 0, X86_CPU_REGISTER32_EBX = 1, @@ -201,11 +41,11 @@ typedef enum X86CPURegister32 { extern const char *const X86CPURegister32_lookup[]; -struct DummyForceArrays { - X86CPUFeatureWordInfoList *unused; -}; +typedef struct X86CPUFeatureWordInfo X86CPUFeatureWordInfo; -void qapi_free_DummyForceArrays(DummyForceArrays *obj); +typedef struct X86CPUFeatureWordInfoList X86CPUFeatureWordInfoList; + +typedef struct DummyForceArrays DummyForceArrays; struct X86CPUFeatureWordInfo { int64_t cpuid_input_eax; @@ -224,4 +64,10 @@ struct X86CPUFeatureWordInfoList { void qapi_free_X86CPUFeatureWordInfoList(X86CPUFeatureWordInfoList *obj); +struct DummyForceArrays { + X86CPUFeatureWordInfoList *unused; +}; + +void qapi_free_DummyForceArrays(DummyForceArrays *obj); + #endif /* QAPI_TYPES_H */ diff --git a/msvc/unicorn/qapi-visit.c b/msvc/unicorn/qapi-visit.c index 3df9d4d7..c602828e 100644 --- a/msvc/unicorn/qapi-visit.c +++ b/msvc/unicorn/qapi-visit.c @@ -13,54 +13,9 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qapi/error.h" +#include "qapi/qmp/qerror.h" #include "qapi-visit.h" -void visit_type_DummyForceArrays_members(Visitor *v, DummyForceArrays *obj, Error **errp) -{ - Error *err = NULL; - - visit_type_X86CPUFeatureWordInfoList(v, "unused", &obj->unused, &err); - if (err) { - goto out; - } - -out: - error_propagate(errp, err); -} - -void visit_type_DummyForceArrays(Visitor *v, const char *name, DummyForceArrays **obj, Error **errp) -{ - Error *err = NULL; - - visit_start_struct(v, name, (void **)obj, sizeof(DummyForceArrays), &err); - if (err) { - goto out; - } - if (!*obj) { - goto out_obj; - } - visit_type_DummyForceArrays_members(v, *obj, &err); - if (err) { - goto out_obj; - } - visit_check_struct(v, &err); -out_obj: - visit_end_struct(v, (void **)obj); - if (err && visit_is_input(v)) { - qapi_free_DummyForceArrays(*obj); - *obj = NULL; - } -out: - error_propagate(errp, err); -} - -void visit_type_QType(Visitor *v, const char *name, QType *obj, Error **errp) -{ - int value = *obj; - visit_type_enum(v, name, &value, QType_lookup, errp); - *obj = value; -} - void visit_type_QapiErrorClass(Visitor *v, const char *name, QapiErrorClass *obj, Error **errp) { int value = *obj; @@ -68,6 +23,13 @@ void visit_type_QapiErrorClass(Visitor *v, const char *name, QapiErrorClass *obj *obj = value; } +void visit_type_X86CPURegister32(Visitor *v, const char *name, X86CPURegister32 *obj, Error **errp) +{ + int value = *obj; + visit_type_enum(v, name, &value, X86CPURegister32_lookup, errp); + *obj = value; +} + void visit_type_X86CPUFeatureWordInfo_members(Visitor *v, X86CPUFeatureWordInfo *obj, Error **errp) { Error *err = NULL; @@ -152,472 +114,39 @@ out: error_propagate(errp, err); } -void visit_type_X86CPURegister32(Visitor *v, const char *name, X86CPURegister32 *obj, Error **errp) -{ - int value = *obj; - visit_type_enum(v, name, &value, X86CPURegister32_lookup, errp); - *obj = value; -} - -void visit_type_anyList(Visitor *v, const char *name, anyList **obj, Error **errp) +void visit_type_DummyForceArrays_members(Visitor *v, DummyForceArrays *obj, Error **errp) { Error *err = NULL; - anyList *tail; - size_t size = sizeof(**obj); - visit_start_list(v, name, (GenericList **)obj, size, &err); + visit_type_X86CPUFeatureWordInfoList(v, "unused", &obj->unused, &err); if (err) { goto out; } - for (tail = *obj; tail; - tail = (anyList *)visit_next_list(v, (GenericList *)tail, size)) { - visit_type_any(v, NULL, &tail->value, &err); - if (err) { - break; - } - } +out: + error_propagate(errp, err); +} - if (!err) { - visit_check_list(v, &err); +void visit_type_DummyForceArrays(Visitor *v, const char *name, DummyForceArrays **obj, Error **errp) +{ + Error *err = NULL; + + visit_start_struct(v, name, (void **)obj, sizeof(DummyForceArrays), &err); + if (err) { + goto out; } - visit_end_list(v, (void **)obj); + if (!*obj) { + goto out_obj; + } + visit_type_DummyForceArrays_members(v, *obj, &err); + if (err) { + goto out_obj; + } + visit_check_struct(v, &err); +out_obj: + visit_end_struct(v, (void **)obj); if (err && visit_is_input(v)) { - qapi_free_anyList(*obj); - *obj = NULL; - } -out: - error_propagate(errp, err); -} - -void visit_type_boolList(Visitor *v, const char *name, boolList **obj, Error **errp) -{ - Error *err = NULL; - boolList *tail; - size_t size = sizeof(**obj); - - visit_start_list(v, name, (GenericList **)obj, size, &err); - if (err) { - goto out; - } - - for (tail = *obj; tail; - tail = (boolList *)visit_next_list(v, (GenericList *)tail, size)) { - visit_type_bool(v, NULL, &tail->value, &err); - if (err) { - break; - } - } - - if (!err) { - visit_check_list(v, &err); - } - visit_end_list(v, (void **)obj); - if (err && visit_is_input(v)) { - qapi_free_boolList(*obj); - *obj = NULL; - } -out: - error_propagate(errp, err); -} - -void visit_type_int16List(Visitor *v, const char *name, int16List **obj, Error **errp) -{ - Error *err = NULL; - int16List *tail; - size_t size = sizeof(**obj); - - visit_start_list(v, name, (GenericList **)obj, size, &err); - if (err) { - goto out; - } - - for (tail = *obj; tail; - tail = (int16List *)visit_next_list(v, (GenericList *)tail, size)) { - visit_type_int16(v, NULL, &tail->value, &err); - if (err) { - break; - } - } - - if (!err) { - visit_check_list(v, &err); - } - visit_end_list(v, (void **)obj); - if (err && visit_is_input(v)) { - qapi_free_int16List(*obj); - *obj = NULL; - } -out: - error_propagate(errp, err); -} - -void visit_type_int32List(Visitor *v, const char *name, int32List **obj, Error **errp) -{ - Error *err = NULL; - int32List *tail; - size_t size = sizeof(**obj); - - visit_start_list(v, name, (GenericList **)obj, size, &err); - if (err) { - goto out; - } - - for (tail = *obj; tail; - tail = (int32List *)visit_next_list(v, (GenericList *)tail, size)) { - visit_type_int32(v, NULL, &tail->value, &err); - if (err) { - break; - } - } - - if (!err) { - visit_check_list(v, &err); - } - visit_end_list(v, (void **)obj); - if (err && visit_is_input(v)) { - qapi_free_int32List(*obj); - *obj = NULL; - } -out: - error_propagate(errp, err); -} - -void visit_type_int64List(Visitor *v, const char *name, int64List **obj, Error **errp) -{ - Error *err = NULL; - int64List *tail; - size_t size = sizeof(**obj); - - visit_start_list(v, name, (GenericList **)obj, size, &err); - if (err) { - goto out; - } - - for (tail = *obj; tail; - tail = (int64List *)visit_next_list(v, (GenericList *)tail, size)) { - visit_type_int64(v, NULL, &tail->value, &err); - if (err) { - break; - } - } - - if (!err) { - visit_check_list(v, &err); - } - visit_end_list(v, (void **)obj); - if (err && visit_is_input(v)) { - qapi_free_int64List(*obj); - *obj = NULL; - } -out: - error_propagate(errp, err); -} - -void visit_type_int8List(Visitor *v, const char *name, int8List **obj, Error **errp) -{ - Error *err = NULL; - int8List *tail; - size_t size = sizeof(**obj); - - visit_start_list(v, name, (GenericList **)obj, size, &err); - if (err) { - goto out; - } - - for (tail = *obj; tail; - tail = (int8List *)visit_next_list(v, (GenericList *)tail, size)) { - visit_type_int8(v, NULL, &tail->value, &err); - if (err) { - break; - } - } - - if (!err) { - visit_check_list(v, &err); - } - visit_end_list(v, (void **)obj); - if (err && visit_is_input(v)) { - qapi_free_int8List(*obj); - *obj = NULL; - } -out: - error_propagate(errp, err); -} - -void visit_type_intList(Visitor *v, const char *name, intList **obj, Error **errp) -{ - Error *err = NULL; - intList *tail; - size_t size = sizeof(**obj); - - visit_start_list(v, name, (GenericList **)obj, size, &err); - if (err) { - goto out; - } - - for (tail = *obj; tail; - tail = (intList *)visit_next_list(v, (GenericList *)tail, size)) { - visit_type_int(v, NULL, &tail->value, &err); - if (err) { - break; - } - } - - if (!err) { - visit_check_list(v, &err); - } - visit_end_list(v, (void **)obj); - if (err && visit_is_input(v)) { - qapi_free_intList(*obj); - *obj = NULL; - } -out: - error_propagate(errp, err); -} - -void visit_type_nullList(Visitor *v, const char *name, nullList **obj, Error **errp) -{ - Error *err = NULL; - nullList *tail; - size_t size = sizeof(**obj); - - visit_start_list(v, name, (GenericList **)obj, size, &err); - if (err) { - goto out; - } - - for (tail = *obj; tail; - tail = (nullList *)visit_next_list(v, (GenericList *)tail, size)) { - visit_type_null(v, NULL, &tail->value, &err); - if (err) { - break; - } - } - - if (!err) { - visit_check_list(v, &err); - } - visit_end_list(v, (void **)obj); - if (err && visit_is_input(v)) { - qapi_free_nullList(*obj); - *obj = NULL; - } -out: - error_propagate(errp, err); -} - -void visit_type_numberList(Visitor *v, const char *name, numberList **obj, Error **errp) -{ - Error *err = NULL; - numberList *tail; - size_t size = sizeof(**obj); - - visit_start_list(v, name, (GenericList **)obj, size, &err); - if (err) { - goto out; - } - - for (tail = *obj; tail; - tail = (numberList *)visit_next_list(v, (GenericList *)tail, size)) { - visit_type_number(v, NULL, &tail->value, &err); - if (err) { - break; - } - } - - if (!err) { - visit_check_list(v, &err); - } - visit_end_list(v, (void **)obj); - if (err && visit_is_input(v)) { - qapi_free_numberList(*obj); - *obj = NULL; - } -out: - error_propagate(errp, err); -} - -void visit_type_sizeList(Visitor *v, const char *name, sizeList **obj, Error **errp) -{ - Error *err = NULL; - sizeList *tail; - size_t size = sizeof(**obj); - - visit_start_list(v, name, (GenericList **)obj, size, &err); - if (err) { - goto out; - } - - for (tail = *obj; tail; - tail = (sizeList *)visit_next_list(v, (GenericList *)tail, size)) { - visit_type_size(v, NULL, &tail->value, &err); - if (err) { - break; - } - } - - if (!err) { - visit_check_list(v, &err); - } - visit_end_list(v, (void **)obj); - if (err && visit_is_input(v)) { - qapi_free_sizeList(*obj); - *obj = NULL; - } -out: - error_propagate(errp, err); -} - -void visit_type_strList(Visitor *v, const char *name, strList **obj, Error **errp) -{ - Error *err = NULL; - strList *tail; - size_t size = sizeof(**obj); - - visit_start_list(v, name, (GenericList **)obj, size, &err); - if (err) { - goto out; - } - - for (tail = *obj; tail; - tail = (strList *)visit_next_list(v, (GenericList *)tail, size)) { - visit_type_str(v, NULL, &tail->value, &err); - if (err) { - break; - } - } - - if (!err) { - visit_check_list(v, &err); - } - visit_end_list(v, (void **)obj); - if (err && visit_is_input(v)) { - qapi_free_strList(*obj); - *obj = NULL; - } -out: - error_propagate(errp, err); -} - -void visit_type_uint16List(Visitor *v, const char *name, uint16List **obj, Error **errp) -{ - Error *err = NULL; - uint16List *tail; - size_t size = sizeof(**obj); - - visit_start_list(v, name, (GenericList **)obj, size, &err); - if (err) { - goto out; - } - - for (tail = *obj; tail; - tail = (uint16List *)visit_next_list(v, (GenericList *)tail, size)) { - visit_type_uint16(v, NULL, &tail->value, &err); - if (err) { - break; - } - } - - if (!err) { - visit_check_list(v, &err); - } - visit_end_list(v, (void **)obj); - if (err && visit_is_input(v)) { - qapi_free_uint16List(*obj); - *obj = NULL; - } -out: - error_propagate(errp, err); -} - -void visit_type_uint32List(Visitor *v, const char *name, uint32List **obj, Error **errp) -{ - Error *err = NULL; - uint32List *tail; - size_t size = sizeof(**obj); - - visit_start_list(v, name, (GenericList **)obj, size, &err); - if (err) { - goto out; - } - - for (tail = *obj; tail; - tail = (uint32List *)visit_next_list(v, (GenericList *)tail, size)) { - visit_type_uint32(v, NULL, &tail->value, &err); - if (err) { - break; - } - } - - if (!err) { - visit_check_list(v, &err); - } - visit_end_list(v, (void **)obj); - if (err && visit_is_input(v)) { - qapi_free_uint32List(*obj); - *obj = NULL; - } -out: - error_propagate(errp, err); -} - -void visit_type_uint64List(Visitor *v, const char *name, uint64List **obj, Error **errp) -{ - Error *err = NULL; - uint64List *tail; - size_t size = sizeof(**obj); - - visit_start_list(v, name, (GenericList **)obj, size, &err); - if (err) { - goto out; - } - - for (tail = *obj; tail; - tail = (uint64List *)visit_next_list(v, (GenericList *)tail, size)) { - visit_type_uint64(v, NULL, &tail->value, &err); - if (err) { - break; - } - } - - if (!err) { - visit_check_list(v, &err); - } - visit_end_list(v, (void **)obj); - if (err && visit_is_input(v)) { - qapi_free_uint64List(*obj); - *obj = NULL; - } -out: - error_propagate(errp, err); -} - -void visit_type_uint8List(Visitor *v, const char *name, uint8List **obj, Error **errp) -{ - Error *err = NULL; - uint8List *tail; - size_t size = sizeof(**obj); - - visit_start_list(v, name, (GenericList **)obj, size, &err); - if (err) { - goto out; - } - - for (tail = *obj; tail; - tail = (uint8List *)visit_next_list(v, (GenericList *)tail, size)) { - visit_type_uint8(v, NULL, &tail->value, &err); - if (err) { - break; - } - } - - if (!err) { - visit_check_list(v, &err); - } - visit_end_list(v, (void **)obj); - if (err && visit_is_input(v)) { - qapi_free_uint8List(*obj); + qapi_free_DummyForceArrays(*obj); *obj = NULL; } out: diff --git a/msvc/unicorn/qapi-visit.h b/msvc/unicorn/qapi-visit.h index 314d0631..146055d5 100644 --- a/msvc/unicorn/qapi-visit.h +++ b/msvc/unicorn/qapi-visit.h @@ -13,40 +13,17 @@ #ifndef QAPI_VISIT_H #define QAPI_VISIT_H -#include "qapi/visitor.h" -#include "qapi/qmp/qerror.h" +#include "qapi-builtin-visit.h" #include "qapi-types.h" - -#ifndef QAPI_VISIT_BUILTIN -#define QAPI_VISIT_BUILTIN - -void visit_type_QType(Visitor *v, const char *name, QType *obj, Error **errp); -void visit_type_anyList(Visitor *v, const char *name, anyList **obj, Error **errp); -void visit_type_boolList(Visitor *v, const char *name, boolList **obj, Error **errp); -void visit_type_int16List(Visitor *v, const char *name, int16List **obj, Error **errp); -void visit_type_int32List(Visitor *v, const char *name, int32List **obj, Error **errp); -void visit_type_int64List(Visitor *v, const char *name, int64List **obj, Error **errp); -void visit_type_int8List(Visitor *v, const char *name, int8List **obj, Error **errp); -void visit_type_intList(Visitor *v, const char *name, intList **obj, Error **errp); -void visit_type_nullList(Visitor *v, const char *name, nullList **obj, Error **errp); -void visit_type_numberList(Visitor *v, const char *name, numberList **obj, Error **errp); -void visit_type_sizeList(Visitor *v, const char *name, sizeList **obj, Error **errp); -void visit_type_strList(Visitor *v, const char *name, strList **obj, Error **errp); -void visit_type_uint16List(Visitor *v, const char *name, uint16List **obj, Error **errp); -void visit_type_uint32List(Visitor *v, const char *name, uint32List **obj, Error **errp); -void visit_type_uint64List(Visitor *v, const char *name, uint64List **obj, Error **errp); -void visit_type_uint8List(Visitor *v, const char *name, uint8List **obj, Error **errp); - -#endif /* QAPI_VISIT_BUILTIN */ - -void visit_type_DummyForceArrays_members(Visitor *v, DummyForceArrays *obj, Error **errp); -void visit_type_DummyForceArrays(Visitor *v, const char *name, DummyForceArrays **obj, Error **errp); void visit_type_QapiErrorClass(Visitor *v, const char *name, QapiErrorClass *obj, Error **errp); +void visit_type_X86CPURegister32(Visitor *v, const char *name, X86CPURegister32 *obj, Error **errp); void visit_type_X86CPUFeatureWordInfo_members(Visitor *v, X86CPUFeatureWordInfo *obj, Error **errp); void visit_type_X86CPUFeatureWordInfo(Visitor *v, const char *name, X86CPUFeatureWordInfo **obj, Error **errp); void visit_type_X86CPUFeatureWordInfoList(Visitor *v, const char *name, X86CPUFeatureWordInfoList **obj, Error **errp); -void visit_type_X86CPURegister32(Visitor *v, const char *name, X86CPURegister32 *obj, Error **errp); + +void visit_type_DummyForceArrays_members(Visitor *v, DummyForceArrays *obj, Error **errp); +void visit_type_DummyForceArrays(Visitor *v, const char *name, DummyForceArrays **obj, Error **errp); #endif /* QAPI_VISIT_H */ diff --git a/msvc/unicorn/unicorn/unicorn.vcxproj b/msvc/unicorn/unicorn/unicorn.vcxproj index 2f3ce440..8251c0c1 100644 --- a/msvc/unicorn/unicorn/unicorn.vcxproj +++ b/msvc/unicorn/unicorn/unicorn.vcxproj @@ -236,6 +236,8 @@ copy $(SolutionDir)..\include\unicorn\*.h $(SolutionDir)distro\include\unicorn\ + + @@ -362,6 +364,8 @@ copy $(SolutionDir)..\include\unicorn\*.h $(SolutionDir)distro\include\unicorn\ + + diff --git a/msvc/unicorn/unicorn/unicorn.vcxproj.filters b/msvc/unicorn/unicorn/unicorn.vcxproj.filters index 484e4fde..5c98ce2c 100644 --- a/msvc/unicorn/unicorn/unicorn.vcxproj.filters +++ b/msvc/unicorn/unicorn/unicorn.vcxproj.filters @@ -132,6 +132,12 @@ qemu + + qemu + + + qemu + qemu @@ -226,6 +232,12 @@ qemu + + qemu + + + qemu + qemu diff --git a/msvc/unicorn/unicorn_static/unicorn_static.vcxproj b/msvc/unicorn/unicorn_static/unicorn_static.vcxproj index 3986044d..6314a81d 100644 --- a/msvc/unicorn/unicorn_static/unicorn_static.vcxproj +++ b/msvc/unicorn/unicorn_static/unicorn_static.vcxproj @@ -64,6 +64,8 @@ + + @@ -177,6 +179,8 @@ + + diff --git a/msvc/unicorn/unicorn_static/unicorn_static.vcxproj.filters b/msvc/unicorn/unicorn_static/unicorn_static.vcxproj.filters index f7159fac..02316e15 100644 --- a/msvc/unicorn/unicorn_static/unicorn_static.vcxproj.filters +++ b/msvc/unicorn/unicorn_static/unicorn_static.vcxproj.filters @@ -205,6 +205,12 @@ qemu + + qemu + + + qemu + @@ -518,5 +524,11 @@ qemu + + qemu + + + qemu + \ No newline at end of file diff --git a/qemu/Makefile b/qemu/Makefile index 2d21920f..1be97e21 100644 --- a/qemu/Makefile +++ b/qemu/Makefile @@ -47,8 +47,10 @@ endif include $(SRC_PATH)/rules.mak GENERATED_FILES = config-host.h -GENERATED_FILES += qapi-types.h qapi-visit.h -GENERATED_FILES += qapi-types.c qapi-visit.c +GENERATED_FILES += qapi-builtin-types.h qapi-builtin-types.c +GENERATED_FILES += qapi-types.h qapi-types.c +GENERATED_FILES += qapi-builtin-visit.h qapi-builtin-visit.c +GENERATED_FILES += qapi-visit.h qapi-visit.c # Don't try to regenerate Makefile or configure # We don't generate any of them @@ -151,7 +153,9 @@ $(SRC_PATH)/scripts/qapi-gen.py qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json +qapi-builtin-types.c qapi-builtin-types.h \ qapi-types.c qapi-types.h \ +qapi-builtin-visit.c qapi-builtin-visit.h \ qapi-visit.c qapi-visit.h \ qapi-doc.texi: \ qapi-gen-timestamp ; diff --git a/qemu/Makefile.objs b/qemu/Makefile.objs index ec69e9d0..61590446 100644 --- a/qemu/Makefile.objs +++ b/qemu/Makefile.objs @@ -1,6 +1,8 @@ ####################################################################### # Common libraries for tools and emulators util-obj-y = util/ qobject/ qapi/ qapi-types.o qapi-visit.o +util-obj-y += qapi-builtin-types.o +util-obj-y += qapi-builtin-visit.o ####################################################################### # block-obj-y is code used by both qemu system emulation and qemu-img diff --git a/qemu/scripts/qapi/common.py b/qemu/scripts/qapi/common.py index 5f5a5d76..8dab62f5 100644 --- a/qemu/scripts/qapi/common.py +++ b/qemu/scripts/qapi/common.py @@ -1540,11 +1540,10 @@ class QAPISchema(object): def _def_builtin_type(self, name, json_type, c_type): self._def_entity(QAPISchemaBuiltinType(name, json_type, c_type)) - # TODO As long as we have QAPI_TYPES_BUILTIN to share multiple - # qapi-types.h from a single .c, all arrays of builtins must be - # declared in the first file whether or not they are used. Nicer - # would be to use lazy instantiation, while figuring out how to - # avoid compilation issues with multiple qapi-types.h. + # Instantiating only the arrays that are actually used would + # be nice, but we can't as long as their generated code + # (qapi-builtin-types.[ch]) may be shared by some other + # schema. self._make_array_type(name, None) def _def_predefineds(self): @@ -1997,14 +1996,15 @@ class QAPIGen(object): return '' def write(self, output_dir, fname): - if output_dir: + pathname = os.path.join(output_dir, fname) + dir = os.path.dirname(pathname) + if dir: try: - os.makedirs(output_dir) + os.makedirs(dir) except os.error as e: if e.errno != errno.EEXIST: raise - fd = os.open(os.path.join(output_dir, fname), - os.O_RDWR | os.O_CREAT, 0o666) + fd = os.open(pathname, os.O_RDWR | os.O_CREAT, 0o666) f = os.fdopen(fd, 'r+') text = (self._top(fname) + self._preamble + self._body + self._bottom(fname)) @@ -2054,6 +2054,7 @@ class QAPIGenDoc(QAPIGen): return (QAPIGen._top(self, fname) + '@c AUTOMATICALLY GENERATED, DO NOT MODIFY\n\n') + class QAPISchemaMonolithicCVisitor(QAPISchemaVisitor): def __init__(self, prefix, what, blurb, pydoc): @@ -2065,3 +2066,45 @@ class QAPISchemaMonolithicCVisitor(QAPISchemaVisitor): def write(self, output_dir): self._genc.write(output_dir, self._prefix + self._what + '.c') self._genh.write(output_dir, self._prefix + self._what + '.h') + + +class QAPISchemaModularCVisitor(QAPISchemaVisitor): + + def __init__(self, prefix, what, blurb, pydoc): + self._prefix = prefix + self._what = what + self._blurb = blurb + self._pydoc = pydoc + self._module = {} + + def _module_basename(self, what, name): + if name is None: + return re.sub(r'-', '-builtin-', what) + return self._prefix + what + + def _add_module(self, name, blurb): + genc = QAPIGenC(blurb, self._pydoc) + genh = QAPIGenH(blurb, self._pydoc) + self._module[name] = (genc, genh) + self._set_module(name) + + def _set_module(self, name): + self._genc, self._genh = self._module[name] + + def write(self, output_dir, opt_builtins): + for name in self._module: + if name is None and not opt_builtins: + continue + basename = self._module_basename(self._what, name) + (genc, genh) = self._module[name] + genc.write(output_dir, basename + '.c') + genh.write(output_dir, basename + '.h') + + def _begin_module(self, name): + pass + + def visit_module(self, name): + if len(self._module) != 1: + return + self._add_module(name, self._blurb) + self._begin_module(name) diff --git a/qemu/scripts/qapi/types.py b/qemu/scripts/qapi/types.py index ea05b1c3..19bac122 100644 --- a/qemu/scripts/qapi/types.py +++ b/qemu/scripts/qapi/types.py @@ -167,64 +167,51 @@ void qapi_free_%(c_name)s(%(c_name)s *obj) return ret -class QAPISchemaGenTypeVisitor(QAPISchemaMonolithicCVisitor): +class QAPISchemaGenTypeVisitor(QAPISchemaModularCVisitor): - def __init__(self, prefix, opt_builtins): - QAPISchemaMonolithicCVisitor.__init__( + def __init__(self, prefix): + QAPISchemaModularCVisitor.__init__( self, prefix, 'qapi-types', ' * Schema-defined QAPI types', __doc__) - self._opt_builtins = opt_builtins + self._add_module(None, ' * Built-in QAPI types') + self._genc.preamble_add(mcgen(''' +#include "qemu/osdep.h" +#include "qapi/dealloc-visitor.h" +#include "qapi-builtin-types.h" +#include "qapi-builtin-visit.h" +''')) + self._genh.preamble_add(mcgen(''' +/* #include "qapi/util.h" */ +''')) + + def _begin_module(self, name): self._genc.preamble_add(mcgen(''' #include "qemu/osdep.h" #include "qapi/dealloc-visitor.h" #include "%(prefix)sqapi-types.h" #include "%(prefix)sqapi-visit.h" ''', - prefix=prefix)) + prefix=self._prefix)) self._genh.preamble_add(mcgen(''' -/* #include "qapi/util.h" */ +#include "qapi-builtin-types.h" ''')) - self._btin = '\n' + guardstart('QAPI_TYPES_BUILTIN') def visit_begin(self, schema): # gen_object() is recursive, ensure it doesn't visit the empty type objects_seen.add(schema.the_empty_object_type.name) - def visit_end(self): - # To avoid header dependency hell, we always generate - # declarations for built-in types in our header files and - # simply guard them. See also opt_builtins (command line - # option -b). - self._btin += guardend('QAPI_TYPES_BUILTIN') - self._genh.preamble_add(self._btin) - self._btin = None - def _gen_type_cleanup(self, name): self._genh.add(gen_type_cleanup_decl(name)) self._genc.add(gen_type_cleanup(name)) def visit_enum_type(self, name, info, values, prefix): - # Special case for our lone builtin enum type - # TODO use something cleaner than existence of info - if not info: - self._btin += gen_enum(name, values, prefix) - if self._opt_builtins: - self._genc.add(gen_enum_lookup(name, values, prefix)) - else: - self._genh.preamble_add(gen_enum(name, values, prefix)) - self._genc.add(gen_enum_lookup(name, values, prefix)) + self._genh.preamble_add(gen_enum(name, values, prefix)) + self._genc.add(gen_enum_lookup(name, values, prefix)) def visit_array_type(self, name, info, element_type): - if isinstance(element_type, QAPISchemaBuiltinType): - self._btin += gen_fwd_object_or_array(name) - self._btin += gen_array(name, element_type) - self._btin += gen_type_cleanup_decl(name) - if self._opt_builtins: - self._genc.add(gen_type_cleanup(name)) - else: - self._genh.preamble_add(gen_fwd_object_or_array(name)) - self._genh.add(gen_array(name, element_type)) - self._gen_type_cleanup(name) + self._genh.preamble_add(gen_fwd_object_or_array(name)) + self._genh.add(gen_array(name, element_type)) + self._gen_type_cleanup(name) def visit_object_type(self, name, info, base, members, variants): # Nothing to do for the special empty builtin @@ -247,6 +234,6 @@ class QAPISchemaGenTypeVisitor(QAPISchemaMonolithicCVisitor): self._gen_type_cleanup(name) def gen_types(schema, output_dir, prefix, opt_builtins): - vis = QAPISchemaGenTypeVisitor(prefix, opt_builtins) + vis = QAPISchemaGenTypeVisitor(prefix) schema.visit(vis) - vis.write(output_dir) + vis.write(output_dir, opt_builtins) diff --git a/qemu/scripts/qapi/visit.py b/qemu/scripts/qapi/visit.py index d1e81563..f0eaa8f6 100644 --- a/qemu/scripts/qapi/visit.py +++ b/qemu/scripts/qapi/visit.py @@ -263,13 +263,27 @@ out: c_name=c_name(name)) -class QAPISchemaGenVisitVisitor(QAPISchemaMonolithicCVisitor): +class QAPISchemaGenVisitVisitor(QAPISchemaModularCVisitor): - def __init__(self, prefix, opt_builtins): - QAPISchemaMonolithicCVisitor.__init__( + def __init__(self, prefix): + QAPISchemaModularCVisitor.__init__( self, prefix, 'qapi-visit', ' * Schema-defined QAPI visitors', __doc__) - self._opt_builtins = opt_builtins + self._add_module(None, ' * Built-in QAPI visitors') + self._genc.preamble_add(mcgen(''' +#include "qemu/osdep.h" +#include "qemu-common.h" +#include "qapi/error.h" +#include "qapi-builtin-visit.h" +''')) + self._genh.preamble_add(mcgen(''' +#include "qapi/visitor.h" +#include "qapi-builtin-types.h" + +''', + prefix=prefix)) + + def _begin_module(self, name): self._genc.preamble_add(mcgen(''' #include "qemu/osdep.h" #include "qemu-common.h" @@ -277,51 +291,21 @@ class QAPISchemaGenVisitVisitor(QAPISchemaMonolithicCVisitor): #include "qapi/qmp/qerror.h" #include "%(prefix)sqapi-visit.h" ''', - prefix=prefix)) + prefix=self._prefix)) self._genh.preamble_add(mcgen(''' -#include "qapi/visitor.h" +#include "qapi-builtin-visit.h" #include "%(prefix)sqapi-types.h" ''', - prefix=prefix)) - self._btin = guardstart('QAPI_VISIT_BUILTIN') - - - def visit_begin(self, schema): - self.decl = '' - self.defn = '' - self._btin = '\n' + guardstart('QAPI_VISIT_BUILTIN') - - def visit_end(self): - # To avoid header dependency hell, we always generate - # declarations for built-in types in our header files and - # simply guard them. See also opt_builtins (command line - # option -b). - self._btin += guardend('QAPI_VISIT_BUILTIN') - self._genh.preamble_add(self._btin) - self._btin = None + prefix=self._prefix)) def visit_enum_type(self, name, info, values, prefix): - # Special case for our lone builtin enum type - # TODO use something cleaner than existence of info - if not info: - self._btin += gen_visit_decl(name, scalar=True) - if self._opt_builtins: - self._genc.add(gen_visit_enum(name)) - else: - self._genh.add(gen_visit_decl(name, scalar=True)) - self._genc.add(gen_visit_enum(name)) + self._genh.add(gen_visit_decl(name, scalar=True)) + self._genc.add(gen_visit_enum(name)) def visit_array_type(self, name, info, element_type): - decl = gen_visit_decl(name) - defn = gen_visit_list(name, element_type) - if isinstance(element_type, QAPISchemaBuiltinType): - self._btin += decl - if self._opt_builtins: - self._genc.add(defn) - else: - self._genh.add(decl) - self._genc.add(defn) + self._genh.add(gen_visit_decl(name)) + self._genc.add(gen_visit_list(name, element_type)) def visit_object_type(self, name, info, base, members, variants): # Nothing to do for the special empty builtin @@ -341,6 +325,6 @@ class QAPISchemaGenVisitVisitor(QAPISchemaMonolithicCVisitor): self._genc.add(gen_visit_alternate(name, variants)) def gen_visit(schema, output_dir, prefix, opt_builtins): - vis = QAPISchemaGenVisitVisitor(prefix, opt_builtins) + vis = QAPISchemaGenVisitVisitor(prefix) schema.visit(vis) - vis.write(output_dir) + vis.write(output_dir, opt_builtins)