Re: [PATCH v3 13/19] scripts/qapi: pull c_name and lstrip from camel_to_upper to caller

Zhao Liu <[email protected]> Wed, 10 Jun 2026 22:42:51 +0800
Newsgroups org.nongnu.qemu-rust,org.nongnu.qemu-devel
Message-ID <[email protected]>
On Tue, May 26, 2026 at 07:56:12PM +0200, Paolo Bonzini wrote:
> Date: Tue, 26 May 2026 19:56:12 +0200
> From: Paolo Bonzini <[email protected]>
> Subject: [PATCH v3 13/19] scripts/qapi: pull c_name and lstrip from
>  camel_to_upper to caller
> X-Mailer: git-send-email 2.54.0
> 
> Allow using camel_to_upper for other languages too.
> 
> In particular, the lstrip() is needed to avoid reserved C identifiers,
> for example:
> 
>     typedef enum __org_qemu_x_Enum {
>         __ORG_QEMU_X_ENUM___ORG_QEMU_X_VALUE,
>         __ORG_QEMU_X_ENUM__MAX,
>     } __org_qemu_x_Enum;
> 
> Insulate Rust from this, since underscores have a different meaning
> in Rust (though only for the sake of warnings).
> 
> Signed-off-by: Paolo Bonzini <[email protected]>
> ---
>  scripts/qapi/common.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Zhao Liu <[email protected]>