Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 22 Jun 2015 19:26:55 +0800
From: Kai Zhao <loverszhao@...il.com>
To: john-dev@...ts.openwall.com
Subject: Re: Coding Style

I have created a john-1.8.0 mirror to test the result of indent.

https://github.com/loverszhaokai/john_core_coding_style/commit/078aa5d4465c4b2bb5710ead5993dde9532db52c

command: indent -kr -i8 -ts8 -nlp -ci4 -nbbo -ncs -l80 -lc80 -bad -il0
 src/*.[ch]
indent version: GNU indent 2.2.11

There are about 9 breakages by indent. I created a demo for breakages.
The attached files origin.c is the origin file which are the current coding
style of john core. And the result.c is the formatted result by the indent
command. The diff.txt is the output of 'diff origin.c result.c'. Maybe there
are also other breakages, but I think the 9 breakages are the most
concerned.

You can see that indent does help and does break. I think manual
review is a must if we use any source code format tools, since any
tools maybe make breakages.

Should we use indent ? Or should we patch indent ?

I think some of breaks such as the case below (b2) can be supported
by patching.

if (condition)
if (condition) {
        do_something();
        do_someting();
}

Thanks for your advice.


Thanks,

Kai

Content of type "text/html" skipped

View attachment "diff.txt" of type "text/plain" (1871 bytes)

View attachment "orig.c" of type "text/x-csrc" (1256 bytes)

View attachment "result.c" of type "text/x-csrc" (1327 bytes)

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