Skip to Content.
Sympa Menu

freetds - Re: indent(1) bent

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddyz77 AT tin.it>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: indent(1) bent
  • Date: 19 Oct 2002 19:45:36 +0200


Il sab, 2002-10-19 alle 18:45, James K. Lowden ha scritto:
> Following up on an earlier threat, I worked up a profile for indent that
> we can use to correct the sometimes haphazard format of our .c files. You
> my peruse it at:
>
> http://www.SchemaMania.org/projects/freetds/src/.indent.pro
> also an updated uncommited feckless style guide:
> http://www.SchemaMania.org/projects/freetds/doc/CodingStyle
>
> if you're interested.
>

I like this thread :)

> Issues great and small
> ----------------------
>
> indent(1) relies on .indent.pro in the source code directory. There's no
> such thing as "for the project". Two ideas to provide consistency
> throughout the tree:
>
> 1. keep one file in src and a symlink to it from eg src/dblib, or
> 2. generate them with automake or something.
>
> Suggestions solicited. I'm not sure how well symlinks will persist
> through "make dist", tar, and cvs. Hard links, perhaps?
>

cvs do not handle links (nor symbolic nor hard). Best is the make or
configure (developer have to execute them, so no problem, for users...
do not distribute ?)

> I am relying on
>
> $ gindent --version
> GNU indent 2.2.6
>

Wow, this time my version is updated.

> which has two implications. First, it defaults to GNU standards, which
> IMO is fine (it's very tweakable). Second, "indent *.c" does the right
> thing. Its grandfather, BSD indent, was just weird.
>
> I have run it over dblib.c and convert.c and am mostly happy with the
> results. Try it yourself, please, and see what you think. (Hint: use -st
> to route the output to stdout.)
>

It seem that many difference (I try to minimize them) came from -i5
(many code uses tabs) and -pcs (and similar, space after if , while, for
are present few time).

> switch() is normally handled fine, nicely even, except in this sort of
> case:
>
> switch (dbprocess->tds_socket->minor_version) {
> case 2: return DBTDS_4_2;
> case 6: return DBTDS_4_6;
> default: return DBTDS_UNKNOWN;
>
> no matter what I do, that becomes:
>
> switch (dbprocess->tds_socket->minor_version) {
> case 2:
> return DBTDS_4_2;
> case 6:
> return DBTDS_4_6;
> default:
> return DBTDS_UNKNOWN;
>
> which is just a little pendantic for my tastes, and IMO no clearer. Oh,
> well.
>
> Committing. Please DO NOT COMMIT any indent-related changes at this time.
> Bill Thompson sent us a big messy patch which we're both glad to have and
> hope he'll unmessify. Formatting changes in cvs at this particular stage
> would complicate matters enormously.
>
> Going forward, I suggest indent(1) be used as a separate step in the
> commit process. Run it on the HEAD revision, and apply the results
> (assuming you like them) as a separately commited revision with
> "indent(1)" as the entire cvs log entry for it. That way, it will be
> easier to spot in the log. The only edits you'd want would be to prevent
> indent from affecting some section of code (bracketed by *INDENT-OFF* and
> *INDENT-ON*).
>

Oh, is not a problem... I think we should leave a day to one person for
committing all indented code. Do you this that doing so we are not able
to do patch? Just indent modified code before doing patch...

Problem raise from difference. Using CVS for seeing the difference
become very difficult... You have to extract two version manually,
indenting all and then do diff...

> Some folks like to try to time reformatting changes vis a vis a release.
> I think it's more like washing the dishes: sometimes, you just have to do
> it.
>

Leave some time for review indentation. There are no option to declare
indentation like Brian style (variable aligned at first column...). I'll
change: -i8 (using tab for indentation, tab can be changed by your
editor and many editor use automatically tab for indenting) -pcs (there
are few code that use -npcs style). Why -br is in configuration? It do
not specify a full style ?

> Regards,
>
bye
freddy77






Archive powered by MHonArc 2.6.24.

Top of Page