You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Erik Huelsmann <e....@gmx.net> on 2004/05/19 22:14:45 UTC

Re: svn commit: r9795 - trunk/subversion/clients/cmdline

This commit causes warnings:

subversion/clients/cmdline/status.c: In function `print_status':
subversion/clients/cmdline/status.c:141: warning: control reaches end of
non-void function
subversion/clients/cmdline/status.c: In function `svn_cl__print_status':
subversion/clients/cmdline/status.c:160: warning: control reaches end of
non-void function


[ snip ]


>==========================================================================
> --- trunk/subversion/clients/cmdline/status.c	(original)
> +++ trunk/subversion/clients/cmdline/status.c	Wed May 19 16:32:54 2004
> @@ -26,6 +26,7 @@
>  #include "svn_cmdline.h"
>  #include "svn_sorts.h"
>  #include "svn_wc.h"
> +#include "svn_path.h"
>  #include "cl.h"
>  
>  
> @@ -54,8 +55,9 @@
>  }
>  
>  /* Print STATUS and PATH in a format determined by DETAILED and
> -   SHOW_LAST_COMMITTED */
> -static void 
> +   SHOW_LAST_COMMITTED
> +   ### NOTE: This function can't fail, so we just ignore any print
> errors. */
> +static svn_error_t *
>  print_status (const char *path,
>                svn_boolean_t detailed,
>                svn_boolean_t show_last_committed,
> @@ -95,58 +97,51 @@
>              commit_rev = "";
>  
>            if (status->entry && status->entry->cmt_author)
> -            {
> -              const char *const author_utf8 = status->entry->cmt_author;
> -              svn_error_t *err =
> -                svn_cmdline_cstring_from_utf8 (&commit_author,
> author_utf8,
> -                                               pool);
> -              if (err)
> -                {
> -                  svn_error_clear (err);
> -                  commit_author =
> -                    svn_cmdline_cstring_from_utf8_fuzzy (author_utf8,
> pool);
> -                }
> -            }
> +            commit_author = status->entry->cmt_author;
>            else if (status->entry)
>              commit_author = " ? ";
>            else
>              commit_author = "";
>  
> -          printf ("%c%c%c%c%c  %c   %6s   %6s %-12s %s\n",
> -                  generate_status_code (status->text_status),
> -                  generate_status_code (status->prop_status),
> -                  status->locked ? 'L' : ' ',
> -                  status->copied ? '+' : ' ',
> -                  status->switched ? 'S' : ' ',
> -                  ood_status,
> -                  working_rev,
> -                  commit_rev,
> -                  commit_author,
> -                  path);
> +          SVN_ERR
> +            (svn_cmdline_printf (pool,
> +                                 "%c%c%c%c%c  %c   %6s   %6s %-12s %s\n",
> +                                
> generate_status_code(status->text_status),
> +                                 generate_status_code
> (status->prop_status),
> +                                 status->locked ? 'L' : ' ',
> +                                 status->copied ? '+' : ' ',
> +                                 status->switched ? 'S' : ' ',
> +                                 ood_status,
> +                                 working_rev,
> +                                 commit_rev,
> +                                 commit_author,
> +                                 path));
>          }
>        else
> -        printf ("%c%c%c%c%c  %c   %6s   %s\n",
> -                generate_status_code (status->text_status),
> -                generate_status_code (status->prop_status),
> -                status->locked ? 'L' : ' ',
> -                status->copied ? '+' : ' ',
> -                status->switched ? 'S' : ' ',
> -                ood_status,
> -                working_rev,
> -                path);
> +        SVN_ERR
> +          (svn_cmdline_printf (pool, "%c%c%c%c%c  %c   %6s   %s\n",
> +                               generate_status_code
> (status->text_status),
> +                               generate_status_code
> (status->prop_status),
> +                               status->locked ? 'L' : ' ',
> +                               status->copied ? '+' : ' ',
> +                               status->switched ? 'S' : ' ',
> +                               ood_status,
> +                               working_rev,
> +                               path));
>      }
>    else
> -    printf ("%c%c%c%c%c  %s\n",
> -            generate_status_code (status->text_status),
> -            generate_status_code (status->prop_status),
> -            status->locked ? 'L' : ' ',
> -            status->copied ? '+' : ' ',
> -            status->switched ? 'S' : ' ',
> -            path);
> +    SVN_ERR
> +      (svn_cmdline_printf (pool, "%c%c%c%c%c  %s\n",
> +                           generate_status_code (status->text_status),
> +                           generate_status_code (status->prop_status),
> +                           status->locked ? 'L' : ' ',
> +                           status->copied ? '+' : ' ',
> +                           status->switched ? 'S' : ' ',
> +                           path));
>  }

here you could reach the end of the function without ever getting to a
return statement.

There are two solutions:

1) add a return SVN_NO_ERROR
2) change the last SVN_ERR in a return instruction


>  
>  /* Called by status-cmd.c */
> -void
> +svn_error_t *
>  svn_cl__print_status (const char *path,
>                        svn_wc_status_t *status,
>                        svn_boolean_t detailed,
> @@ -154,21 +149,12 @@
>                        svn_boolean_t skip_unrecognized,
>                        apr_pool_t *pool)
>  {
> -  svn_error_t *err;
> -  const char *path_stdout;
> -
>    if (! status 
>        || (skip_unrecognized && ! status->entry)
>        || (status->text_status == svn_wc_status_none
>            && status->repos_text_status == svn_wc_status_none))
> -    return;
> -
> -  err = svn_cmdline_path_local_style_from_utf8 (&path_stdout, path,
> pool);
> -  if (err)
> -    {
> -      svn_handle_error (err, stderr, FALSE);
> -      svn_error_clear (err);
> -    }
> +    return SVN_NO_ERROR;
>  
> -  print_status (path_stdout, detailed, show_last_committed, status,
> pool);
> +  SVN_ERR (print_status (svn_path_local_style (path, pool),
> +                         detailed, show_last_committed, status, pool));
>  }


Same here.


> 
> Modified: trunk/subversion/clients/cmdline/util.c
>
==============================================================================
> --- trunk/subversion/clients/cmdline/util.c	(original)
> +++ trunk/subversion/clients/cmdline/util.c	Wed May 19 16:32:54 2004
> @@ -35,6 +35,7 @@
>  
>  #include "svn_wc.h"
>  #include "svn_client.h"
> +#include "svn_cmdline.h"
>  #include "svn_string.h"
>  #include "svn_path.h"
>  #include "svn_delta.h"
> @@ -50,15 +51,16 @@
>  
>  
>  
> -void
> -svn_cl__print_commit_info (svn_client_commit_info_t *commit_info)
> +svn_error_t *
> +svn_cl__print_commit_info (svn_client_commit_info_t *commit_info,
> +                           apr_pool_t *pool)
>  {
>    if ((commit_info) 
>        && (SVN_IS_VALID_REVNUM (commit_info->revision)))
> -    printf (_("\nCommitted revision %ld.\n"),
> -            commit_info->revision);
> +    SVN_ERR (svn_cmdline_printf (pool, _("\nCommitted revision %ld.\n"),
> +                                 commit_info->revision));
>  
> -  return;
> +  return SVN_NO_ERROR;
>  }
>  


bye,


Erik.

-- 
"Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen!
Jetzt aktivieren unter http://www.gmx.net/info


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

Re: svn commit: r9795 - trunk/subversion/clients/cmdline

Posted by Branko Čibej <br...@xbc.nu>.
Peter N. Lundblad wrote:

>On Thu, 20 May 2004, Erik Huelsmann wrote:
>
>  
>
>>This commit causes warnings:
>>
>>    
>>
>Yes, it does. Shame on me! Fixed in r9799.
>
>BTW, did we ever consider using -Werror where available? The problem with
>warnings is that if the build suceeds and you miss them, you don't see
>them until the next change of that file. We don't want any warnings in the
>code anyway, do we?
>  
>
We don't, but sometimes can't avoid them, e.g., no two compilers emit 
exactly the same warnings. You don't waht to break the build for someone 
just because she's using a newer version of GCC than you are.




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

Re: svn commit: r9795 - trunk/subversion/clients/cmdline

Posted by "Peter N. Lundblad" <pe...@famlundblad.se>.
On Thu, 20 May 2004, Erik Huelsmann wrote:

>
> This commit causes warnings:
>
Yes, it does. Shame on me! Fixed in r9799.

BTW, did we ever consider using -Werror where available? The problem with
warnings is that if the build suceeds and you miss them, you don't see
them until the next change of that file. We don't want any warnings in the
code anyway, do we?

Thanks for observing this,
//Peter

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