You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Julian Foad <ju...@btopenworld.com> on 2006/01/16 23:38:14 UTC

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

> ------------------------------------------------------------------------
> 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

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

Posted by "Peter N. Lundblad" <pe...@famlundblad.se>.
On Mon, 16 Jan 2006, Julian Foad wrote:

> > ------------------------------------------------------------------------
> > 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.
>
...
> Please revert this commit.
>
Oh, I saved that commit mail for later follow-up, but forgot about it. +1
to Julian's comment. GCC 4 isn't enough smart about this. We had a similar
discussion some months ago.

Best,
//Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org