On Tue, Sep 26, 2017 at 10:49 PM, Sylvestre Ledru <sle...@mozilla.com>
wrote:
>> clang-format messes up really badly many macros.
>> For example nsElementTable.cpp becomes unreadable.
>
> Yeah, for this kind of structure & presentation layout, we should just
ignore the formatting on these.
>
> It is hard for reformatting tools to know exactly to do with such
patterns.

For this you can use:

/* clang-format off */
...manually aligned macro stuff...
/* clang-format on */

I think that is preferable. When we did a big sweep on NSS we took a little
time out to find things that we wanted to preserve in this way and added
these guards.

Sometimes the macros can be tweaked to fix this, but that can come later.
For example, we had macros that were being used to wrap multiple (x,
sizeof(x)) in parameter lists, those had a semicolon in the macro and
clang-format interpreted that line as being a declaration rather than a
code block. The code was in the form TEST_P(x, y) { MACRO(blah) } and
clang-format broke the line after the "x,". Moving the semi-colon out fixed
it. But those are just nits.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to