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

Re: svn commit: r15287 - in trunk/subversion: libsvn_ra_svn

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2005-07-07 22:55:04 CEST

Garrett Rooney <rooneg@electricjellyfish.net> writes:

> D.J. Heap wrote:
>> + /* Loop through the lock commands. */
>> + for (i = 0; i < locks->nelts; ++i)
>> + {
>> + svn_pool_clear(subpool);
>> + struct lock_cmd *cmd = apr_pcalloc(pool, sizeof(struct lock_cmd));
>> +
>> + svn_ra_svn_item_t *item = &APR_ARRAY_IDX(locks, i,
>> svn_ra_svn_item_t);
>> +
>> + if (item->kind != SVN_RA_SVN_LIST)
>> + return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
>> + "Lock commands should be list of
>> lists\n");
>> There are a number of places in this commit that clear subpools
>> before declaring and initializing scope variables like the above
>> snippet.
>> Obviously it works on some compilers, but MSVC doesn't like it (and
>> refuses to compile)...and I thought it was illegal in C?
>
> It is illegal in c89, but gcc allows it, so it often slips through the
> cracks.

The standard generally uses the term "invalid" rather than "illegal" :)

Recent versions of gcc have -Wdeclaration-after-statement and will
detect such constructs:

../svn/subversion/svnserve/serve.c: In function 'lock_many':
../svn/subversion/svnserve/serve.c:1436: warning: ISO C90 forbids mixed declarations and code
../svn/subversion/svnserve/serve.c:1474: warning: ISO C90 forbids mixed declarations and code
../svn/subversion/svnserve/serve.c: In function 'unlock_many':
../svn/subversion/svnserve/serve.c:1533: warning: ISO C90 forbids mixed declarations and code
../svn/subversion/svnserve/serve.c:1558: warning: ISO C90 forbids mixed declarations and code

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Jul 7 22:56:12 2005

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