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

Re: [patch] c99-isms

From: Matthew Woehlke <mw_triad_at_users.sourceforge.net>
Date: Thu, 26 Mar 2009 12:09:46 -0500

C. Michael Pilato wrote:
> Matthew Woehlke wrote:
>> I'm trying to build svn 1.6.0 (and previously 1.5.6, which had the same
>> problems) on one-and-a-half* machines that lack a c99 compiler. This
>> causes problems because svn uses a c99 convention of initializing
>> structs with "non-static" data.
>>
>> The attached patch is needed for compilation to succeed on these
>> platforms. Generally speaking, these problems are:
>> - struct initialization with "non-const" data
>> - comma after last item in an enum
>> - initialize function pointers to NULL (use '0' instead)
>
> Now, you do realize that we only aspire to C89/ANSI-C, right? This is
> documented in our www/hacking.html file. So, some of what you recommend is
> fine because it satisfies both C89 and C99. But some of it, methinks, won't
> pan out well for C89 compilers, namely stuff like this:
>
>> diff -ru subversion-1.6.0/subversion/tests/libsvn_client/client-test.c subversion-1.6.0-patched/subversion/tests/libsvn_client/client-test.c
>> --- subversion-1.6.0/subversion/tests/libsvn_client/client-test.c 2008-07-30 08:05:17.000000000 -0700
>> +++ subversion-1.6.0-patched/subversion/tests/libsvn_client/client-test.c 2009-03-25 14:57:04.536775000 -0700
>> @@ -146,7 +146,10 @@
>> apr_array_header_t *targets;
>> apr_getopt_t *os;
>> const int argc = 2;
>> - const char *argv[] = { "opt-test", input, NULL };
>> + const char *argv[3];
>> + argv[0] = "opt-test";
>> + argv[1] = input;
>> + argv[2] = NULL;
>> apr_status_t apr_err;
>> svn_error_t *err;
>
> Cases like this will (I'm guessing) cause problems because they declare
> stack variables after other assignments have been made. We need to move
> those "argv[N] =" lines to after all the variable declarations. Wanna take
> another cut at the patch?

Oops! Actually... I'm not sure how that compiled (given that the
problems I'm having are from non-c99 compilers!) :-). You're right of
course, the assignments should be moved below. Can you do that bit of
cut-and-paste, or do you want a fresh patch?

Thanks for looking at this (and for having pity on me and my pre-c99
compilers ;-) ).

-- 
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
-- 
"We're all mad here. I'm mad. You're mad... You must be, or you wouldn't 
have come here." -- The Cheshire Cat (from Lewis Carroll's Alice in 
Wonderland)
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1432480
Received on 2009-03-26 18:33:55 CET

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.