You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2014/04/19 17:49:35 UTC

svn commit: r1588665 - in /subversion/trunk/subversion: include/svn_wc.h svn/conflict-callbacks.c

Author: brane
Date: Sat Apr 19 15:49:34 2014
New Revision: 1588665

URL: http://svn.apache.org/r1588665
Log:
Got tired of all the -Wtautological-constant-out-of-range-compare warnings.

* subversion/include/svn_wc.h (svn_wc_conflict_choice_t):
   Add constant svn_wc_conflict_choose_undefined, and make sure that
   the existing enumeration values remain unchanged.
* subversion/svn/conflict-callbacks.c:
   Use this constant instead of untyped -1 for conflict
   resolution choices. Silences a number of warnings with clang on OSX.

Modified:
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/svn/conflict-callbacks.c

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1588665&r1=1588664&r2=1588665&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Sat Apr 19 15:49:34 2014
@@ -2224,9 +2224,15 @@ svn_wc__conflict_description2_dup(
  */
 typedef enum svn_wc_conflict_choice_t
 {
+  /** Undefined; for internal use only.
+      This value is never returned in svn_wc_conflict_result_t.
+   * @since New in 1.9
+   */
+  svn_wc_conflict_choose_undefined = -1,
+
   /** Don't resolve the conflict now.  Let libsvn_wc mark the path
      'conflicted', so user can run 'svn resolved' later. */
-  svn_wc_conflict_choose_postpone,
+  svn_wc_conflict_choose_postpone = 0,
 
   /** If there were files to choose from, select one as a way of
      resolving the conflict here and now.  libsvn_wc will then do the
@@ -2239,7 +2245,7 @@ typedef enum svn_wc_conflict_choice_t
   svn_wc_conflict_choose_mine_conflict,   /**< own (for conflicted hunks) */
   svn_wc_conflict_choose_merged,          /**< merged version */
 
-  /* @since New in 1.8. */
+  /** @since New in 1.8. */
   svn_wc_conflict_choose_unspecified      /**< undecided */
 
 } svn_wc_conflict_choice_t;

Modified: subversion/trunk/subversion/svn/conflict-callbacks.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/conflict-callbacks.c?rev=1588665&r1=1588664&r2=1588665&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/conflict-callbacks.c (original)
+++ subversion/trunk/subversion/svn/conflict-callbacks.c Sat Apr 19 15:49:34 2014
@@ -415,7 +415,8 @@ typedef struct resolver_option_t
   const char *code;        /* one or two characters */
   const char *short_desc;  /* label in prompt (localized) */
   const char *long_desc;   /* longer description (localized) */
-  svn_wc_conflict_choice_t choice;  /* or -1 if not a simple choice */
+  svn_wc_conflict_choice_t choice;
+                           /* or ..._undefined if not a simple choice */
 } resolver_option_t;
 
 /* Resolver options for a text conflict */
@@ -427,14 +428,15 @@ static const resolver_option_t text_conf
      brackets. */
   { "e",  N_("edit file"),        N_("change merged file in an editor"
                                      "  [edit]"),
-                                  -1 },
+                                  svn_wc_conflict_choose_undefined },
   { "df", N_("show diff"),        N_("show all changes made to merged file"),
-                                  -1 },
+                                  svn_wc_conflict_choose_undefined },
   { "r",  N_("mark resolved"),   N_("accept merged version of file"),
                                   svn_wc_conflict_choose_merged },
   { "",   "",                     "", svn_wc_conflict_choose_unspecified },
   { "dc", N_("display conflict"), N_("show all conflicts "
-                                     "(ignoring merged version)"), -1 },
+                                     "(ignoring merged version)"),
+                                  svn_wc_conflict_choose_undefined },
   { "mc", N_("my side of conflict"), N_("accept my version for all conflicts "
                                         "(same)  [mine-conflict]"),
                                   svn_wc_conflict_choose_mine_conflict },
@@ -451,15 +453,17 @@ static const resolver_option_t text_conf
                                   svn_wc_conflict_choose_theirs_full },
   { "",   "",                     "", svn_wc_conflict_choose_unspecified },
   { "m",  N_("merge"),            N_("use merge tool to resolve conflict"),
-                                     -1 },
+                                  svn_wc_conflict_choose_undefined },
   { "l",  N_("launch tool"),      N_("launch external tool to resolve "
-                                     "conflict  [launch]"), -1 },
+                                     "conflict  [launch]"),
+                                  svn_wc_conflict_choose_undefined },
   { "p",  N_("postpone"),         N_("mark the conflict to be resolved later"
                                      "  [postpone]"),
                                   svn_wc_conflict_choose_postpone },
   { "q",  N_("quit resolution"),  N_("postpone all remaining conflicts"),
                                   svn_wc_conflict_choose_postpone },
-  { "s",  N_("show all options"), N_("show this list (also 'h', '?')"), -1 },
+  { "s",  N_("show all options"), N_("show this list (also 'h', '?')"),
+                                  svn_wc_conflict_choose_undefined },
   { NULL }
 };
 
