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

Re: svn commit r18040: "Cleanse GCC 4.0.1 compilation warnings."

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2006-01-17 00:38:14 CET

> ------------------------------------------------------------------------
> r18040 | dlr | 2006-01-10 19:20:20 +0000 (Tue, 10 Jan 2006) | 49 lines
>
> Cleanse GCC 4.0.1 compilation warnings.
>
> * subversion/libsvn_wc/adm_files.c
> (svn_wc_ensure_adm2): Initialize local variable "exists_already" to
> FALSE.

Arggh! No, please don't. Initialising it gives the impression that its value
is going to be used, but it is not, it's going to get assigned through an
output parameter of a function call.

That particular warning of GCC 4.0.1 is simply unsuitable for use with our
code. Disable it.

Please revert this commit.

(One thing this review showed me is that many of the functions that initialise
these variables, via non-const pointer arguments, are undocumented or poorly
documented.)

- Julian

>
> * subversion/libsvn_subr/config_file.c
> (svn_config__parse_file): Initialize "ctx.ungotten_char" to NUL.

(It's not clear to me what's going on in this particular case.)

> * subversion/tests/libsvn_delta/random-test.c
> (random_combine_test): Initialize local variable "seed" to 0.
>
> * subversion/libsvn_repos/load.c
> (svn_repos_parse_dumpstream2): Initialize local variable "version"
> to SVN_REPOS_DUMPFILE_FORMAT_VERSION, and "actual_prop_length" to
> 0.
>
> * subversion/libsvn_ra_svn/client.c
> (open_session): Initialize local variable "conn" to NULL.
>
> (ra_svn_open): Initialize local variable "tunnel_argv" to NULL.

(Here you left in a redundant subsequent initialisation of "tunnel_argv".)

>
> * subversion/libsvn_delta/svndiff.c
> (decode_window): Initialize local variable "ninst" to 0.
>
> * subversion/svn/lock-cmd.c
> (svn_cl__lock): Initialize local variable "comment" to NULL.
>
> * subversion/libsvn_ra_dav/session.c
> (svn_ra_dav__open): Initialize local variables "timeout" and "debug"
> to 0.

Here you can see an inconsistency: there are several other variables used there
in exactly the same way which you haven't initialised, presumably because GCC
hasn't complained about them for some reason.

> (svn_ra_dav__lock): Initialize local variable "lock" to NULL.
>
> * subversion/libsvn_fs_fs/fs_fs.c
> (svn_fs_fs__rev_get_root): Initialize local variable "root_id" to
> NULL.
>
> (build_rep_list): Initialize local variable "rep_args" to NULL.
>
> (get_contents): Initialize local variable "cwindow" to NULL, and
> remove redundant subsequent intialization.
>
> (commit_body): Initialize local variables "start_node_id" and
> "start_copy_id" to NULL.
>
> * subversion/libsvn_fs_fs/revs-txns.c
> (svn_fs_fs__get_txn_ids): Initialize local variable "txn" to NULL.
>
> ------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Jan 17 00:51:39 2006

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.