Skip to content

clang-tidy modernize-use-std-format breaks enums when used with '%x', and fails replacements when signed stdint types are used. #150343

@DaveBrantonCTCT

Description

@DaveBrantonCTCT

These examples illustrate the two problems

int8_t int_8_value;
printf("%d", int_8_value) ;

Will fail to replace correctly. The int8_t will cause this error message, and the replacement will be skipped.

Unknown corresponding signed type for non-BuiltinType 'int8_t'
SomeEnum enum_value;
printf("%x %d", enum_value) ;

This example will proceed with the replacement, but will fail to add the necessary cast to the enum's underlying type, and so the format string will break your build.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions