Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 14 Apr 2015 10:41:48 +0800
From: Kai Zhao <loverszhao@...il.com>
To: john-dev@...ts.openwall.com
Subject: Re: Coding Style

> Conclusion: having a tool to check coding style is good but we need a
> robust tool to reformat code too.

I use two tools: astyle and indent-2.2.11. To my surprise astyle can fix
many
problems, and indent does even better.

Attachment is the test source code, there are 60 problems and 1 to 25 can be
fixed by tools, and problems from 26 to 60 need manually review.

1. astyle


astyle fixes 15 problems from the top 25 problems by:

astyle --style=kr -t4 -U -H -p -xC79 -c -k3 -z2 <file>


2. indent

indent fixes 21 problems from the top 25 problems by:

indent -kr -i8 -nlp -nbbo -ncs -l79 -lc79 -bad <file>

I think indent is powerful and it is enough for us. Maybe we can patch it
if we
have some additional requires.

I think it would be better if we use indent to automatically format source
code
and checkpatch.pl to check.

Thanks,

Kai

Content of type "text/html" skipped

View attachment "orig_src.c" of type "text/x-csrc" (18743 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.