[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Results of: [VOTE] New space-before-parens style

From: <kfogel_at_collab.net>
Date: 2006-02-13 03:56:37 CET

"Peter N. Lundblad" <peter@famlundblad.se> writes:
> So, we've decided to reformat all code into a consistent
> no-space-before-parens style.
>
> And now for some scripting, anyone? :-)

   $ cd src/subversion/subversion
   $ svn info | grep "^URL"
   URL: http://svn.collab.net/repos/svn/trunk/subversion
   $ indent --version
   GNU indent 2.2.9
   $ find . -name "*.[ch]" | xargs indent -npcs -nut
   indent: ./libsvn_fs_base/trail.h:202: Warning:Extra )
   $

(I investigated the warning, but saw nothing wrong at that location.)
Anyway:

   $ svn diff
   [... 237,000 line diff omitted :-) ... ]
   $

Much of it looks good. Continuation parameter lines are correctly
adjusted and everything. However, 'indent' also had some unexpected,
and probably undesired, effects. For example:

   +check_lib_versions(void)
    {
   - static const svn_version_checklist_t checklist[] =
   - {
   - { "svn_subr", svn_subr_version },
   - { "svn_repos", svn_repos_version },
   - { "svn_fs", svn_fs_version },
   - { "svn_delta", svn_delta_version },
   - { NULL, NULL }
   - };
   + static const svn_version_checklist_t checklist[] = {
   + {"svn_subr", svn_subr_version},
   + {"svn_repos", svn_repos_version},
   + {"svn_fs", svn_fs_version},
   + {"svn_delta", svn_delta_version},
   + {NULL, NULL}
   + };

Hey, I didn't ask for that! Or what about this:

    /* Array of available subcommands.
     * The entire list must be terminated with an entry of nulls.
     */
   -static const svn_opt_subcommand_desc_t cmd_table[] =
   -{
   +static const svn_opt_subcommand_desc_t cmd_table[] = {
      {"crashtest", subcommand_crashtest, {0}, N_
       ("usage: svnadmin crashtest REPOS_PATH\n\n"
        "Open the repository at REPOS_PATH, then abort, thus simulating\n"
        "a process that crashes while holding an open repository handle.\n"),
   - {0} },
   + {0}},

Hmmm. Stay away from my curly braces, indent.

There are a lot of unrequested changes like that. I'm not sure how to
make them go away. And there doesn't seem to be a way to tell
'indent' to use no defaults and just do exactly what was requested.

Does this mean we're going to have to do it all by hand? It might be
easier to patch the indent sources to do what we want... Let's see:

Grab indent_2.2.9.tar.gz, unpack, look around, in src/args.c change
GNU_SETTINGS_STRING to just "-npcs\0-nut\0", recompile, discover that
it doesn't build out of the box due to some C errors, get the Debian
maintainer's patch against the latest upstream sources, apply, try
again, okay it compiles now, re-run, this time passing no options
since the (new) default does exactly what we want anyway:

   $ svn revert -R .
   $ find . -name "*.[ch]" | xargs ~/src/indent-2.2.9/src/indent
   indent: ./libsvn_fs_base/trail.h:202: Warning:Extra )
   $ svn diff

Nope. It still changes a lot of things besides what -npcs and -nut
ask for. This even happens if I run it with '-gnu' explicitly. I
guess there's some stuff 'indent' just does, whether you want it to or
not. I'm sure it could be hacked, but it's not the trivial hack I
thought it was.

Anyone got any better ideas, before I go further down that road?

-Karl

-- 
www.collab.net  <>  CollabNet  |  Distributed Development On Demand
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Feb 13 05:38:07 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.