[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: Julian Foad <julianfoad_at_btopenworld.com>
Date: Thu, 18 Oct 2012 21:17:09 +0100 (BST)

> 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)
#† define ap_strrchr(s, c)†††††† strrchr(s, c)
#† define ap_strrchr_c(s, c)†††† strrchr(s, c)

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.

- Julian
Received on 2012-10-18 22:17:47 CEST

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