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

New warnings from Xcode 4.2's clang

From: Blair Zajac <blair_at_orcaware.com>
Date: Sat, 15 Oct 2011 21:09:22 -0700

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
Received on 2011-10-16 06:10:01 CEST

This is an archived mail posted to the Subversion Dev mailing list.