qemu/qom
Philippe Mathieu-Daudé aaeafa5090 qapi: Inline QERR_INVALID_PARAMETER_TYPE definition (constant value)
Address the comment added in commit 4629ed1e98
("qerror: Finally unused, clean up"), from 2015:

  /*
   * These macros will go away, please don't use
   * in new code, and do not add new ones!
   */

Mechanical transformation using the following
coccinelle semantic patch:

    @match@
    expression errp;
    expression param;
    constant value;
    @@
         error_setg(errp, QERR_INVALID_PARAMETER_TYPE, param, value);

    @script:python strformat depends on match@
    value << match.value;
    fixedfmt; // new var
    @@
    fixedfmt = f'"Invalid parameter type for \'%s\', expected: {value[1:-1]}"'
    coccinelle.fixedfmt = cocci.make_ident(fixedfmt)

    @replace@
    expression match.errp;
    expression match.param;
    constant match.value;
    identifier strformat.fixedfmt;
    @@
    -    error_setg(errp, QERR_INVALID_PARAMETER_TYPE, param, value);
    +    error_setg(errp, fixedfmt, param);

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240312141343.3168265-7-armbru@redhat.com>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
2024-04-24 09:50:58 +02:00
..
container.c qom/container: remove .instance_size initializer from container_info 2020-06-10 12:09:59 -04:00
meson.build meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
object.c qapi: Inline QERR_INVALID_PARAMETER_TYPE definition (constant value) 2024-04-24 09:50:58 +02:00
object_interfaces.c qom/object_interfaces: Clean up global variable shadowing 2023-10-06 13:27:48 +02:00
qom-hmp-cmds.c qom: Move HMP commands from monitor/ to qom/ 2023-02-04 07:56:54 +01:00
qom-qmp-cmds.c qapi qdev qom: Elide redundant has_FOO in generated C 2022-12-14 20:05:07 +01:00
qom-qobject.c error: Eliminate error_propagate() manually 2020-07-10 15:18:08 +02:00
trace-events docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00