I've committed this patch in r1204407. Largely because Norm was so polite. Also because I'd like to see Subversion being compilable with OWC, and the 'if' form is actually neater. It's obviously not the ideal long-term solution but if this is all that's needed to open the door for Subversion being compiled with OWC, that's great.
The warnings all look like fair compromises between pure and practical. Other compilers give similar but different sets of warnings. Although we could 'purify' the code to resolve some of them, I don't think we particularly need to.
Thank you, Norm.
- Julian
NormW wrote:
> On 14/11/2011 10:32 PM, Daniel Shahaf wrote:
>> Sure. And if someone runs into it in the course of subversion
>> development (rather than OWC development), I'll happily commit the patch
>> that fixes it. Until then, I still think the compiler should be fixed;
>> trying to remove the switch() statement from C is going to be rather
>> Sisyphean.
>
> Well clearly not _every_ switch as OWC does support up to 32-bit ints in
> switch expressions. At the end of the day whether or not Subversion is
> compilable with OWC is a decision of their respective 'owners' and at
> worst this thread highlighted both the shortfalls and a work-around for
> a major one, until one or the other give a(n) 25.4 millimetres.
>
> Have attached a patch against trunk for the suggested switch{} change
> but will leave the warnings (casts,pointers,etc) to experts.
>
> In the event something bites off the patch a copy is given below.
> Regards,
> Norm
>
>> Index: subversion/libsvn_ra_svn/client.c
>> ===================================================================
>> --- subversion/libsvn_ra_svn/client.c (revision 1202544)
>> +++ subversion/libsvn_ra_svn/client.c (working copy)
>> @@ -1166,15 +1166,12 @@
>> static svn_tristate_t
>> optbool_to_tristate(apr_uint64_t v)
>> {
>> - switch (v)
>> - {
>> - case TRUE:
>> - return svn_tristate_true;
>> - case FALSE:
>> - return svn_tristate_false;
>> - default: /* Contains SVN_RA_SVN_UNSPECIFIED_NUMBER */
>> - return svn_tristate_unknown;
>> - }
>> + if (v == TRUE)
>> + return svn_tristate_true;
>> + if (v == FALSE)
>> + return svn_tristate_false;
>> +
>> + return svn_tristate_unknown; /* Contains SVN_RA_SVN_UNSPECIFIED_NUMBER */
>> }
Received on 2011-11-21 10:17:45 CET