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

RE: Warning for missing sentinel arguments

From: Bert Huijben <bert_at_qqmail.nl>
Date: Tue, 19 Nov 2013 13:48:54 +0100

> -----Original Message-----
> From: Bert Huijben [mailto:bert_at_qqmail.nl]
> Sent: dinsdag 19 november 2013 13:23
> To: 'Julian Foad'; 'Ben Reser'
> Cc: dev_at_subversion.apache.org
> Subject: RE: Warning for missing sentinel arguments
>
>
>
> > -----Original Message-----
> > From: Julian Foad [mailto:julianfoad_at_btopenworld.com]
> > Sent: dinsdag 19 november 2013 12:39
> > To: Ben Reser
> > Cc: dev_at_subversion.apache.org
> > Subject: Re: Warning for missing sentinel arguments
> >
> > > On 11/18/13 3:03 PM, Julian Foad wrote:
> >
> > >> The patch also changes SVN_NO_ERROR from "0" to "((svn_error_t
> *)0)".
> > This
> > >> has the side effect of detecting other mis-uses: I committed two such
> > fixes
> > >> as http://svn.apache.org/r1543193 and http://svn.apache.org/r1543216
> . I
> > >> can't think of any negative consequences but shout out if you can.
> >
> > Actually, this is a change of a public API and maybe ABI (I'm not sure), and
> > while it might be a good idea in itself it should not be casually changed as
> part
> > of this patch. So I'll leave out that change and not mark svn_cl__try() with
> > SVN_SENTINEL_NULL, since GCC's attribute requires the sentinel argument
> > to be a pointer.
>
> It is just compiler magic and doesn't affect the ABI or API. If such a marking
> would affect either of them it would be a breaking change to mark
> something deprecated.
>
> I'm quite sure the deprecated marking was explicity designed to allow things
> to be marked without breaking it.
>
> Besides we enable this *only* when we detect a compiler that supports the
> annotation.
>
>
> The 0 vs NULL might be a valid argument for this specific function, but I don't
> see how a C compiler could really see the difference in just a simple
> argument list where both must be handed equivalent to the C rules.
> (I don't think the same applies to C++ in general, but luckily we only support
> C)

For future reference: I tried to write something about variable argument lists here. (The word 'variable' misses).
 Of course there is a difference when using typed variable lists.

It is just that 0 is both a valid pointer and a valid integer in C, and there is no way that the compiler can know what the caller of a function intends to pass in this case. (That is why you get warnings with recent gcc versions that try to validate things for you).

Updating the 'svn' internal api to require a SVN_VA_NULL to terminate the list is probably the best solution. (Thanks Julian!)

        Bert
Received on 2013-11-19 13:49:43 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.