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

[PATCH] Clean up definition and use of SVN_NEON_0_25 macro

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2005-10-25 20:15:22 CEST

Is this OK - especially the two tiny changes to the build system?

[[[
Clean up definition and use of SVN_NEON_0_25 macro to avoid compiler warnings.

Define the SVN_NEON_0_25 macro always as either 0 or 1 (never undefined), and
test it consistently with "#if" (never "#ifdef"), so that we can enable the
"undefined; assuming 0" compiler warnings and get none of them. This is the
the only macro that was being defined and tested inconsistently.

* build/ac-macros/neon.m4 (SVN_LIB_NEON, SVN_NEON_CONFIG):
* build/generator/gen_win.py (WinGeneratorBase):
   If we don't define SVN_NEON_0_25 as 1, define it as 0.

* subversion/libsvn_ra_dav/commit.c (do_checkout):
* subversion/libsvn_ra_dav/fetch.c (custom_get_request):
* subversion/libsvn_ra_dav/session.c (handle_creationdate_header, pre_send_hook):
* subversion/libsvn_ra_dav/util.c (parsed_request):
   Use "#if !" instead of "#ifndef" to test SVN_NEON_0_25.
]]]

For my explanation of why we should do this, see
<http://svn.haxx.se/dev/archive-2005-10/0287.shtml>.

- Julian

[[[
Clean up definition and use of SVN_NEON_0_25 macro to avoid compiler warnings.

Define the SVN_NEON_0_25 macro always as either 0 or 1 (never undefined), and
test it consistently with "#if" (never "#ifdef"), so that we can enable the
"undefined; assuming 0" compiler warnings and get none of them. This is the
the only macro that was being defined and tested inconsistently.

* build/ac-macros/neon.m4 (SVN_LIB_NEON, SVN_NEON_CONFIG):
* build/generator/gen_win.py (WinGeneratorBase):
  If we don't define SVN_NEON_0_25 as 1, define it as 0.

* subversion/libsvn_ra_dav/commit.c (do_checkout):
* subversion/libsvn_ra_dav/fetch.c (custom_get_request):
* subversion/libsvn_ra_dav/session.c (handle_creationdate_header, pre_send_hook):
* subversion/libsvn_ra_dav/util.c (parsed_request):
  Use "#if !" instead of "#ifndef" to test SVN_NEON_0_25.
]]]

Index: build/ac-macros/neon.m4
===================================================================
--- build/ac-macros/neon.m4 (revision 16987)
+++ build/ac-macros/neon.m4 (working copy)
@@ -52,7 +52,10 @@ AC_DEFUN(SVN_LIB_NEON,
 
       if test -n "`echo \"$NEON_VERSION\" | grep '^0\.25\.'`" ; then
         AC_DEFINE_UNQUOTED([SVN_NEON_0_25], [1],
- [Defined if have Neon 0.25.x instead of 0.24.7.])
+ [1 if have Neon 0.25.x instead of 0.24.7.])
+ else
+ AC_DEFINE_UNQUOTED([SVN_NEON_0_25], [0],
+ [0 if have Neon 0.24.7 instead of 0.25.x.])
       fi
 
       for svn_allowed_neon in $NEON_ALLOWED_LIST; do
@@ -125,7 +128,10 @@ AC_DEFUN(SVN_NEON_CONFIG,
 
       if test -n "`echo \"$NEON_VERSION\" | grep '^0\.25\.'`" ; then
         AC_DEFINE_UNQUOTED([SVN_NEON_0_25], [1],
- [Defined if have Neon 0.25.x instead of 0.24.7.])
+ [1 if have Neon 0.25.x instead of 0.24.7.])
+ else
+ AC_DEFINE_UNQUOTED([SVN_NEON_0_25], [0],
+ [0 if have Neon 0.24.7 instead of 0.25.x.])
       fi
 
       for svn_allowed_neon in $NEON_ALLOWED_LIST; do
