added -w to suppress warnings
authoradam <adam@megacz.com>
Mon, 27 Dec 2004 04:42:44 +0000 (04:42 +0000)
committeradam <adam@megacz.com>
Mon, 27 Dec 2004 04:42:44 +0000 (04:42 +0000)
darcs-hash:20041227044244-5007d-eb9695ea92511cc66e930b00b4e1e1960fe77b44.gz

src/org/ibex/tool/Compiler.java

index cbee466..b802c9e 100644 (file)
@@ -27,7 +27,7 @@ public class Compiler {
     // Static Entry Point /////////////////////////////////////////////////////
 
     public static void main(String[] args) throws IOException {
-        boolean verbose = false, veryverbose = false;
+        boolean verbose = false, veryverbose = false, warnings = true;
         List srcdir = new ArrayList();
         String source = null, target = null, blddir = null, mainclass = null;
        boolean buildjar = false;
@@ -60,6 +60,11 @@ public class Compiler {
                             System.out.println("Missing parameter: "+args[i]); return; }
                         mainclass = args[++i];
                         break;
+                    case 'w':
+                        if (i == args.length - 1) {
+                            System.out.println("Missing parameter: "+args[i]); return; }
+                       warnings = false;
+                        break;
                     case 's':
                         if (i == args.length - 1) {
                             System.out.println("Missing parameter: "+args[i]); return; }
@@ -97,6 +102,7 @@ public class Compiler {
         c.setSourceDirs(s);
 
         c.setVerbose(verbose);
+        c.setWarnings(warnings);
         c.setVeryVerbose(veryverbose);
         c.compile();
     }
@@ -135,6 +141,7 @@ public class Compiler {
     private boolean hasErrors;
     private boolean verbose = false;
     private boolean veryverbose = false;
+    private boolean warnings = true;
 
     public Compiler() {
         List defs = Collections.EMPTY_LIST;
@@ -168,6 +175,7 @@ public class Compiler {
 
     public void setVerbose(boolean v) { verbose = v; }
     public void setVeryVerbose(boolean v) { veryverbose = v; }
+    public void setWarnings(boolean w) { warnings = w; }
 
     public void compile() throws IOException {
         List s = new ArrayList();
@@ -209,7 +217,7 @@ public class Compiler {
                 env, policy, settings, results, problems);
         jdt.compile(units);
 
-        if (!hasErrors) { out.write(w.toString()); out.flush(); }
+        if (warnings && !hasErrors) { out.write(w.toString()); out.flush(); }
         warn = null;
        try {
            if (jarfile != null) jarfile.close();