Skip to content

[clang-format] Fix breaking change in 20.1.0 by automatically falling back to Cpp formatting if C formatting fails #132832

Closed
@sean-mcmanus

Description

@sean-mcmanus

@owenca The PR at #128287 broke the case where a .c file is formatted in a folder with a .clang-format with Language: Cpp (and no "Language: C").

Can you make it not be a breaking change by automatically falling back to formatting with Cpp if no C language block is specified in .clang-format instead of giving an error?

Or do you recommend a higher level tooling layer detect the failure and change use --assume-filename=file.cpp instead of file.c as a workaround or what?

i.e. command line clang-format test.c gives "Configuration file(s) do(es) not support C".

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions