Skip to content

Checked-in code inconsistent with .clang-format #268

Open
@AnyOldName3

Description

@AnyOldName3

The source code as it exists in the repo has formatting inconsistent with what .clang-format specifies. This means that when the build system automatically applies it, it makes loads of changes to formatting. I suspect this is in part due to different versions of the tool behaving differently when options aren't explicitly set. For context, I have 15.0.1.

One example is EmptyLineAfterAccessModifier introduced in version 13. It's unspecified in .clang-format, so falls back to what's specified in the BasedOnStyle, which is left unset, and defaults to LLVM. The LLVM style sets EmptyLineAfterAccessModifier to Never, so all empty lines after access modifiers get removed from the many files that have them.

I've just had a bit of a look at how you're supposed to make a version independent .clang-format file, and it seems that in general, it can't be done - if you don't specify every setting, new versions change the defaults, so your effective settings change, and if you do specify everything, older versions choke when they hit new settings. I guess that means the only real solution to this is specifying in the readme which version of the tool needs to be used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions