Introduced 4 macros to minimise boilerplate command line processing code.
Nicely cuts around 130 lines of code, spread over the core and several tools.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2422 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/vg_include.h b/coregrind/vg_include.h
index c8dca40..f078216 100644
--- a/coregrind/vg_include.h
+++ b/coregrind/vg_include.h
@@ -189,7 +189,7 @@
 /* Enquire about generating a suppression for each error?   default: NO */
 extern Bool  VG_(clo_gen_suppressions);
 /* Sanity-check level: 0 = none, 1 (default), > 1 = expensive. */
-extern Int   VG_(sanity_level);
+extern Int   VG_(clo_sanity_level);
 /* Automatically attempt to demangle C++ names?  default: YES */
 extern Bool  VG_(clo_demangle);
 /* Simulate child processes? default: NO */
diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c
index fb4a1b7..186a5a3 100644
--- a/coregrind/vg_main.c
+++ b/coregrind/vg_main.c
@@ -1456,7 +1456,7 @@
 Bool   VG_(clo_db_attach)      = False;
 Char*  VG_(clo_db_command)     = VG_CLO_DEFAULT_DBCOMMAND;
 Bool   VG_(clo_gen_suppressions) = False;
-Int    VG_(sanity_level)       = 1;
+Int    VG_(clo_sanity_level)   = 1;
 Int    VG_(clo_verbosity)      = 1;
 Bool   VG_(clo_demangle)       = True;
 Bool   VG_(clo_trace_children) = False;
@@ -1707,63 +1707,46 @@
 
       if (     VG_CLO_STREQ(arg, "--"))
 	 continue;
+
       else if (VG_CLO_STREQ(arg, "-v") ||
                VG_CLO_STREQ(arg, "--verbose"))
          VG_(clo_verbosity)++;
+
       else if (VG_CLO_STREQ(arg, "-q") ||
                VG_CLO_STREQ(arg, "--quiet"))
          VG_(clo_verbosity)--;
 
-      else if (VG_CLO_STREQ(arg, "--error-limit=yes"))
-         VG_(clo_error_limit) = True;
-      else if (VG_CLO_STREQ(arg, "--error-limit=no"))
-         VG_(clo_error_limit) = False;
+      else VG_BOOL_CLO("--branchpred",       VG_(clo_branchpred))
+      else VG_BOOL_CLO("--chain-bb",         VG_(clo_chain_bb))
+      else VG_BOOL_CLO("--db-attach",        VG_(clo_db_attach))
+      else VG_BOOL_CLO("--demangle",         VG_(clo_demangle))
+      else VG_BOOL_CLO("--error-limit",      VG_(clo_error_limit))
+      else VG_BOOL_CLO("--gen-suppressions", VG_(clo_gen_suppressions))
+      else VG_BOOL_CLO("--lowlat-signals",   VG_(clo_lowlat_signals))
+      else VG_BOOL_CLO("--lowlat-syscalls",  VG_(clo_lowlat_syscalls))
+      else VG_BOOL_CLO("--optimise",         VG_(clo_optimise))
+      else VG_BOOL_CLO("--pointercheck",     VG_(clo_pointercheck))
+      else VG_BOOL_CLO("--profile",          VG_(clo_profile))
+      else VG_BOOL_CLO("--run-libc-freeres", VG_(clo_run_libc_freeres))
+      else VG_BOOL_CLO("--show-below-main",  VG_(clo_show_below_main))
+      else VG_BOOL_CLO("--single-step",      VG_(clo_single_step))
+      else VG_BOOL_CLO("--track-fds",        VG_(clo_track_fds))
+      else VG_BOOL_CLO("--trace-children",   VG_(clo_trace_children))
+      else VG_BOOL_CLO("--trace-sched",      VG_(clo_trace_sched))
+      else VG_BOOL_CLO("--trace-signals",    VG_(clo_trace_signals))
+      else VG_BOOL_CLO("--trace-symtab",     VG_(clo_trace_symtab))
+      else VG_BOOL_CLO("--trace-syscalls",   VG_(clo_trace_syscalls))
+      else VG_BOOL_CLO("--wait-for-gdb",     VG_(clo_wait_for_gdb))
 
-      else if (VG_CLO_STREQ(arg, "--db-attach=yes"))
-         VG_(clo_db_attach) = True;
-      else if (VG_CLO_STREQ(arg, "--db-attach=no"))
-         VG_(clo_db_attach) = False;
+      else VG_STR_CLO ("--db-command",        VG_(clo_db_command))
+      else VG_STR_CLO ("--weird-hacks",       VG_(clo_weird_hacks))
 
-      else if (VG_CLO_STREQN(13,arg, "--db-command="))
-         VG_(clo_db_command) = &arg[13];
-
-      else if (VG_CLO_STREQ(arg, "--gen-suppressions=yes"))
-         VG_(clo_gen_suppressions) = True;
-      else if (VG_CLO_STREQ(arg, "--gen-suppressions=no"))
-         VG_(clo_gen_suppressions) = False;
-
-      else if (VG_CLO_STREQ(arg, "--show-below-main=yes"))
-         VG_(clo_show_below_main) = True;
-      else if (VG_CLO_STREQ(arg, "--show-below-main=no"))
-         VG_(clo_show_below_main) = False;
-
-      else if (VG_CLO_STREQ(arg, "--pointercheck=yes"))
-         VG_(clo_pointercheck) = True;
-      else if (VG_CLO_STREQ(arg, "--pointercheck=no"))
-         VG_(clo_pointercheck) = False;
-
-      else if (VG_CLO_STREQ(arg, "--demangle=yes"))
-         VG_(clo_demangle) = True;
-      else if (VG_CLO_STREQ(arg, "--demangle=no"))
-         VG_(clo_demangle) = False;
-
-      else if (VG_CLO_STREQ(arg, "--trace-children=yes"))
-         VG_(clo_trace_children) = True;
-      else if (VG_CLO_STREQ(arg, "--trace-children=no"))
-         VG_(clo_trace_children) = False;
-
-      else if (VG_CLO_STREQ(arg, "--run-libc-freeres=yes"))
-         VG_(clo_run_libc_freeres) = True;
-      else if (VG_CLO_STREQ(arg, "--run-libc-freeres=no"))
-         VG_(clo_run_libc_freeres) = False;
-
-      else if (VG_CLO_STREQ(arg, "--track-fds=yes"))
-         VG_(clo_track_fds) = True;
-      else if (VG_CLO_STREQ(arg, "--track-fds=no"))
-         VG_(clo_track_fds) = False;
-
-      else if (VG_CLO_STREQN(15, arg, "--sanity-level="))
-         VG_(sanity_level) = (Int)VG_(atoll)(&arg[15]);
+      else VG_NUM_CLO ("--dump-error",        VG_(clo_dump_error))
+      else VG_NUM_CLO ("--input-fd",          VG_(clo_input_fd))
+      else VG_NUM_CLO ("--sanity-level",      VG_(clo_sanity_level))
+      else VG_NUM_CLO ("--signal­polltime",   VG_(clo_signal_polltime))
+      else VG_BNUM_CLO("--num-callers",       VG_(clo_backtrace_size), 1,
+                                                VG_DEEPEST_BACKTRACE)
 
       else if (VG_CLO_STREQN(13, arg, "--logfile-fd=")) {
          VG_(clo_log_to)       = VgLogTo_Fd;
@@ -1781,9 +1764,6 @@
          VG_(clo_logfile_name) = &arg[12];
       }
 
-      else if (VG_CLO_STREQN(11, arg, "--input-fd="))
-         VG_(clo_input_fd)     = (Int)VG_(atoll)(&arg[11]);
-
       else if (VG_CLO_STREQN(15, arg, "--suppressions=")) {
          if (VG_(clo_n_suppressions) >= VG_CLO_MAX_SFILES) {
             VG_(message)(Vg_UserMsg, "Too many suppression files specified.");
@@ -1794,30 +1774,6 @@
          VG_(clo_suppressions)[VG_(clo_n_suppressions)] = &arg[15];
          VG_(clo_n_suppressions)++;
       }
-      else if (VG_CLO_STREQ(arg, "--profile=yes"))
-         VG_(clo_profile) = True;
-      else if (VG_CLO_STREQ(arg, "--profile=no"))
-         VG_(clo_profile) = False;
-
-      else if (VG_CLO_STREQ(arg, "--chain-bb=yes"))
-	 VG_(clo_chain_bb) = True;
-      else if (VG_CLO_STREQ(arg, "--chain-bb=no"))
-	 VG_(clo_chain_bb) = False;
-
-      else if (VG_CLO_STREQ(arg, "--branchpred=yes"))
-	 VG_(clo_branchpred) = True;
-      else if (VG_CLO_STREQ(arg, "--branchpred=no"))
-	 VG_(clo_branchpred) = False;
-
-      else if (VG_CLO_STREQ(arg, "--single-step=yes"))
-         VG_(clo_single_step) = True;
-      else if (VG_CLO_STREQ(arg, "--single-step=no"))
-         VG_(clo_single_step) = False;
-
-      else if (VG_CLO_STREQ(arg, "--optimise=yes"))
-         VG_(clo_optimise) = True;
-      else if (VG_CLO_STREQ(arg, "--optimise=no"))
-         VG_(clo_optimise) = False;
 
       /* "vwxyz" --> 000zyxwv (binary) */
       else if (VG_CLO_STREQN(16, arg, "--trace-codegen=")) {
@@ -1840,26 +1796,6 @@
          }
       }
 
-      else if (VG_CLO_STREQ(arg, "--trace-syscalls=yes"))
-         VG_(clo_trace_syscalls) = True;
-      else if (VG_CLO_STREQ(arg, "--trace-syscalls=no"))
-         VG_(clo_trace_syscalls) = False;
-
-      else if (VG_CLO_STREQ(arg, "--trace-signals=yes"))
-         VG_(clo_trace_signals) = True;
-      else if (VG_CLO_STREQ(arg, "--trace-signals=no"))
-         VG_(clo_trace_signals) = False;
-
-      else if (VG_CLO_STREQ(arg, "--trace-symtab=yes"))
-         VG_(clo_trace_symtab) = True;
-      else if (VG_CLO_STREQ(arg, "--trace-symtab=no"))
-         VG_(clo_trace_symtab) = False;
-
-      else if (VG_CLO_STREQ(arg, "--trace-sched=yes"))
-         VG_(clo_trace_sched) = True;
-      else if (VG_CLO_STREQ(arg, "--trace-sched=no"))
-         VG_(clo_trace_sched) = False;
-
       else if (VG_CLO_STREQ(arg, "--trace-pthread=none"))
          VG_(clo_trace_pthread_level) = 0;
       else if (VG_CLO_STREQ(arg, "--trace-pthread=some"))
@@ -1867,45 +1803,14 @@
       else if (VG_CLO_STREQ(arg, "--trace-pthread=all"))
          VG_(clo_trace_pthread_level) = 2;
 
-      else if (VG_CLO_STREQN(14, arg, "--weird-hacks="))
-         VG_(clo_weird_hacks) = &arg[14];
-
-      else if (VG_CLO_STREQN(17, arg, "--signal-polltime="))
-	 VG_(clo_signal_polltime) = VG_(atoll)(&arg[17]);
-
-      else if (VG_CLO_STREQ(arg, "--lowlat-signals=yes"))
-	 VG_(clo_lowlat_signals) = True;
-      else if (VG_CLO_STREQ(arg, "--lowlat-signals=no"))
-	 VG_(clo_lowlat_signals) = False;
-
-      else if (VG_CLO_STREQ(arg, "--lowlat-syscalls=yes"))
-	 VG_(clo_lowlat_syscalls) = True;
-      else if (VG_CLO_STREQ(arg, "--lowlat-syscalls=no"))
-	 VG_(clo_lowlat_syscalls) = False;
-
-      else if (VG_CLO_STREQN(13, arg, "--dump-error="))
-         VG_(clo_dump_error) = (Int)VG_(atoll)(&arg[13]);
-
-      else if (VG_CLO_STREQ(arg, "--wait-for-gdb=yes"))
-	 VG_(clo_wait_for_gdb) = True;
-      else if (VG_CLO_STREQ(arg, "--wait-for-gdb=no"))
-	 VG_(clo_wait_for_gdb) = False;
-
-      else if (VG_CLO_STREQN(14, arg, "--num-callers=")) {
-         /* Make sure it's sane. */
-	 VG_(clo_backtrace_size) = (Int)VG_(atoll)(&arg[14]);
-         if (VG_(clo_backtrace_size) < 1)
-            VG_(clo_backtrace_size) = 1;
-         if (VG_(clo_backtrace_size) >= VG_DEEPEST_BACKTRACE)
-            VG_(clo_backtrace_size) = VG_DEEPEST_BACKTRACE;
-      }
-
       else if ( ! VG_(needs).command_line_options
              || ! SK_(process_cmd_line_option)(arg) ) {
          VG_(bad_option)(arg);
       }
    }
 
+   // Check various option values
+
    if (VG_(clo_verbosity) < 0)
       VG_(clo_verbosity) = 0;
 
@@ -2649,7 +2554,7 @@
 {
    VGP_PUSHCC(VgpCoreCheapSanity);
 
-   if (VG_(sanity_level) < 1) return;
+   if (VG_(clo_sanity_level) < 1) return;
 
    /* --- First do all the tests that we can do quickly. ---*/
 
@@ -2669,8 +2574,8 @@
 
    /* Once every 25 times, check some more expensive stuff. */
    if ( force_expensive
-     || VG_(sanity_level) > 1
-     || (VG_(sanity_level) == 1 && (VG_(sanity_fast_count) % 25) == 0)) {
+     || VG_(clo_sanity_level) > 1
+     || (VG_(clo_sanity_level) == 1 && (VG_(sanity_fast_count) % 25) == 0)) {
 
       VGP_PUSHCC(VgpCoreExpensiveSanity);
       VG_(sanity_slow_count)++;
@@ -2695,7 +2600,7 @@
       VGP_POPCC(VgpCoreExpensiveSanity);
    }
 
-   if (VG_(sanity_level) > 1) {
+   if (VG_(clo_sanity_level) > 1) {
       VGP_PUSHCC(VgpCoreExpensiveSanity);
       /* Check sanity of the low-level memory manager.  Note that bugs
          in the client's code can cause this to fail, so we don't do
diff --git a/coregrind/vg_malloc2.c b/coregrind/vg_malloc2.c
index aadc406..a7b1981 100644
--- a/coregrind/vg_malloc2.c
+++ b/coregrind/vg_malloc2.c
@@ -66,16 +66,8 @@
       }
    }
 
-   else if (VG_CLO_STREQ(arg, "--sloppy-malloc=yes"))
-      VG_(clo_sloppy_malloc) = True;
-   else if (VG_CLO_STREQ(arg, "--sloppy-malloc=no"))
-      VG_(clo_sloppy_malloc) = False;
-
-   else if (VG_CLO_STREQ(arg, "--trace-malloc=yes"))
-      VG_(clo_trace_malloc) = True;
-   else if (VG_CLO_STREQ(arg, "--trace-malloc=no"))
-      VG_(clo_trace_malloc) = False;
-
+   else VG_BOOL_CLO("--sloppy-malloc=yes", VG_(clo_sloppy_malloc))
+   else VG_BOOL_CLO("--trace-malloc=yes",  VG_(clo_trace_malloc))
    else 
       return False;
 
diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c
index 4334b58..cedde2e 100644
--- a/helgrind/hg_main.c
+++ b/helgrind/hg_main.c
@@ -3342,61 +3342,21 @@
    hg_malloc_list = VG_(HT_construct)();
 }
 
-static Bool match_Bool(Char *arg, Char *argstr, Bool *ret)
-{
-   Int len = VG_(strlen)(argstr);
-
-   if (VG_(strncmp)(arg, argstr, len) == 0) {
-      if (VG_(strcmp)(arg+len, "yes") == 0) {
-	 *ret = True;
-	 return True;
-      } else if (VG_(strcmp)(arg+len, "no") == 0) {
-	 *ret = False;
-	 return True;
-      } else
-	 VG_(bad_option)(arg);
-   }
-   return False;
-}
-
-static Bool match_str(Char *arg, Char *argstr, Char **ret)
-{
-   Int len = VG_(strlen)(argstr);
-
-   if (VG_(strncmp)(arg, argstr, len) == 0) {
-      *ret = VG_(strdup)(arg+len);
-      return True;
-   }
-
-   return False;
-}
-
 Bool SK_(process_cmd_line_option)(Char* arg)
 {
-   Char *str;
+   if      (VG_CLO_STREQ(arg, "--show-last-access=no"))
+      clo_execontext = EC_None;
+   else if (VG_CLO_STREQ(arg, "--show-last-access=some"))
+      clo_execontext = EC_Some;
+   else if (VG_CLO_STREQ(arg, "--show-last-access=all"))
+      clo_execontext = EC_All;
 
-   if (match_str(arg, "--show-last-access=", &str)) {
-      Bool ok = True;
-      if (VG_(strcmp)(str, "no") == 0)
-	 clo_execontext = EC_None;
-      else if (VG_(strcmp)(str, "some") == 0)
-	 clo_execontext = EC_Some;
-      else if (VG_(strcmp)(str, "all") == 0)
-	 clo_execontext = EC_All;
-      else {
-	 ok = False;
-	 VG_(bad_option)(arg);
-      }
+   else VG_BOOL_CLO("--private-stacks", clo_priv_stacks)
 
-      VG_(free)(str);
-      if (ok)
-	 return True;
-   }
+   else 
+      return VG_(replacement_malloc_process_cmd_line_option)(arg);
 
-   if (match_Bool(arg, "--private-stacks=", &clo_priv_stacks))
-      return True;
-
-   return VG_(replacement_malloc_process_cmd_line_option)(arg);
+   return True;
 }
 
 void SK_(print_usage)(void)
diff --git a/include/vg_skin.h.base b/include/vg_skin.h.base
index 71bca4a..5454e7d 100644
--- a/include/vg_skin.h.base
+++ b/include/vg_skin.h.base
@@ -172,8 +172,33 @@
 
 /* Use these for recognising skin command line options -- stops comparing
    once whitespace is reached. */
-#  define VG_CLO_STREQ(s1,s2)     (0==VG_(strcmp_ws)((s1),(s2)))
-#  define VG_CLO_STREQN(nn,s1,s2) (0==VG_(strncmp_ws)((s1),(s2),(nn)))
+#define VG_CLO_STREQ(s1,s2)     (0==VG_(strcmp_ws)((s1),(s2)))
+#define VG_CLO_STREQN(nn,s1,s2) (0==VG_(strncmp_ws)((s1),(s2),(nn)))
+
+// Higher-level command-line option recognisers;  use in if/else chains
+
+#define VG_BOOL_CLO(qq_option, qq_var) \
+   if (VG_CLO_STREQ(arg, qq_option"=yes")) { (qq_var) = True; } \
+   else if (VG_CLO_STREQ(arg, qq_option"=no"))  { (qq_var) = False; }
+
+#define VG_STR_CLO(qq_option, qq_var) \
+   if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, arg, qq_option"=")) { \
+      (qq_var) = &arg[ VG_(strlen)(qq_option)+1 ]; \
+   }
+
+#define VG_NUM_CLO(qq_option, qq_var) \
+   if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, arg, qq_option"=")) { \
+      (qq_var) = (Int)VG_(atoll)( &arg[ VG_(strlen)(qq_option)+1 ] ); \
+   }
+
+// Bounded integer arg
+#define VG_BNUM_CLO(qq_option, qq_var, qq_lo, qq_hi) \
+   if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, arg, qq_option"=")) { \
+      (qq_var) = (Int)VG_(atoll)( &arg[ VG_(strlen)(qq_option)+1 ] ); \
+      if ((qq_var) < (qq_lo)) (qq_var) = (qq_lo); \
+      if ((qq_var) > (qq_hi)) (qq_var) = (qq_hi); \
+   }
+
 
 /* Verbosity level: 0 = silent, 1 (default), > 1 = more verbose. */
 extern Int   VG_(clo_verbosity);
diff --git a/massif/ms_main.c b/massif/ms_main.c
index a0165cd..584da10 100644
--- a/massif/ms_main.c
+++ b/massif/ms_main.c
@@ -290,30 +290,11 @@
 
 Bool SK_(process_cmd_line_option)(Char* arg)
 {
-   if      (VG_CLO_STREQ(arg, "--heap=yes"))
-      clo_heap = True;
-   else if (VG_CLO_STREQ(arg, "--heap=no"))
-      clo_heap = False;
+        VG_BOOL_CLO("--heap",       clo_heap)
+   else VG_BOOL_CLO("--stacks",     clo_stacks)
 
-   else if (VG_CLO_STREQN(13, arg, "--heap-admin=")) {
-      clo_heap_admin = (Int)VG_(atoll)(&arg[13]);
-      if (clo_heap_admin > 100) {
-         VG_(message)(Vg_UserMsg,
-            "Admin size for heap blocks too large");
-         VG_(bad_option)(arg);
-      }
-   }
-
-   else if (VG_CLO_STREQ(arg, "--stacks=yes"))
-      clo_stacks = True;
-   else if (VG_CLO_STREQ(arg, "--stacks=no"))
-      clo_stacks = False;
-
-   else if (VG_CLO_STREQN(8, arg, "--depth=")) {
-      clo_depth = (Int)VG_(atoll)(&arg[8]);
-      if (clo_depth < 1)          clo_depth = 1;
-      if (clo_depth >= MAX_DEPTH) clo_depth = MAX_DEPTH;
-   }
+   else VG_NUM_CLO ("--heap-admin",  clo_heap_admin)
+   else VG_BNUM_CLO("--depth",       clo_depth, 1, MAX_DEPTH)
 
    else if (VG_CLO_STREQN(11, arg, "--alloc-fn=")) {
       alloc_fns[n_alloc_fns] = & arg[11];
@@ -331,7 +312,7 @@
 
    else
       return VG_(replacement_malloc_process_cmd_line_option)(arg);
-   
+
    return True;
 }
 
diff --git a/memcheck/mac_needs.c b/memcheck/mac_needs.c
index 3c7c616..29772a2 100644
--- a/memcheck/mac_needs.c
+++ b/memcheck/mac_needs.c
@@ -56,37 +56,19 @@
 
 Bool MAC_(process_common_cmd_line_option)(Char* arg)
 {
-   if      (VG_CLO_STREQ(arg, "--partial-loads-ok=yes"))
-      MAC_(clo_partial_loads_ok) = True;
-   else if (VG_CLO_STREQ(arg, "--partial-loads-ok=no"))
-      MAC_(clo_partial_loads_ok) = False;
-
-   else if (VG_CLO_STREQN(15, arg, "--freelist-vol=")) {
-      MAC_(clo_freelist_vol) = (Int)VG_(atoll)(&arg[15]);
-      if (MAC_(clo_freelist_vol) < 0) MAC_(clo_freelist_vol) = 0;
-   }
-
-   else if (VG_CLO_STREQ(arg, "--leak-check=yes"))
-      MAC_(clo_leak_check) = True;
-   else if (VG_CLO_STREQ(arg, "--leak-check=no"))
-      MAC_(clo_leak_check) = False;
-
+        VG_BOOL_CLO("--leak-check",            MAC_(clo_leak_check))
+   else VG_BOOL_CLO("--partial-loads-ok",      MAC_(clo_partial_loads_ok))
+   else VG_BOOL_CLO("--show-reachable",        MAC_(clo_show_reachable))
+   else VG_BOOL_CLO("--workaround-gcc296-bugs",MAC_(clo_workaround_gcc296_bugs))
+   
+   else VG_BNUM_CLO("--freelist-vol",  MAC_(clo_freelist_vol), 0, 1000000000)
+   
    else if (VG_CLO_STREQ(arg, "--leak-resolution=low"))
       MAC_(clo_leak_resolution) = Vg_LowRes;
    else if (VG_CLO_STREQ(arg, "--leak-resolution=med"))
       MAC_(clo_leak_resolution) = Vg_MedRes;
    else if (VG_CLO_STREQ(arg, "--leak-resolution=high"))
       MAC_(clo_leak_resolution) = Vg_HighRes;
-   
-   else if (VG_CLO_STREQ(arg, "--show-reachable=yes"))
-      MAC_(clo_show_reachable) = True;
-   else if (VG_CLO_STREQ(arg, "--show-reachable=no"))
-      MAC_(clo_show_reachable) = False;
-
-   else if (VG_CLO_STREQ(arg, "--workaround-gcc296-bugs=yes"))
-      MAC_(clo_workaround_gcc296_bugs) = True;
-   else if (VG_CLO_STREQ(arg, "--workaround-gcc296-bugs=no"))
-      MAC_(clo_workaround_gcc296_bugs) = False;
 
    else
       return VG_(replacement_malloc_process_cmd_line_option)(arg);
diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c
index 6d800de..4497b32 100644
--- a/memcheck/mc_main.c
+++ b/memcheck/mc_main.c
@@ -1601,16 +1601,8 @@
 
 Bool SK_(process_cmd_line_option)(Char* arg)
 {
-   if (VG_CLO_STREQ(arg, "--avoid-strlen-errors=yes"))
-      MC_(clo_avoid_strlen_errors) = True;
-   else if (VG_CLO_STREQ(arg, "--avoid-strlen-errors=no"))
-      MC_(clo_avoid_strlen_errors) = False;
-
-   else if (VG_CLO_STREQ(arg, "--cleanup=yes"))
-      MC_(clo_cleanup) = True;
-   else if (VG_CLO_STREQ(arg, "--cleanup=no"))
-      MC_(clo_cleanup) = False;
-
+        VG_BOOL_CLO("--avoid-strlen-errors", MC_(clo_avoid_strlen_errors))
+   else VG_BOOL_CLO("--cleanup",             MC_(clo_cleanup))
    else
       return MAC_(process_common_cmd_line_option)(arg);