| Issue |
171620
|
| Summary |
[clang-format] .clang-format files inconsistently require whitespace at the end of the file
|
| Labels |
clang-format
|
| Assignees |
|
| Reporter |
flpeters
|
clang-format is properly lenient when parsing .clang-format files. A YAML document *can* begin with three hyphens (`---`) and end with three periods (`...`), but leaving one or both of them out doesn't trouble clang-format. All three examples below work as expected:
```YAML
BasedOnStyle: LLVM
```
```YAML
---
BasedOnStyle: LLVM
```
```YAML
BasedOnStyle: LLVM
...
```
However if a user decides to put the symbols in properly, then and only then does clang-format expect an empty newline (or even just a single whitespace) after the three periods.
```YAML
---
BasedOnStyle: GNU
...
# Mandatory Newline
```
If there is nothing after the periods, then clang-format does not work. This file will fail:
```YAML
---
BasedOnStyle: GNU
...
```
When run from the command line, clang-format will report the following error:
```
.clang-format:3:1: error: unknown key '...'
...
^~~
Error reading .clang-format: Invalid argument
```
The first full example in the [documentation](https://clang.llvm.org/docs/ClangFormatStyleOptions.html) actually shows this last incorrect version, and makes no mention of the required newline. In my opinion the parser reading the .clang-format file should *not* require any whitespace after the periods, just like all the other cases.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs