From commits-return-7323-apmail-apr-commits-archive=apr.apache.org@apr.apache.org Mon Jan 30 21:06:49 2006 Return-Path: Delivered-To: apmail-apr-commits-archive@www.apache.org Received: (qmail 84708 invoked from network); 30 Jan 2006 21:06:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 30 Jan 2006 21:06:49 -0000 Received: (qmail 97484 invoked by uid 500); 30 Jan 2006 21:06:48 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 97446 invoked by uid 500); 30 Jan 2006 21:06:47 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 97434 invoked by uid 99); 30 Jan 2006 21:06:47 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jan 2006 13:06:47 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 30 Jan 2006 13:06:46 -0800 Received: (qmail 84565 invoked by uid 65534); 30 Jan 2006 21:06:26 -0000 Message-ID: <20060130210626.84564.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r373590 - in /apr/apr-util/branches/0.9.x/include: apr_ldap.h.in apr_ldap.hnw apr_ldap.hw Date: Mon, 30 Jan 2006 21:06:25 -0000 To: commits@apr.apache.org From: wrowe@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: wrowe Date: Mon Jan 30 13:06:21 2006 New Revision: 373590 URL: http://svn.apache.org/viewcvs?rev=373590&view=rev Log: After careful consideration, I believe this resolves the abuse of the C++ reserved word 'const_cast'; 1. replace const_cast with APR_LDAP_UNCONST() which describes the true results when compiling under v2/MS ldap toolkits. 2. add MS to the 'special exceptions' - their ldap v3 symbols weren't const, causing about 20 compile warnings of httpd. 3. add doxygenation. 4. preserve const_cast for compatibility with httpd 2.0.55 and prior, only in the non-C++ world. Compilation failed within the C++ world anyways. Modified: apr/apr-util/branches/0.9.x/include/apr_ldap.h.in apr/apr-util/branches/0.9.x/include/apr_ldap.hnw apr/apr-util/branches/0.9.x/include/apr_ldap.hw Modified: apr/apr-util/branches/0.9.x/include/apr_ldap.h.in URL: http://svn.apache.org/viewcvs/apr/apr-util/branches/0.9.x/include/apr_ldap.h.in?rev=373590&r1=373589&r2=373590&view=diff ============================================================================== --- apr/apr-util/branches/0.9.x/include/apr_ldap.h.in (original) +++ apr/apr-util/branches/0.9.x/include/apr_ldap.h.in Mon Jan 30 13:06:21 2006 @@ -127,16 +127,33 @@ @ldap_h@ #endif -/* LDAPv2 SDKs don't use const parameters in their prototypes. - * LDAPv3 SDKs do use const. When compiling with LDAPv2 SDKs, const_cast - * casts away the constness, but won't under LDAPv3 +/* MS & v2 LDAP SDKs don't use const parameters in their prototypes, + * LDAPv3 SDKs mostly use const. Bridge the gap for clean compilation. */ -#if LDAP_VERSION_MAX <= 2 -#define const_cast(x) ((char *)(x)) + +#if LDAP_VERSION_MAX <= 2 || APR_HAS_MICROSOFT_LDAPSDK || defined(DOXYGEN) +/** + * Cast away constness to compile cleanly against v2 and MS LDAP SDKs + * @param conststr The value to un-constify on older LDAP SDKs + */ +#define APR_LDAP_UNCONST(conststr) ((char *)(conststr)) #else -#define const_cast(x) (x) -#endif +#define APR_LDAP_UNCONST(conststr) (conststr) +#endif +#ifndef __cplusplus +/** + * Cast away constness to compile against v2 and MS LDAP SDKs + * @param conststr The value to un-constify on older LDAP SDKs + * @bug The apr_ldap.h macro const_cast violated three rules; + * it was a C++ reserved keyword, it violated the uppercase-only + * style guideline for apr macros, and it was not namespace protected. + * It exists here soley to avoid breaking legacy sources using APR 0.9. + * @deprecated @see APR_LDAP_UNCONST + */ +#define const_cast(conststr) APR_LDAP_UNCONST(conststr) +#endif + #include "apr_ldap_url.h" /* Define some errors that are mysteriously gone from OpenLDAP 2.x */ Modified: apr/apr-util/branches/0.9.x/include/apr_ldap.hnw URL: http://svn.apache.org/viewcvs/apr/apr-util/branches/0.9.x/include/apr_ldap.hnw?rev=373590&r1=373589&r2=373590&view=diff ============================================================================== --- apr/apr-util/branches/0.9.x/include/apr_ldap.hnw (original) +++ apr/apr-util/branches/0.9.x/include/apr_ldap.hnw Mon Jan 30 13:06:21 2006 @@ -125,18 +125,33 @@ #define LDAPS_PORT LDAP_SSL_PORT #endif +/* MS & v2 LDAP SDKs don't use const parameters in their prototypes, + * LDAPv3 SDKs mostly use const. Bridge the gap for clean compilation. + */ -/* LDAPv2 SDKs don't use const parameters in their prototypes. - * LDAPv3 SDKs do use const. When compiling with LDAPv2 SDKs, const_cast - * casts away the constness, but won't under LDAPv3 +#if LDAP_VERSION_MAX <= 2 || APR_HAS_MICROSOFT_LDAPSDK || defined(DOXYGEN) +/** + * Cast away constness to compile cleanly against v2 and MS LDAP SDKs + * @param conststr The value to un-constify on older LDAP SDKs */ -#if LDAP_VERSION_MAX <= 2 -#define const_cast(x) ((char *)(x)) +#define APR_LDAP_UNCONST(conststr) ((char *)(conststr)) #else -#define const_cast(x) (x) +#define APR_LDAP_UNCONST(conststr) (conststr) #endif - +#ifndef __cplusplus +/** + * Cast away constness to compile against v2 and MS LDAP SDKs + * @param conststr The value to un-constify on older LDAP SDKs + * @bug The apr_ldap.h macro const_cast violated three rules; + * it was a C++ reserved keyword, it violated the uppercase-only + * style guideline for apr macros, and it was not namespace protected. + * It exists here soley to avoid breaking legacy sources using APR 0.9. + * @deprecated @see APR_LDAP_UNCONST + */ +#define const_cast(conststr) APR_LDAP_UNCONST(conststr) +#endif + #include "apr_ldap_url.h" /* Define some errors that are mysteriously gone from OpenLDAP 2.x */ Modified: apr/apr-util/branches/0.9.x/include/apr_ldap.hw URL: http://svn.apache.org/viewcvs/apr/apr-util/branches/0.9.x/include/apr_ldap.hw?rev=373590&r1=373589&r2=373590&view=diff ============================================================================== --- apr/apr-util/branches/0.9.x/include/apr_ldap.hw (original) +++ apr/apr-util/branches/0.9.x/include/apr_ldap.hw Mon Jan 30 13:06:21 2006 @@ -128,17 +128,32 @@ #define LDAPS_PORT LDAP_SSL_PORT #endif +/* MS & v2 LDAP SDKs don't use const parameters in their prototypes, + * LDAPv3 SDKs mostly use const. Bridge the gap for clean compilation. + */ -/* LDAPv2 SDKs don't use const parameters in their prototypes. - * LDAPv3 SDKs do use const. When compiling with LDAPv2 SDKs, const_cast - * casts away the constness, but won't under LDAPv3 +#if LDAP_VERSION_MAX <= 2 || APR_HAS_MICROSOFT_LDAPSDK || defined(DOXYGEN) +/** + * Cast away constness to compile cleanly against v2 and MS LDAP SDKs + * @param conststr The value to un-constify on older LDAP SDKs */ -#if LDAP_VERSION_MAX <= 2 -#define const_cast(x) ((char *)(x)) +#define APR_LDAP_UNCONST(conststr) ((char *)(conststr)) #else -#define const_cast(x) (x) +#define APR_LDAP_UNCONST(conststr) (conststr) +#endif + +#ifndef __cplusplus +/** + * Cast away constness to compile against v2 and MS LDAP SDKs + * @param conststr The value to un-constify on older LDAP SDKs + * @bug The apr_ldap.h macro const_cast violated three rules; + * it was a C++ reserved keyword, it violated the uppercase-only + * style guideline for apr macros, and it was not namespace protected. + * It exists here soley to avoid breaking legacy sources using APR 0.9. + * @deprecated @see APR_LDAP_UNCONST + */ +#define const_cast(conststr) APR_LDAP_UNCONST(conststr) #endif - #include "apr_ldap_url.h"