Skip to content

Instantly share code, notes, and snippets.

@airglow923
Last active November 19, 2024 05:37
Show Gist options
  • Save airglow923/c3313233d4ecadbdba56636f1e705ca6 to your computer and use it in GitHub Desktop.
Save airglow923/c3313233d4ecadbdba56636f1e705ca6 to your computer and use it in GitHub Desktop.
clang-tidy readability-identifier-naming for GCC's naming convention
CheckOptions:
- key: readability-identifier-naming.ClassCase
value: lower_case
- key: readability-identifier-naming.ClassMemberCase
value: lower_case
- key: readability-identifier-naming.ClassMemberPrefix
value: s_
- key: readability-identifier-naming.EnumCase
value: lower_case
- key: readability-identifier-naming.EnumConstantCase
value: lower_case
- key: readability-identifier-naming.FunctionCase
value: lower_case
- key: readability-identifier-naming.GlobalConstantCase
value: lower_case
- key: readability-identifier-naming.MacroDefinitionCase
value: aNy_CasE # use either UPPER_CASE or lower_case depending on the context
- key: readability-identifier-naming.MemberCase
value: lower_case
- key: readability-identifier-naming.MemberPrefix
value: m_
- key: readability-identifier-naming.NamespaceCase
value: aNy_CasE
- key: readability-identifier-naming.ParameterCase
value: lower_case
- key: readability-identifier-naming.StaticConstantCase
value: lower_case
- key: readability-identifier-naming.StaticVariableCase
value: lower_case
- key: readability-identifier-naming.TemplateParameterCase
value: CamelCase
- key: readability-identifier-naming.TypeAliasCase
value: lower_case
- key: readability-identifier-naming.TypedefCase
value: lower_case
- key: readability-identifier-naming.VariableCase
value: lower_case
- key: readability-identifier-naming.IgnoreMainLikeFunctions
value: 1
@airglow923
Copy link
Author

airglow923 commented Apr 29, 2021

GCC states that

Macros names should be in ALL_CAPS when it's important to be aware that it's a macro (e.g. accessors and simple predicates), but in lowercase (e.g., size_int) where the macro is a wrapper for efficiency that should be considered as a function...

So macros can be in either UPPER_CASE or lower_case depending on the context.

@HTuanPhong
Copy link

" - key: eadability-identifier-naming.FunctionCase" have a typo

@airglow923
Copy link
Author

@HTuanPhong Thanks for pointing that out. Fixed it now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment