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

Re: svn commit: r1398983 - in /subversion/trunk: ./ subversion/include/ subversion/libsvn_ra_serf/ subversion/mod_dav_svn/

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Thu, 18 Oct 2012 23:21:01 +0200

Julian Foad wrote on Thu, Oct 18, 2012 at 21:17:09 +0100:
> > Author: cmpilato
>
> > URL: http://svn.apache.org/viewvc?rev=1398983&view=rev
> > Log:
> > Reintegrate into trunk the 'http-dynamic-prop-namespaces' branch
> > (using a simple 'svn merge BRANCH-URL' with a trunk_at_HEAD client!).
>
> > Modified: subversion/trunk/subversion/mod_dav_svn/deadprops.c
> > +static dav_prop_name *
> > +propname_to_davname(const char *propname, [...]
> > +{     [...]
> > +      colon = strrchr((char *)propname, ':');
>
> deadprops.c:134:26: cast discards '__attribute__((const))' qualifier from pointer target type
>
> Why cast away 'const'?  Standard strrchr() accepts const.
>
> Ugh... What's happening is 'httpd.h' is messing with the standard lib functions:
>
> In /usr/include/apache2/httpd.h:
> [[[
>   /* The C library has functions that allow const to be silently dropped ...
>      these macros detect the drop in maintainer mode, but use the native
>      methods for normal builds  [...] */
> AP_DECLARE(char *) ap_strrchr(char *s, int c);
> AP_DECLARE(const char *) ap_strrchr_c(const char *s, int c);
>
> #ifdef AP_DEBUG
> #  undef strrchr
> #  define strrchr(s, c)  ap_strrchr(s,c)
> #else
> #  define ap_strrchr(s, c)       strrchr(s, c)
> #  define ap_strrchr_c(s, c)     strrchr(s, c)
> #endif
> ]]]
>
> I'm doing an AP_DEBUG build.  If I remove the explicit cast, I see a different warning:
>
> deadprops.c:134:7: warning: passing argument 1 of 'ap_strrchr' discards 'const' qualifier from pointer target type
>
> So neither way works cleanly for me.
>
> But that's an artifact of a badly designed HTTPD header -- it has no business forcing third-party users of HTTPD code to follow their chosen rules for stdlib functions.
>
> We shouldn't have the explicit cast.
>

Agree that httpd headers that consumers (us) have to include shouldn't
be changing the signatures of standard library functions. If httpd does
that, we should ask them to stop doing it. :)

> - Julian
Received on 2012-10-18 23:21:37 CEST

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.