shithub: mc

Download patch

ref: 217a65d3c047bcdec44155f2688e3b1bdfd2414f
parent: 7088e222cf1b0ae17607ce0ac232067a172b851e
author: Ori Bernstein <[email protected]>
date: Tue Oct 7 16:48:11 EDT 2014

Add '-c' (extracheck) option to mc

    To enable flaky checks. Checks guarded by this will eventually
    get enabled by default.

--- a/6/asm.h
+++ b/6/asm.h
@@ -187,6 +187,9 @@
 
 extern char *modenames[];
 
+/* options */
+extern int extracheck;
+
 /* entry points */
 void genblob(FILE *fd, Node *blob, Htab *globls, Htab *strtab);
 void genasm(FILE *fd, Func *fn, Htab *globls, Htab *strtab);
--- a/6/main.c
+++ b/6/main.c
@@ -22,6 +22,7 @@
 Node *file;
 char debugopt[128];
 int writeasm;
+int extracheck;
 char *outfile;
 char **incpaths;
 size_t nincpaths;
@@ -30,6 +31,7 @@
 {
     printf("%s [-h] [-o outfile] [-d[dbgopts]] inputs\n", prog);
     printf("\t-h\tPrint this help\n");
+    printf("\t-c\tEnable additional (possibly flaky) checking\n");
     printf("\t-S\tWrite out `input.s` when compiling\n");
     printf("\t-I path\tAdd 'path' to use search path\n");
     printf("\t-d\tPrint debug dumps. Recognized options: f r p i\n");
@@ -138,6 +140,8 @@
                 usage(argv[0]);
                 exit(0);
                 break;
+            case 'c':
+                extracheck = 1;
             case 'd':
                 while (ctx.optarg && *ctx.optarg)
                     debugopt[*ctx.optarg++ & 0x7f]++;
--- a/6/simp.c
+++ b/6/simp.c
@@ -1748,7 +1748,7 @@
     }
 
     cfg = mkcfg(dcl, s->stmts, s->nstmts);
-    if (debugopt['C'])
+    if (extracheck)
        check(cfg);
     if (debugopt['t'] || debugopt['s'])
         dumpcfg(cfg, stdout);