Index: build/generator/gen_win.py
===================================================================
--- build/generator/gen_win.py (revision 16987)
+++ build/generator/gen_win.py (working copy)
@@ -593,6 +593,8 @@ class WinGeneratorBase(GeneratorBase):
     # check if we have a newer neon (0.25.x)
     if self.neon_ver >= 25000:
       fakedefines.append("SVN_NEON_0_25=1")
+ else
+ fakedefines.append("SVN_NEON_0_25=0")
 
     return fakedefines
 
Index: subversion/libsvn_ra_dav/commit.c
===================================================================
--- subversion/libsvn_ra_dav/commit.c (revision 16987)
+++ subversion/libsvn_ra_dav/commit.c (working copy)
@@ -495,7 +495,7 @@ static svn_error_t * do_checkout(commit_
                       "</D:activity-set></D:checkout>", cc->activity_url);
   ne_set_request_body_buffer(req, body, strlen(body));
 
-#ifndef SVN_NEON_0_25
+#if ! SVN_NEON_0_25
   /*
    * We have different const qualifiers here. locn is const char **,
    * but the prototype is void * (as opposed to const void *).
Index: subversion/libsvn_ra_dav/fetch.c
===================================================================
--- subversion/libsvn_ra_dav/fetch.c (revision 16987)
+++ subversion/libsvn_ra_dav/fetch.c (working copy)
@@ -423,7 +423,7 @@ static svn_error_t *custom_get_request(n
   ne_request *req;
   ne_decompress *decompress;
   svn_error_t *err;
-#ifndef SVN_NEON_0_25
+#if ! SVN_NEON_0_25
   int decompress_rv;
 #endif /* ! SVN_NEON_0_25 */
   svn_ra_dav__session_t *ras = ne_get_session_private(sess,
@@ -450,7 +450,7 @@ static svn_error_t *custom_get_request(n
                                url);
     }
 
-#ifndef SVN_NEON_0_25
+#if ! SVN_NEON_0_25
   /* we want to get the Content-Type so that we can figure out whether
      this is an svndiff or a fulltext */
   ne_add_response_header_handler(req, "Content-Type", ne_content_type_handler,
@@ -516,7 +516,7 @@ static svn_error_t *custom_get_request(n
       return cgc.err;
     }
 
-#ifndef SVN_NEON_0_25
+#if ! SVN_NEON_0_25
   if (decompress_rv != 0)
     {
        const char *msg;
Index: subversion/libsvn_ra_dav/session.c
===================================================================
--- subversion/libsvn_ra_dav/session.c (revision 16987)
+++ subversion/libsvn_ra_dav/session.c (working copy)
@@ -910,7 +910,7 @@ static svn_error_t *svn_ra_dav__do_get_u
 }
 
 
-#ifndef SVN_NEON_0_25
+#if ! SVN_NEON_0_25
 /* A callback of type ne_header_handler, invoked when neon encounters
    mod_dav_svn's custom 'creationdate' header in a LOCK response. */
 static void
@@ -1008,7 +1008,7 @@ pre_send_hook(ne_request *req,
           ne_buffer_zappend(header, buf);
         }
 
-#ifndef SVN_NEON_0_25
+#if ! SVN_NEON_0_25
       /* Register callbacks to read any custom 'creationdate' and
          'lock owner' response headers sent by mod_dav_svn. */
       ne_add_response_header_handler(req, SVN_DAV_CREATIONDATE_HEADER,
Index: subversion/libsvn_ra_dav/util.c
===================================================================
--- subversion/libsvn_ra_dav/util.c (revision 16987)
+++ subversion/libsvn_ra_dav/util.c (working copy)
@@ -590,7 +590,7 @@ parsed_request(ne_session *sess,
   ne_xml_parser *success_parser = NULL;
   ne_xml_parser *error_parser = NULL;
   int rv;
-#ifndef SVN_NEON_0_25
+#if ! SVN_NEON_0_25
   int decompress_rv;
 #endif /* ! SVN_NEON_0_25 */
   int code;

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Oct 25 20:45:00 2005

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.