Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade fmtlib to support clang-17 #8331

Closed
JaySon-Huang opened this issue Nov 8, 2023 · 1 comment · Fixed by #8332
Closed

Upgrade fmtlib to support clang-17 #8331

JaySon-Huang opened this issue Nov 8, 2023 · 1 comment · Fixed by #8332
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@JaySon-Huang
Copy link
Contributor

Enhancement

Ref #7193

We need to upgrade fmtlib to support clang-17. However, the latest version of fmtlib disable implicit casts from enum/enum class to int, which leads to compile error. We need to resolve those errors with magic_enum::enum_name to print out the enum nam or fmt::underlying to print out the int value.

Reference: fmtlib/fmt#3671

@JaySon-Huang JaySon-Huang added the type/enhancement The issue or PR belongs to an enhancement. label Nov 8, 2023
@JaySon-Huang
Copy link
Contributor Author

  • When we are sure the enum value has corresponding name, we use magic_enum::enum_name to cast it to string
  • When we are not sure the enum value has corresponding name, we use fmt::underlying to cast it to int
    • for example, the enum type defined in kvproto/tipb
  • For some classes, we implement a format_as function to make it printable by fmtlib
    • MppVersion/MPPDataPacketVersion/StringRef/SettingInt/SettingFloat/SettingDouble

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant