David Hendricks has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/38673 )
Change subject: [WIP] Add .clang-format to help with patch formatting ......................................................................
Patch Set 4: Code-Review-2
(3 comments)
I was experimenting with this some more and figured it might help move things along if people can actually see the result on gerrit. There are parts that need more tweaking, so hopefully somebody with more clang-format experience can offer suggestions to fix remaining issues.
https://review.coreboot.org/c/flashrom/+/38673/4/buspirate_spi.c File buspirate_spi.c:
https://review.coreboot.org/c/flashrom/+/38673/4/buspirate_spi.c@148 PS4, Line 148: static const struct buspirate_speeds spispeeds[] = { { "30k", 0x0 }, { "125k", 0x1 }, { "250k", 0x2 }, clang-format seems to have weird rules regarding lists. The only workaround I found for this is to set ColumnLimit to 0, but that has obvious issues with line length.
https://review.coreboot.org/c/flashrom/+/38673/4/chipset_enable.c File chipset_enable.c:
https://review.coreboot.org/c/flashrom/+/38673/4/chipset_enable.c@659 PS4, Line 659: case CHIPSET_300_SERIES_CANNON_POINT: boot_straps = boot_straps_pch8_lp; break; We use case labels inconsistently - some are on their own line and some are condensed so that the entire statement is on a single line.
I suspect we'll want to use the non-condensed format throughout flashrom, i.e. AllowShortCaseLabelsOnASingleLine: false
https://review.coreboot.org/c/flashrom/+/38673/4/dediprog.c File dediprog.c:
https://review.coreboot.org/c/flashrom/+/38673/4/dediprog.c@60 PS4, Line 60: enum dediprog_leds { Alignment of assignments is another area where clang-format seems lacking. We generally don't force alignment of variable assignments, however when the assignments form a list of allowable values such as these enums it's preferable to align the assignments.