apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject [Fwd: 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 22:47:20 GMT
The patch below solves all Win32 apr/util/iconv build emits (except for some
oddities in apr_want.h that occur early in dependency parsing because dependant
headers don't yet exist, and those warnings are simply silly and can be ignored.)

In fact only two emits remain in httpd 2.0 branch, and those aren't apr issues.

Now we have an issue in APR 1.x that - because we 'dropped' support for LDAPv2
the macro below doesn't exist.  It turns out win32 ldap has never been 'const-
ified' and therefore has 20+ emits when building httpd 2.2 or 2.3.

I'd like to at -least- introduce the 'proper' form, APR_LDAP_UNCONST(), into
apr-util-1.3, and consider it for apr-util-1.2.  But by our versioning rules,
adding it to -1.2 would be 'wrong', no?

So open for discussion ... but I'd like to commit to apr-util-1.3 in the next
day or two, and come to some decision about apr-util-1.2.x.

Bill

-------- Original Message --------
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
From: wrowe@apache.org
Reply-To: dev@apr.apache.org
To: commits@apr.apache.org

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"






Mime
View raw message