You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Blair Zajac <bl...@orcaware.com> on 2011/10/16 06:09:22 UTC

New warnings from Xcode 4.2's clang

I upgraded my Xcode to 4.2 following the iOS 5 release and then compiled svn 1.7.0 for MacPorts, which updated this weekend.

The new clang compiler generates many more, higher level warnings then I've seen before, which is pretty cool.  Definitely worth upgrading your Xcode and switching to clang. 

Here's the warnings in the 1.7.0 build, not including deprecation warnings.

subversion/libsvn_delta/compose_delta.c:707:31: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare]
              if (ptn_overlap >= 0)
                  ~~~~~~~~~~~ ^  ~

There's a comment for this in our code:

              /* ### FIXME: ptn_overlap is unsigned, so the if() condition
                 below is always true!  Either it should be '> 0', or the
                 code block should be unconditional.  See also r842362. */


subversion/libsvn_client/merge.c:4565:9: warning: if statement has empty body [-
Wempty-body]
        ;
        ^
This is this snippet:

      if (nbr_skips < notify_b->nbr_notifications)
        /* ### Use RANGELIST as the mergeinfo for all children of               
           ### this path which were not also explicitly                         
           ### skipped? */
        ;


subversion/libsvn_wc/copy.c:618:13: warning: 6 enumeration values not handled in
 switch: 'svn_wc__db_status_normal', 'svn_wc__db_status_added', 'svn_wc__db_stat
us_moved_here'... [-Wswitch-enum]
    switch (src_status)
            ^


subversion/libsvn_diff/diff_file.c:2138:3: warning: data argument not used by format string [-Wformat-extra-args]
  SVN_ERR(svn_stream_printf(btn->output_stream, btn->pool,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./subversion/include/svn_error.h:303:35: note: instantiated from:
    svn_error_t *svn_err__temp = (expr);        \
                                  ^
subversion/libsvn_diff/diff_file.c:2143:49: note: instantiated from:
                            modified_start + 1, modified_length));
                                                ^
This looks ok:

  SVN_ERR(svn_stream_printf(btn->output_stream, btn->pool,
                            (modified_length == 1
                             ? "%s (%" APR_OFF_T_FMT ")"
                             : "%s (%" APR_OFF_T_FMT ",%" APR_OFF_T_FMT ")"),
                            btn->conflict_modified,
                            modified_start + 1, modified_length));

There's a bunch more of these warnings.

So all in all, svn 1.7.0 comes out pretty good.  None of the above warnings are a bug, even the switch one from a cursory reading.  It's nice to see a compiler warn about these.

Blair


Re: New warnings from Xcode 4.2's clang

Posted by Hyrum K Wright <hy...@wandisco.com>.
On Sun, Oct 16, 2011 at 1:07 AM, Daniel Shahaf <d....@daniel.shahaf.name> wrote:
> Blair Zajac wrote on Sat, Oct 15, 2011 at 21:09:22 -0700:
>> So all in all, svn 1.7.0 comes out pretty good.  None of the above
>> warnings are a bug, even the switch one from a cursory reading.  It's
>> nice to see a compiler warn about these.
>
> I like the fact that the compiler includes in its warning the name of
> the flag that, presumably, can be used to disable that warning :)

gcc 4.6 on my Ubuntu box does the same thing.

-Hyrum


-- 

uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/

Re: New warnings from Xcode 4.2's clang

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Blair Zajac wrote on Sat, Oct 15, 2011 at 21:09:22 -0700:
> So all in all, svn 1.7.0 comes out pretty good.  None of the above
> warnings are a bug, even the switch one from a cursory reading.  It's
> nice to see a compiler warn about these.

I like the fact that the compiler includes in its warning the name of
the flag that, presumably, can be used to disable that warning :)