Building Subversion 1.7.5 on Solaris 8 with the vendor (SunPRO) compiler fails with errors of the form
"subversion/libsvn_subr/sqlite.c", line 1208: non-constant initializer: op "NAME" cc: acomp failed for subversion/libsvn_subr/sqlite.c gmake: *** [subversion/libsvn_subr/sqlite.lo] Error 1 To generalize, this code is frowned upon: struct foobar { char *f; char *b; }; int main(void) { char *foo = "foo"; char *bar = "bar"; struct foobar fb = { foo, bar }; return 0; } Compiling the above yields $ cc -c foo.c "foo.c", line 11: non-constant initializer: op "NAME" "foo.c", line 11: non-constant initializer: op "NAME" cc: acomp failed for foo.c Rewriting the struct declaration/assignment as struct foobar fb; fb.f = foo; fb.b = bar; allows the build to proceed. The attached patch does this for the current SVN source and allows Subversion to build on this system. --Daniel -- Daniel Richard G. || sk...@iskunk.org My ASCII-art .sig got a bad case of Times New Roman.
Index: subversion/libsvn_diff/diff_file.c =================================================================== --- subversion/libsvn_diff/diff_file.c (revision 1351858) +++ subversion/libsvn_diff/diff_file.c (working copy) @@ -1167,9 +1167,12 @@ apr_pool_t *pool) { apr_getopt_t *os; - struct opt_parsing_error_baton_t opt_parsing_error_baton = { NULL, pool }; + struct opt_parsing_error_baton_t opt_parsing_error_baton; /* Make room for each option (starting at index 1) plus trailing NULL. */ const char **argv = apr_palloc(pool, sizeof(char*) * (args->nelts + 2)); + + opt_parsing_error_baton.err = NULL; + opt_parsing_error_baton.pool = pool; argv[0] = ""; memcpy((void *) (argv + 1), args->elts, sizeof(char*) * args->nelts); Index: subversion/libsvn_subr/sqlite.c =================================================================== --- subversion/libsvn_subr/sqlite.c (revision 1351858) +++ subversion/libsvn_subr/sqlite.c (working copy) @@ -1116,13 +1116,15 @@ sqlite3_value *values[]) { struct function_wrapper_baton_t *fwb = sqlite3_user_data(context); - svn_sqlite__context_t sctx = { context }; + svn_sqlite__context_t sctx; svn_sqlite__value_t **local_vals = apr_palloc(fwb->scratch_pool, sizeof(svn_sqlite__value_t *) * argc); svn_error_t *err; int i; + sctx.context = context; + for (i = 0; i < argc; i++) { local_vals[i] = apr_palloc(fwb->scratch_pool, sizeof(*local_vals[i])); Index: subversion/tests/libsvn_wc/op-depth-test.c =================================================================== --- subversion/tests/libsvn_wc/op-depth-test.c (revision 1351858) +++ subversion/tests/libsvn_wc/op-depth-test.c (working copy) @@ -238,7 +238,9 @@ apr_array_header_t *result_revs; apr_array_header_t *paths = apr_array_make(b->pool, 1, sizeof(const char *)); - svn_opt_revision_t revision = { svn_opt_revision_number, { revnum } }; + svn_opt_revision_t revision; + revision.kind = svn_opt_revision_number; + revision.value.number = revnum; APR_ARRAY_PUSH(paths, const char *) = wc_path(b, path); SVN_ERR(svn_client_create_context(&ctx, b->pool)); @@ -455,8 +457,12 @@ svn_boolean_t have_row; apr_hash_t *found_hash = apr_hash_make(b->pool); apr_hash_t *expected_hash = apr_hash_make(b->pool); - comparison_baton_t comparison_baton - = { expected_hash, found_hash, b->pool, NULL }; + comparison_baton_t comparison_baton; + + comparison_baton.expected_hash = expected_hash; + comparison_baton.found_hash = found_hash; + comparison_baton.scratch_pool = b->pool; + comparison_baton.errors = NULL; /* Fill ACTUAL_HASH with data from the WC DB. */ SVN_ERR(open_wc_db(&sdb, b->wc_abspath, statements, b->pool, b->pool)); @@ -523,23 +529,23 @@ nodes_row_t expected[20]; }; +#define source_everything "A/B" + +#define source_base_file "A/B/lambda" +#define source_base_dir "A/B/E" + +#define source_added_file "A/B/file-added" +#define source_added_dir "A/B/D-added" +#define source_added_dir2 "A/B/D-added/D2" + +#define source_copied_file "A/B/lambda-copied" +#define source_copied_dir "A/B/E-copied" + /* Check that all kinds of WC-to-WC copies give correct op_depth results: * create a Greek tree, make copies in it, and check the resulting DB rows. */ static svn_error_t * wc_wc_copies(svn_test__sandbox_t *b) { - const char source_everything[] = "A/B"; - - const char source_base_file[] = "A/B/lambda"; - const char source_base_dir[] = "A/B/E"; - - const char source_added_file[] = "A/B/file-added"; - const char source_added_dir[] = "A/B/D-added"; - const char source_added_dir2[] = "A/B/D-added/D2"; - - const char source_copied_file[] = "A/B/lambda-copied"; - const char source_copied_dir[] = "A/B/E-copied"; - SVN_ERR(add_and_commit_greek_tree(b)); /* Create the various kinds of source node which will be copied */ @@ -756,13 +762,15 @@ for (subtest = subtests; subtest->from_path; subtest++) { svn_opt_revision_t rev = { svn_opt_revision_number, { 1 } }; - svn_client_copy_source_t source = { NULL, &rev, &rev }; + svn_client_copy_source_t source; apr_array_header_t *sources = apr_array_make(b->pool, 0, sizeof(svn_client_copy_source_t *)); source.path = svn_path_url_add_component2(b->repos_url, subtest->from_path, b->pool); + source.revision = &rev; + source.peg_revision = &rev; APR_ARRAY_PUSH(sources, svn_client_copy_source_t *) = &source; SVN_ERR(svn_client_copy6(sources, wc_path(b, subtest->to_path), Index: subversion/tests/libsvn_subr/named_atomic-test.c =================================================================== --- subversion/tests/libsvn_subr/named_atomic-test.c (revision 1351858) +++ subversion/tests/libsvn_subr/named_atomic-test.c (working copy) @@ -82,7 +82,9 @@ /* all processes and their I/O data */ apr_proc_t process; - const char * args[2] = {proc, NULL}; + const char * args[2]; + args[0] = proc; + args[1] = NULL; svn_error_clear(adjust_proc_path(&args[0], &directory, pool)); /* try to start the process */ @@ -307,15 +309,14 @@ /* start sub-processes */ for (i = 0; i < count; ++i) { - const char * args[6] = - { - proc, - apr_itoa(pool, i), - apr_itoa(pool, count), - apr_itoa(pool, iterations), - name_namespace, - NULL - }; + const char * args[6]; + + args[0] = proc; + args[1] = apr_itoa(pool, i); + args[2] = apr_itoa(pool, count); + args[3] = apr_itoa(pool, iterations); + args[4] = name_namespace; + args[5] = NULL; error = svn_io_start_cmd3(&process[i], directory, /* working directory */ Index: subversion/svn/merge-cmd.c =================================================================== --- subversion/svn/merge-cmd.c (revision 1351858) +++ subversion/svn/merge-cmd.c (working copy) @@ -61,8 +61,14 @@ if (url1) { - svn_opt_revision_t revision1 = { svn_opt_revision_number, { rev1 } }; - svn_opt_revision_t revision2 = { svn_opt_revision_number, { rev2 } }; + svn_opt_revision_t revision1; + svn_opt_revision_t revision2; + + revision1.kind = svn_opt_revision_number; + revision1.value.number = rev1; + + revision2.kind = svn_opt_revision_number; + revision2.value.number = rev2; /* Do the merge. Set 'allow_mixed_rev' to true, not because we want * to allow a mixed-rev WC but simply to bypass the check, as it was Index: subversion/libsvn_wc/props.c =================================================================== --- subversion/libsvn_wc/props.c (revision 1351858) +++ subversion/libsvn_wc/props.c (working copy) @@ -1852,8 +1852,10 @@ { svn_wc__proplist_receiver_t receiver = receiver_func; void *baton = receiver_baton; - struct propname_filter_baton_t pfb = { receiver_func, receiver_baton, - propname }; + struct propname_filter_baton_t pfb; + pfb.receiver_func = receiver_func; + pfb.receiver_baton = receiver_baton; + pfb.propname = propname; SVN_ERR_ASSERT(receiver_func); @@ -2489,8 +2491,13 @@ } else { - struct propset_walk_baton wb = { name, value, wc_ctx->db, skip_checks, - notify_func, notify_baton }; + struct propset_walk_baton wb; + wb.propname = name; + wb.propval = value; + wb.db = wc_ctx->db; + wb.force = skip_checks; + wb.notify_func = notify_func; + wb.notify_baton = notify_baton; SVN_ERR(svn_wc__internal_walk_children(wc_ctx->db, local_abspath, FALSE, changelist_filter, Index: subversion/libsvn_wc/adm_ops.c =================================================================== --- subversion/libsvn_wc/adm_ops.c (revision 1351858) +++ subversion/libsvn_wc/adm_ops.c (working copy) @@ -2696,8 +2696,11 @@ void *cancel_baton, apr_pool_t *scratch_pool) { - struct get_cl_fn_baton gnb = { wc_ctx->db, NULL, - callback_func, callback_baton }; + struct get_cl_fn_baton gnb; + gnb.db = wc_ctx->db; + gnb.clhash = NULL; + gnb.callback_func = callback_func; + gnb.callback_baton = callback_baton; if (changelist_filter) SVN_ERR(svn_hash_from_cstring_keys(&gnb.clhash, changelist_filter, Index: subversion/libsvn_wc/wc_db_util.c =================================================================== --- subversion/libsvn_wc/wc_db_util.c (revision 1351858) +++ subversion/libsvn_wc/wc_db_util.c (working copy) @@ -196,7 +196,11 @@ void *cb_baton, apr_pool_t *scratch_pool) { - struct txn_baton_t tb = { wcroot, local_relpath, cb_func, cb_baton }; + struct txn_baton_t tb; + tb.wcroot = wcroot; + tb.local_relpath = local_relpath; + tb.cb_func = cb_func; + tb.cb_baton = cb_baton; return svn_error_trace( svn_sqlite__with_lock(wcroot->sdb, run_txn, &tb, scratch_pool)); Index: subversion/libsvn_wc/wc_db.c =================================================================== --- subversion/libsvn_wc/wc_db.c (revision 1351858) +++ subversion/libsvn_wc/wc_db.c (working copy) @@ -5141,8 +5141,10 @@ { svn_wc__db_wcroot_t *wcroot; const char *local_relpath; - struct set_changelist_baton_t scb = { new_changelist, changelist_filter, - depth }; + struct set_changelist_baton_t scb; + scb.new_changelist = new_changelist; + scb.changelist_filter = changelist_filter; + scb.depth = depth; SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath)); @@ -5780,9 +5782,15 @@ { svn_wc__db_wcroot_t *wcroot; const char *local_relpath; - struct revert_list_read_baton b = {reverted, conflict_old, conflict_new, - conflict_working, prop_reject, - copied_here, kind, result_pool}; + struct revert_list_read_baton b; + b.reverted = reverted; + b.conflict_old = conflict_old; + b.conflict_new = conflict_new; + b.conflict_working = conflict_working; + b.prop_reject = prop_reject; + b.copied_here = copied_here; + b.kind = kind; + b.result_pool = result_pool; SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db, local_abspath, scratch_pool, scratch_pool)); @@ -5853,7 +5861,9 @@ { svn_wc__db_wcroot_t *wcroot; const char *local_relpath; - struct revert_list_read_copied_children_baton b = {children, result_pool}; + struct revert_list_read_copied_children_baton b; + b.children = children; + b.result_pool = result_pool; SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db, local_abspath, scratch_pool, scratch_pool)); @@ -8131,7 +8141,9 @@ apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - struct read_url_baton_t rub = { url, result_pool }; + struct read_url_baton_t rub; + rub.url = url; + rub.result_pool = result_pool; SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, read_url_txn, &rub, scratch_pool)); @@ -13317,9 +13329,17 @@ { svn_wc__db_wcroot_t *wcroot; const char *local_relpath; - struct revision_status_baton_t rsb = { min_revision, max_revision, - is_sparse_checkout, is_modified, is_switched, trail_url, committed, - cancel_func, cancel_baton, db }; + struct revision_status_baton_t rsb; + rsb.min_revision = min_revision; + rsb.max_revision = max_revision; + rsb.is_sparse_checkout = is_sparse_checkout; + rsb.is_modified = is_modified; + rsb.is_switched = is_switched; + rsb.trail_url = trail_url; + rsb.committed = committed; + rsb.cancel_func = cancel_func; + rsb.cancel_baton = cancel_baton; + rsb.db = db; SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath)); Index: subversion/libsvn_wc/upgrade.c =================================================================== --- subversion/libsvn_wc/upgrade.c (revision 1351858) +++ subversion/libsvn_wc/upgrade.c (working copy) @@ -1545,7 +1545,8 @@ int start_format, apr_pool_t *scratch_pool) { - struct bump_baton bb = { wcroot_abspath }; + struct bump_baton bb; + bb.wcroot_abspath = wcroot_abspath; if (start_format < SVN_WC__WC_NG_VERSION /* 12 */) return svn_error_createf(SVN_ERR_WC_UPGRADE_REQUIRED, NULL, Index: subversion/libsvn_client/deprecated.c =================================================================== --- subversion/libsvn_client/deprecated.c (revision 1351858) +++ subversion/libsvn_client/deprecated.c (working copy) @@ -1643,7 +1643,9 @@ { if (svn_path_is_url(target)) { - struct capture_baton_t cb = { commit_info_p, pool }; + struct capture_baton_t cb; + cb.info = commit_info_p; + cb.pool = pool; SVN_ERR(svn_client_propset_remote(propname, propval, target, skip_checks, base_revision_for_url, revprop_table, @@ -1956,8 +1958,10 @@ svn_client_ctx_t *ctx, apr_pool_t *pool) { - struct status4_wrapper_baton swb = { ctx->wc_ctx, status_func, - status_baton }; + struct status4_wrapper_baton swb; + swb.wc_ctx = ctx->wc_ctx; + swb.old_func = status_func; + swb.old_baton = status_baton; return svn_client_status5(result_rev, ctx, path, revision, depth, get_all, update, no_ignore, ignore_externals, TRUE, Index: subversion/libsvn_client/info.c =================================================================== --- subversion/libsvn_client/info.c (revision 1351858) +++ subversion/libsvn_client/info.c (working copy) @@ -348,7 +348,9 @@ || peg_revision->kind == svn_opt_revision_unspecified)) { /* Do all digging in the working copy. */ - wc_info_receiver_baton_t b = { receiver, receiver_baton }; + wc_info_receiver_baton_t b; + b.client_receiver_func = receiver; + b.client_receiver_baton = receiver_baton; return svn_error_trace( svn_wc__get_info(ctx->wc_ctx, abspath_or_url, depth, fetch_excluded, fetch_actual_only, changelists, Index: subversion/libsvn_client/merge.c =================================================================== --- subversion/libsvn_client/merge.c (revision 1351858) +++ subversion/libsvn_client/merge.c (working copy) @@ -9643,7 +9643,10 @@ side, and merge the right. */ else { - merge_source_t source = { source1_loc, source2_loc, FALSE }; + merge_source_t source; + source.loc1 = source1_loc; + source.loc2 = source2_loc; + source.ancestral = FALSE; err = merge_cousins_and_supplement_mergeinfo(target, ra_session1, @@ -9675,7 +9678,10 @@ } else { - merge_source_t source = { source1_loc, source2_loc, FALSE }; + merge_source_t source; + source.loc1 = source1_loc; + source.loc2 = source2_loc; + source.ancestral = FALSE; /* Build a single-item merge_source_t array. */ merge_sources = apr_array_make(scratch_pool, 1, sizeof(merge_source_t *)); @@ -11651,10 +11657,13 @@ if (merge->mid) { - merge_source_t source = { merge->base, merge->right, - (merge->mid == NULL) /* ancestral */ }; + merge_source_t source; svn_ra_session_t *ra_session = NULL; + source.loc1 = merge->base; + source.loc2 = merge->right; + source.ancestral = (merge->mid == NULL); + SVN_ERR(ensure_ra_session_url(&ra_session, source.loc1->url, ctx, scratch_pool)); @@ -11680,10 +11689,13 @@ An improvement would be to change find_symmetric_merge() to find the base for each sutree, and then here use the oldest base among all subtrees. */ - merge_source_t source = { merge->yca, merge->right, - (merge->mid == NULL) /* ancestral */ }; + merge_source_t source; apr_array_header_t *merge_sources; + source.loc1 = merge->yca; + source.loc2 = merge->right; + source.ancestral = (merge->mid == NULL); + merge_sources = apr_array_make(scratch_pool, 1, sizeof(merge_source_t *)); APR_ARRAY_PUSH(merge_sources, const merge_source_t *) = &source; Index: subversion/libsvn_fs_fs/fs_fs.c =================================================================== --- subversion/libsvn_fs_fs/fs_fs.c (revision 1351858) +++ subversion/libsvn_fs_fs/fs_fs.c (working copy) @@ -3523,7 +3523,9 @@ if (rs->window_cache) { /* store the window and the first offset _past_ it */ - svn_fs_fs__txdelta_cached_window_t cached_window = { window, rs->off }; + svn_fs_fs__txdelta_cached_window_t cached_window; + cached_window.window = window; + cached_window.end_offset = rs->off; /* but key it with the start offset because that is the known state * when we will look it up */ @@ -5554,7 +5556,9 @@ /* build parameters: (name, new entry) pair */ const char *key = svn_fs_fs__id_unparse(parent_noderev->id, subpool)->data; - replace_baton_t baton = {name, NULL}; + replace_baton_t baton; + baton.name = name; + baton.new_entry = NULL; if (id) { Index: subversion/libsvn_fs_fs/lock.c =================================================================== --- subversion/libsvn_fs_fs/lock.c (revision 1351858) +++ subversion/libsvn_fs_fs/lock.c (working copy) @@ -655,7 +655,11 @@ svn_boolean_t have_write_lock, apr_pool_t *pool) { - struct walk_locks_baton wlb = { get_locks_func, get_locks_baton, fs }; + struct walk_locks_baton wlb; + + wlb.get_locks_func = get_locks_func; + wlb.get_locks_baton = get_locks_baton; + wlb.fs = fs; SVN_ERR(walk_digest_files(fs->path, digest_path, locks_walker, &wlb, have_write_lock, pool)); return SVN_NO_ERROR;