clang-format can be tuned to emulate indent - it’s not 100% perfect match, but 
I’ve been using it for some time to format multi-line macros, e.g. pool_foreach 
and it’s been doing a pretty good job. Config file for that is already in vpp 
source tree (vpp/.clang-format) and used as default for cpp code formatting.

> On 18 Apr 2020, at 13:49, Dave Barach via lists.fd.io 
> <dbarach=cisco....@lists.fd.io> wrote:
> 
> +1, this seems like a viable scheme to me.
>  
> We’ll need to configure the underlying indent engine so that newly-indented 
> code looks as much like the rest of the code as possible.
>  
> The result below wouldn’t preclude automatic cherry-picking, but it would 
> make everyone’s head explode, particularly if one’s favorite code editor 
> likes to “fix” such things:
>  
> if (a)
>   {
>     b = 13;
>     c = 12;
>     /* new code */
>     if(d) {
>             e=this_is_new();
>     }
>     /* end new code */
>   }
>  
> Thanks... Dave
>  
> From: Damjan Marion <dmar...@me.com> 
> Sent: Saturday, April 18, 2020 5:51 AM
> To: Andrew Yourtchenko <ayour...@gmail.com>
> Cc: Dave Barach (dbarach) <dbar...@cisco.com>; Zhang Yuwei 
> <yuwei1.zh...@intel.com>; vpp-dev@lists.fd.io
> Subject: Re: [vpp-dev] Checkstyle script not work in ubuntu
>  
>  
> And this is example of script, which just formats modified lines, instead of 
> re-formating whole file, as we do today.
> With something like this, we can introduce new indent or even move to 
> clang-format without the need to reformat old code….
>  
> https://github.com/llvm-mirror/clang/blob/master/tools/clang-format/clang-format-diff.py
>  
> — 
> Damjan
> 
> 
> On 18 Apr 2020, at 11:00, Damjan Marion via lists.fd.io 
> <dmarion=me....@lists.fd.io> wrote:
>  
>  
> If we decided to stick with old indent, which i still disagree that is right 
> thing to do, can you just compile indent all the time and 
>  modify path so /opt/vpp/…/bin/ comes first. I really don’t like one more 
> option in the top level Makefile.
>  
> — 
> Damjan
> 
> 
> On 18 Apr 2020, at 10:29, Andrew Yourtchenko <ayour...@gmail.com> wrote:
>  
> I made https://gerrit.fd.io/r/#/c/vpp/+/22963/ that you can try and see how 
> it works for you.
>  
> It allows to install the “correct” version of indent into the build tree, so 
> the rest of the system is unaffected.
>  
> --a
> 
> 
> On 11 Apr 2020, at 14:04, Dave Barach via lists.fd.io 
> <dbarach=cisco....@lists.fd.io> wrote:
> 
> 
> The script works fine. You have the wrong version of gnu indent installed. 
> This is the version you need:
>  
> $ indent --version
> GNU indent 2.2.11
>  
> From: vpp-dev@lists.fd.io <vpp-dev@lists.fd.io> On Behalf Of Zhang Yuwei
> Sent: Saturday, April 11, 2020 1:04 AM
> To: vpp-dev@lists.fd.io
> Subject: [vpp-dev] Checkstyle script not work in ubuntu
>  
> Hi Guys,
>             I find checkstyle script doesn’t work normally in ubuntu 
> sometimes that I run make fixstyle in ubuntu and submit the code to gerrit 
> but still fail in checkstyle step. I need to move to centos to make it work, 
> can anybody check this? Thanks a lot.
>  
> Regards,
> Yuwei
>  
>  
>  
> 

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#16104): https://lists.fd.io/g/vpp-dev/message/16104
Mute This Topic: https://lists.fd.io/mt/72939086/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