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

[patch] c99-isms

From: Matthew Woehlke <mw_triad_at_users.sourceforge.net>
Date: Wed, 25 Mar 2009 18:05:56 -0500

I'm trying to build svn 1.6.0 (and previously 1.5.6, which had the same
problems) on one-and-a-half* machines that lack a c99 compiler. This
causes problems because svn uses a c99 convention of initializing
structs with "non-static" data.

The attached patch is needed for compilation to succeed on these
platforms. Generally speaking, these problems are:
- struct initialization with "non-const" data
- comma after last item in an enum
- initialize function pointers to NULL (use '0' instead)

(* The "half" is AIX, which has a c99-capable compiler, but autoconf is
cleverly breaking it by picking -qlanglvl=ansi to get c89-compliance, at
which point it fails to find the -qlanglvl option to turn on c99 support.)

-- 
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
-- 
"Yoda of Borg am I. Futile is resistance. Assimilate you, I will."
   -- from http://en.wikipedia.org/wiki/Wikipedia:Yet_more_Best_of_BJAODN
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1421373

diff -ru subversion-1.6.0/subversion/libsvn_client/deprecated.c subversion-1.6.0-patched/subversion/libsvn_client/deprecated.c
--- subversion-1.6.0/subversion/libsvn_client/deprecated.c 2009-02-13 12:37:02.000000000 -0800
+++ subversion-1.6.0-patched/subversion/libsvn_client/deprecated.c 2009-03-25 13:03:39.280628000 -0700
@@ -1302,7 +1302,9 @@
                    svn_client_ctx_t *ctx,
                    apr_pool_t *pool)
 {
- struct status3_wrapper_baton swb = { status_func, status_baton };
+ struct status3_wrapper_baton swb;
+ swb.old_func = status_func;
+ swb.old_baton = status_baton;
 
   return svn_client_status4(result_rev, path, revision, status3_wrapper_func,
                             &swb, depth, get_all, update, no_ignore,
diff -ru subversion-1.6.0/subversion/libsvn_client/log.c subversion-1.6.0-patched/subversion/libsvn_client/log.c
--- subversion-1.6.0/subversion/libsvn_client/log.c 2009-02-16 12:35:25.000000000 -0800
+++ subversion-1.6.0-patched/subversion/libsvn_client/log.c 2009-03-25 13:06:47.423297000 -0700
@@ -124,11 +124,12 @@
                             apr_pool_t *pool)
 {
   svn_error_t *err;
- copyfrom_info_t copyfrom_info = { TRUE, NULL, SVN_INVALID_REVNUM, pool };
+ copyfrom_info_t copyfrom_info = { TRUE, NULL, SVN_INVALID_REVNUM, NULL };
   apr_pool_t *sesspool = svn_pool_create(pool);
   svn_ra_session_t *ra_session;
   svn_revnum_t at_rev;
   const char *at_url;
+ copyfrom_info.pool = pool;
 
   SVN_ERR(svn_client__ra_session_from_path(&ra_session, &at_rev, &at_url,
                                            path_or_url, NULL,
diff -ru subversion-1.6.0/subversion/libsvn_client/merge.c subversion-1.6.0-patched/subversion/libsvn_client/merge.c
--- subversion-1.6.0/subversion/libsvn_client/merge.c 2009-02-16 12:35:25.000000000 -0800
+++ subversion-1.6.0-patched/subversion/libsvn_client/merge.c 2009-03-25 13:19:36.663294000 -0700
@@ -1274,9 +1274,11 @@
           const char *right_label = apr_psprintf(subpool,
                                                  _(".merge-right.r%ld"),
                                                  yours_rev);
- conflict_resolver_baton_t conflict_baton =
- { merge_b->ctx->conflict_func, merge_b->ctx->conflict_baton,
- &merge_b->conflicted_paths, merge_b->pool };
+ conflict_resolver_baton_t conflict_baton;
+ conflict_baton.wrapped_func = merge_b->ctx->conflict_func;
+ conflict_baton.wrapped_baton = merge_b->ctx->conflict_baton;
+ conflict_baton.conflicted_paths = &merge_b->conflicted_paths;
+ conflict_baton.pool = merge_b->pool;
           SVN_ERR(svn_wc_merge3(&merge_outcome,
                                 older, yours, mine, adm_access,
                                 left_label, right_label, target_label,
@@ -4644,11 +4646,19 @@
   apr_pool_t *iterpool;
   static const svn_wc_entry_callbacks2_t walk_callbacks =
     { get_mergeinfo_walk_cb, get_mergeinfo_error_handler };
- struct get_mergeinfo_walk_baton wb =
- { adm_access, children_with_mergeinfo,
- merge_src_canon_path, merge_cmd_baton->target, source_root_url,
- url1, url2, revision1, revision2,
- depth, ra_session, merge_cmd_baton->ctx };
+ struct get_mergeinfo_walk_baton wb;
+ wb.base_access = adm_access;
+ wb.children_with_mergeinfo = children_with_mergeinfo;
+ wb.merge_src_canon_path = merge_src_canon_path;
+ wb.merge_target_path = merge_cmd_baton->target;
+ wb.source_root_url = source_root_url;
+ wb.url1 = url1;
+ wb.url2 = url2;
+ wb.revision1 = revision1;
+ wb.revision2 = revision2;
+ wb.depth = depth;
+ wb.ra_session = ra_session;
+ wb.ctx = merge_cmd_baton->ctx;
 
   /* Cover cases 1), 2), 6), and 7) by walking the WC to get all paths which
      have mergeinfo and/or are switched or are absent from disk or is the
diff -ru subversion-1.6.0/subversion/libsvn_client/mergeinfo.c subversion-1.6.0-patched/subversion/libsvn_client/mergeinfo.c
--- subversion-1.6.0/subversion/libsvn_client/mergeinfo.c 2009-02-07 05:04:28.000000000 -0800
+++ subversion-1.6.0-patched/subversion/libsvn_client/mergeinfo.c 2009-03-25 13:25:53.208368000 -0700
@@ -1008,11 +1008,12 @@
   apr_array_header_t *elidable_paths = apr_array_make(pool, 1,
                                                       sizeof(const char *));
   svn_delta_editor_t *editor = svn_delta_default_editor(pool);
- struct elide_mergeinfo_catalog_cb_baton cb = {elidable_paths,
- mergeinfo_catalog,
- pool};
+ struct elide_mergeinfo_catalog_cb_baton cb;
   int i;
 
+ cb.elidable_paths = elidable_paths;
+ cb.mergeinfo_catalog = mergeinfo_catalog;
+ cb.result_pool = pool;
   editor->open_root = elide_mergeinfo_catalog_open_root;
   editor->open_directory = elide_mergeinfo_catalog_open_directory;
 
diff -ru subversion-1.6.0/subversion/libsvn_fs_fs/fs_fs.c subversion-1.6.0-patched/subversion/libsvn_fs_fs/fs_fs.c
--- subversion-1.6.0/subversion/libsvn_fs_fs/fs_fs.c 2009-02-27 08:51:52.000000000 -0800
+++ subversion-1.6.0-patched/subversion/libsvn_fs_fs/fs_fs.c 2009-03-25 12:56:55.727671000 -0700
@@ -7039,7 +7039,11 @@
                 void *cancel_baton,
                 apr_pool_t *pool)
 {
- struct pack_baton pb = { fs, notify_func, notify_baton,
- cancel_func, cancel_baton };
+ struct pack_baton pb;
+ pb.fs = fs;
+ pb.notify_func = notify_func;
+ pb.notify_baton = notify_baton;
+ pb.cancel_func = cancel_func;
+ pb.cancel_baton = cancel_baton;
   return svn_fs_fs__with_write_lock(fs, pack_body, &pb, pool);
 }
diff -ru subversion-1.6.0/subversion/libsvn_subr/cache-memcache.c subversion-1.6.0-patched/subversion/libsvn_subr/cache-memcache.c
--- subversion-1.6.0/subversion/libsvn_subr/cache-memcache.c 2008-10-21 14:31:17.000000000 -0700
+++ subversion-1.6.0-patched/subversion/libsvn_subr/cache-memcache.c 2009-03-25 12:44:28.782372000 -0700
@@ -243,7 +243,8 @@
 
   wrapper->vtable = &memcache_vtable;
   wrapper->cache_internal = cache;
- wrapper->error_handler = wrapper->error_baton = NULL;
+ wrapper->error_handler = 0;
+ wrapper->error_baton = 0;
 
   *cache_p = wrapper;
   return SVN_NO_ERROR;
diff -ru subversion-1.6.0/subversion/libsvn_subr/dirent_uri.c subversion-1.6.0-patched/subversion/libsvn_subr/dirent_uri.c
--- subversion-1.6.0/subversion/libsvn_subr/dirent_uri.c 2009-03-10 14:39:21.000000000 -0700
+++ subversion-1.6.0-patched/subversion/libsvn_subr/dirent_uri.c 2009-03-25 12:45:55.654411000 -0700
@@ -47,7 +47,7 @@
 /* Path type definition. Used only by internal functions. */
 typedef enum {
   type_uri,
- type_dirent,
+ type_dirent
 } path_type_t;
 
 
diff -ru subversion-1.6.0/subversion/libsvn_wc/deprecated.c subversion-1.6.0-patched/subversion/libsvn_wc/deprecated.c
--- subversion-1.6.0/subversion/libsvn_wc/deprecated.c 2009-02-15 22:25:05.000000000 -0800
+++ subversion-1.6.0-patched/subversion/libsvn_wc/deprecated.c 2009-03-25 13:30:37.103200000 -0700
@@ -1037,8 +1037,9 @@
                      void *cancel_baton,
                      apr_pool_t *pool)
 {
- svn_wc_entry_callbacks2_t walk_cb2 = { walk_callbacks->found_entry,
- svn_wc__walker_default_error_handler };
+ svn_wc_entry_callbacks2_t walk_cb2;
+ walk_cb2.found_entry = walk_callbacks->found_entry;
+ walk_cb2.handle_error = svn_wc__walker_default_error_handler;
   return svn_wc_walk_entries3(path, adm_access,
                               &walk_cb2, walk_baton, svn_depth_infinity,
                               show_hidden, cancel_func, cancel_baton, pool);
diff -ru subversion-1.6.0/subversion/svn/util.c subversion-1.6.0-patched/subversion/svn/util.c
--- subversion-1.6.0/subversion/svn/util.c 2009-02-13 08:28:37.000000000 -0800
+++ subversion-1.6.0-patched/subversion/svn/util.c 2009-03-25 13:38:25.105721000 -0700
@@ -238,10 +238,15 @@
            "configuration option were not set.\n"));
 
   {
- const char *arguments[] = { merge_tool, base_path, their_path,
- my_path, merged_path, NULL};
+ const char *arguments[6];
     char *cwd;
     apr_status_t status = apr_filepath_get(&cwd, APR_FILEPATH_NATIVE, pool);
+ arguments[0] = merge_tool;
+ arguments[1] = base_path;
+ arguments[2] = their_path;
+ arguments[3] = my_path;
+ arguments[4] = merged_path;
+ arguments[5] = NULL;
     if (status != 0)
       return svn_error_wrap_apr(status, NULL);
     return svn_io_run_cmd(svn_path_internal_style(cwd, pool), merge_tool,
diff -ru subversion-1.6.0/subversion/tests/libsvn_client/client-test.c subversion-1.6.0-patched/subversion/tests/libsvn_client/client-test.c
--- subversion-1.6.0/subversion/tests/libsvn_client/client-test.c 2008-07-30 08:05:17.000000000 -0700
+++ subversion-1.6.0-patched/subversion/tests/libsvn_client/client-test.c 2009-03-25 14:57:04.536775000 -0700
@@ -146,7 +146,10 @@
       apr_array_header_t *targets;
       apr_getopt_t *os;
       const int argc = 2;
- const char *argv[] = { "opt-test", input, NULL };
+ const char *argv[3];
+ argv[0] = "opt-test";
+ argv[1] = input;
+ argv[2] = NULL;
       apr_status_t apr_err;
       svn_error_t *err;
 
diff -ru subversion-1.6.0/subversion/tests/libsvn_subr/opt-test.c subversion-1.6.0-patched/subversion/tests/libsvn_subr/opt-test.c
--- subversion-1.6.0/subversion/tests/libsvn_subr/opt-test.c 2008-09-16 14:48:37.000000000 -0700
+++ subversion-1.6.0-patched/subversion/tests/libsvn_subr/opt-test.c 2009-03-25 14:59:18.561605000 -0700
@@ -132,7 +132,10 @@
       apr_array_header_t *targets;
       apr_getopt_t *os;
       const int argc = 2;
- const char *argv[] = { "opt-test", input, NULL };
+ const char *argv[3];
+ argv[0] = "opt-test";
+ argv[1] = input;
+ argv[2] = NULL;
       apr_status_t apr_err;
       svn_error_t *err;
 
Received on 2009-03-26 16:57:56 CET

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.