tlyu at MIT.EDU
Wed Oct 28 16:28:20 EDT 2009
The "great reindent" that we have talked about from time to time will
work as follows. New scripts and make targets, already committed to
trunk, will support the reindentation effort. There are
customizations that Emacs users should use to set up their editor to
conform to our C coding style. At some point this Friday, I will run
"make mark-cstyle" and "make reindent" on the source tree and commit
to the trunk. Before then, I request input on what directories/files
should be excluded from the automatic reindentation, and other
adjustments to the procedure.
I am reconsidering whether it's a good idea to reindent the bulk of
the source tree at once. Even with the exception list that I have
checked into the "make mark-cstyle" target, a lot of C files get
reformatted in ways that reduce readability.
Are there any objections to doing the reindent in stages, rather than
in one huge commit? I realize it presents possible complications, but
if developers who are maintaining branches batch-reindent according to
changes in the trunk, it may be less painful.
I am considering starting with chunks of lib/krb5, then progressing to
all of lib/ and some of the KDC and kadmin directories. One example
of problems with automated reindenting is lib/krb5/asn.1, which has
some problems with comment formatting; the reindent process corrupts
some of the positioning of things like itemized lists in the block
comments. Other examples include the peculiar form of function
prototypes in some of our headers, which have the opening parenthesis
of the function declaration on a new line. Such files will need some
amount of manual adjustment in order for the automated reindenting to
I have committed some changes to the trunk that allow for batch
reindentation, and an Emacs C style definition. If you are an Emacs
user, load src/util/krb5-c-style.el to get the new style defined. It
won't become your default C style, so creating a new C file won't use
the new style automatically. In that case, make sure you set a "-*-"
line (such as below), then run "M-x normal-mode" to reinitialize the
style settings correctly.
At present, there is a "make reindent" target in the top-level
Makefile, using some Emacs Lisp to use our Emacs C style to
selectively reformat files that are marked as supposedly conforming to
our coding style.
At the moment, "make reindent" will unconditionally correct some
whitespace nits such as:
* whitespace at the ends of lines
* lack of trailing newlines
* spaces sandwiched between tabs
It will untabify the file if the file-local variables indicate that
the file should not have tabs. ('indent-tabs-mode: nil')
If the file contains a marker indicating that it conforms to our
coding style, signaled by a first line
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
then it will reindent the entire file. (We don't use 'c-file-style:
"krb5"' because that would cause errors for Emacs users who do not
load our krb5-c-style.el file.) The "make mark-cstyle" target in the
top-level Makefile is intended to insert markers for the files that
we intend to conform to our C coding style, and will probably require
adjustment as we determine what works best.
Development Team Leader
MIT Kerberos Consortium
More information about the krbdev