@@ -472,9 +476,11 @@ static const resolver_option_t prop_conf
   { "tf", N_("their version"),    N_("accept their version of entire property "
                                      "(same)  [theirs-full]"),
                                   svn_wc_conflict_choose_theirs_full },
-  { "dc", N_("display conflict"), N_("show conflicts in this property"), -1 },
+  { "dc", N_("display conflict"), N_("show conflicts in this property"),
+                                  svn_wc_conflict_choose_undefined },
   { "e",  N_("edit property"),    N_("change merged property value in an editor"
-                                     "  [edit]"), -1 },
+                                     "  [edit]"),
+                                  svn_wc_conflict_choose_undefined },
   { "r",  N_("mark resolved"),    N_("accept edited version of property"),
                                   svn_wc_conflict_choose_merged },
   { "p",  N_("postpone"),         N_("mark the conflict to be resolved later"
@@ -482,7 +488,8 @@ static const resolver_option_t prop_conf
                                   svn_wc_conflict_choose_postpone },
   { "q",  N_("quit resolution"),  N_("postpone all remaining conflicts"),
                                   svn_wc_conflict_choose_postpone },
-  { "h",  N_("help"),             N_("show this help (also '?')"), -1 },
+  { "h",  N_("help"),             N_("show this help (also '?')"),
+                                  svn_wc_conflict_choose_undefined },
   { NULL }
 };
 
@@ -500,7 +507,8 @@ static const resolver_option_t obstructe
                                   svn_wc_conflict_choose_postpone },
   { "q",  N_("quit resolution"),  N_("postpone all remaining conflicts"),
                                   svn_wc_conflict_choose_postpone },
-  { "h",  N_("help"),             N_("show this help (also '?')"), -1 },
+  { "h",  N_("help"),             N_("show this help (also '?')"),
+                                  svn_wc_conflict_choose_undefined },
   { NULL }
 };
 
@@ -513,7 +521,8 @@ static const resolver_option_t tree_conf
                                   svn_wc_conflict_choose_postpone },
   { "q",  N_("quit resolution"),  N_("postpone all remaining conflicts"),
                                   svn_wc_conflict_choose_postpone },
-  { "h",  N_("help"),             N_("show this help (also '?')"), -1 },
+  { "h",  N_("help"),             N_("show this help (also '?')"),
+                                  svn_wc_conflict_choose_undefined },
   { NULL }
 };
 
@@ -527,7 +536,8 @@ static const resolver_option_t tree_conf
                                   svn_wc_conflict_choose_postpone },
   { "q",  N_("quit resolution"),  N_("postpone all remaining conflicts"),
                                   svn_wc_conflict_choose_postpone },
-  { "h",  N_("help"),             N_("show this help (also '?')"), -1 },
+  { "h",  N_("help"),             N_("show this help (also '?')"),
+                                  svn_wc_conflict_choose_undefined },
   { NULL }
 };
 
@@ -541,7 +551,8 @@ static const resolver_option_t tree_conf
                                   svn_wc_conflict_choose_postpone },
   { "q",  N_("quit resolution"),  N_("postpone all remaining conflicts"),
                                   svn_wc_conflict_choose_postpone },
-  { "h",  N_("help"),             N_("show this help (also '?')"), -1 },
+  { "h",  N_("help"),             N_("show this help (also '?')"),
+                                  svn_wc_conflict_choose_undefined },
   { NULL }
 };
 
@@ -907,7 +918,7 @@ handle_text_conflict(svn_wc_conflict_res
             SVN_ERR(svn_cmdline_fprintf(stderr, iterpool,
                                         _("Invalid option.\n\n")));
         }
-      else if (opt->choice != -1)
+      else if (opt->choice != svn_wc_conflict_choose_undefined)
         {
           if ((opt->choice == svn_wc_conflict_choose_mine_conflict
                || opt->choice == svn_wc_conflict_choose_theirs_conflict)
@@ -1036,7 +1047,7 @@ handle_prop_conflict(svn_wc_conflict_res
           result->choice = svn_wc_conflict_choose_merged;
           break;
         }
-      else if (opt->choice != -1)
+      else if (opt->choice != svn_wc_conflict_choose_undefined)
         {
           result->choice = opt->choice;
           break;
@@ -1107,7 +1118,7 @@ handle_tree_conflict(svn_wc_conflict_res
           b->quit = TRUE;
           break;
         }
-      else if (opt->choice != -1)
+      else if (opt->choice != svn_wc_conflict_choose_undefined)
         {
           result->choice = opt->choice;
           break;
@@ -1157,7 +1168,7 @@ handle_obstructed_add(svn_wc_conflict_re
           b->quit = TRUE;
           break;
         }
-      else if (opt->choice != -1)
+      else if (opt->choice != svn_wc_conflict_choose_undefined)
         {
           result->choice = opt->choice;
           break;