This is an archive of the discontinued LLVM Phabricator instance.

sanitizers: increase .clang-format columns to 100
ClosedPublic

Authored by dvyukov on Jul 21 2021, 6:45 AM.

Details

Summary

The current (default) line length is 80 columns.
That's based on old hardware and historical conventions.
There are no existent reasons to keep line length that small,
especially provided that our coding style uses quite lengthy
identifiers. The Linux kernel recently switched to 100,
let's start with 100 as well.

This change intentionally does not re-format code.
Re-formatting is intended to happen incrementally,
or on dir-by-dir basis separately.

Diff Detail

Event Timeline

dvyukov requested review of this revision.Jul 21 2021, 6:45 AM
dvyukov created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2021, 6:45 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
MaskRay accepted this revision.Jul 21 2021, 9:59 AM
This revision is now accepted and ready to land.Jul 21 2021, 9:59 AM
vitalybuka accepted this revision.Jul 21 2021, 2:06 PM

btw how 100 lines work in size-by-side Phabricator?

btw how 100 lines work in size-by-side Phabricator?

Good question.
I've uploaded a test review with a reformatted file:
https://reviews.llvm.org/D106526

It looks good to me. E.g. lines 129, 186, 195 are close to 100 columns and look just fine (at least on my display) and look easier to review in future as a single line.

melver accepted this revision.Jul 22 2021, 12:17 AM
This revision was automatically updated to reflect the committed changes.

This change is inconsistent with the LLVM style: https://llvm.org/docs/CodingStandards.html#id17 - I think it's important that we don't create more divergence in style between different directories/subprojects. Not everyone's going to use clang-format, for instance, making for some weird formatting choices. (admittedly the transition, as more lines are formatted for 100 lines will get a bit weird/haphazard/inconsistent too - but I'm not too fussed about that)

I'd pretty strongly prefer this be reverted and, if desired, discussed across the project as a whole, perhaps.

(also, perhaps these .clang-format files could be deduplicated by moving them to the compiler-rt/lib directory? (I guess there's enough other directories in there that are sticking with 80 cols that that would need more opt-outs than these opt-ins - though perhaps that goes to my original point that that makes even more divergence/variation within the project when it's customized at this fairly narrow granularity that 9 separate directories are opting in to this choice))

xgupta added a subscriber: xgupta.Jul 26 2021, 5:51 PM

This change is inconsistent with the LLVM style: https://llvm.org/docs/CodingStandards.html#id17 - I think it's important that we don't create more divergence in style between different directories/subprojects. Not everyone's going to use clang-format, for instance, making for some weird formatting choices. (admittedly the transition, as more lines are formatted for 100 lines will get a bit weird/haphazard/inconsistent too - but I'm not too fussed about that)

I'd pretty strongly prefer this be reverted and, if desired, discussed across the project as a whole, perhaps.

+1
I use Terminator as terminal emulator which is by default open to fit 80 line columns files. I think 100 is still not adopted worldwide?