Sounds good to me, clang-format should be more consistent than indent...

ben

> -----Original Message-----
> From: vpp-dev@lists.fd.io <vpp-dev@lists.fd.io> On Behalf Of Damjan Marion
> via lists.fd.io
> Sent: dimanche 13 décembre 2020 13:16
> To: vpp-dev <vpp-dev@lists.fd.io>
> Subject: [vpp-dev] move to clang-format
> 
> 
> Hi,
> 
> I was playing a bit with clang-format as replacement to gnu indent which
> we use today[1].
> 
> While it is impossible to render exact same result like gnu indent, good
> thing is that clang-format can be used only on lines which are changed in
> the diff so no major reformat is needed. My patch deos exactly that.
> 
> Another good thing is that clang-format can learn about custom foreach
> macros se we can significantly reduce amount of INDENT-OFF/INDENT-ON
> sections in the code. It also properly formats registration macros like
> VLIB_REGISTER_NODE() which again means less INDENT-OFF/INDENT-ON.
> 
> What it cannot deal with is macros which include body of function as
> argument. Three most popular ones are pool_foreach, pool_foreach_index and
> clib_bitmap_foreach. To address this I created patch[2] which adds simpler
> variant of the macros. Instead of writing
> 
> pool_foreach (e, pool ({
>   /* some code */
> }));
> 
> New macro looks like:
> 
> pool_foreach2 (e, pool)
>   /* some code */
> 
> Here we have option to either maintain both macros, or do one-shot
> replacement.
> 
> As we plan to move to ubuntu 20.04 post 21.01 release, and that comes with
> lot of gnu indent pain, it might be also good time to move to clang-
> format. It is obvious that gnu indent is on the sunset of it’s existence
> and no new development happening for years.
> 
> Thoughts?
> 
> —
> Damjan
> 
> [1] https://gerrit.fd.io/r/c/vpp/+/30395
> [2] https://gerrit.fd.io/r/c/vpp/+/30393
> 
> 
> 
> 
> 

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#18325): https://lists.fd.io/g/vpp-dev/message/18325
Mute This Topic: https://lists.fd.io/mt/78925374/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to