Clang-tidying C code: `StructCase` not working

I’m trying to use clang-tidy-17 to enforce identifier conventions in the C codebase I work on. I was surprised that I don’t get any warnings when using this configuration:

Checks: readability-identifier-naming
CheckOptions:
  readability-identifier-naming.StructCase: lower_case

against this source file:

struct badStruct { int foo; };

when the compilation database has the file being built with cc. When the file is compiled as C++ instead according to compile_commands.json, I get the expected warning:

test.c:1:8: warning: invalid case style for struct 'badStruct' [readability-identifier-naming]
    1 | struct badStruct { int foo; };
      |        ^~~~~~~~~
      |        bad_struct

Is this expected behavior? Thanks!

Fixed by [clang-tidy] readability-identifier-naming - fix StructCase and UnionCase in C by PiotrZSL · Pull Request #65202 · llvm/llvm-project · GitHub in Clang-tidy 18.

1 Like

Thank you very much!