This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
warn-as-error
- From: Chris Dean <ctdean at sokitomi dot com>
- From: Chris Dean <ctdean at mercedsystems dot com>
- To: Kawa List <kawa at sources dot redhat dot com>
- Date: Tue, 27 Jul 2004 23:01:53 -0700
- Subject: warn-as-error
Add the --warn-as-error option. This treats a compilation warning as
if it were an error and halts compilation. If folks could double
check that I've caught all the warnings, I would appreciate it.
Patch below.
Regards,
Chris Dean
Index: doc/ChangeLog
===================================================================
RCS file: /cvs/kawa/kawa/doc/ChangeLog,v
retrieving revision 1.121
diff -u -w -r1.121 ChangeLog
--- doc/ChangeLog 27 Jul 2004 17:32:52 -0000 1.121
+++ doc/ChangeLog 28 Jul 2004 05:59:31 -0000
@@ -1,3 +1,7 @@
+2004-07-27 Chris Dean <ctdean@sokitomi.com>
+
+ * kawa.texi (Compilation options): add --warn-as-error
+
2004-07-27 Per Bothner <per@bothner.com>
* internals.xml (Procedures): Major re-working - still unfinished.
Index: doc/kawa.texi
===================================================================
RCS file: /cvs/kawa/kawa/doc/kawa.texi,v
retrieving revision 1.149
diff -u -w -r1.149 kawa.texi
--- doc/kawa.texi 27 Jun 2004 19:47:36 -0000 1.149
+++ doc/kawa.texi 28 Jul 2004 05:59:32 -0000
@@ -1040,6 +1040,8 @@
This is useful for catching typos.
(A @code{define-variable} form can be used to silence warnings.
It declares to the compiler that a variable is to be resolved dynamically.)
+@item --warn-as-error
+Treat a compilation warning as if it were an error and halt compilation.
@end table
An option can be followed by a value, as
Index: gnu/expr/ChangeLog
===================================================================
RCS file: /cvs/kawa/kawa/gnu/expr/ChangeLog,v
retrieving revision 1.313
diff -u -w -r1.313 ChangeLog
--- gnu/expr/ChangeLog 20 Jul 2004 23:30:18 -0000 1.313
+++ gnu/expr/ChangeLog 28 Jul 2004 05:59:32 -0000
@@ -1,3 +1,8 @@
+2004-07-27 Chris Dean <ctdean@sokitomi.com>
+
+ * Compilation.java: add --warn-as-error
+ * ExpWalker.java (ExpWalker): check --warn-as-error
+
2004-07-20 Per Bothner <per@bothner.com>
* ApplyExp.java: Use static syntax to access static fields/methods.
Index: gnu/expr/Compilation.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/expr/Compilation.java,v
retrieving revision 1.108
diff -u -w -r1.108 Compilation.java
--- gnu/expr/Compilation.java 20 Jul 2004 23:30:18 -0000 1.108
+++ gnu/expr/Compilation.java 28 Jul 2004 05:59:32 -0000
@@ -41,6 +41,8 @@
"warn if no compiler-visible binding for a variable");
options.add("warn-invoke-unknown-method", Options.BOOLEAN_OPTION,
"warn if invoke calls an unknown method");
+ options.add("warn-as-error", Options.BOOLEAN_OPTION,
+ "Make all warnings into errors");
}
/** Get a named boolean option. */
@@ -1886,12 +1888,18 @@
public void error(char severity, String message)
{
+ if (severity == 'w' && getBooleanOption("warn-as-error", false))
+ severity = 'e';
+
messages.error(severity, getFile(), getLine(), getColumn(),
message);
}
public void error(char severity, Declaration decl, String msg1, String msg2)
{
+ if (severity == 'w' && getBooleanOption("warn-as-error", false))
+ severity = 'e';
+
String filename = getFile();
int line = getLine();
int column = getColumn();
Index: gnu/expr/ExpWalker.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/expr/ExpWalker.java,v
retrieving revision 1.14
diff -u -w -r1.14 ExpWalker.java
--- gnu/expr/ExpWalker.java 12 Feb 2004 17:45:23 -0000 1.14
+++ gnu/expr/ExpWalker.java 28 Jul 2004 05:59:32 -0000
@@ -146,6 +146,8 @@
public void error(char kind, String message)
{
+ if (kind == 'w' && comp.getBooleanOption("warn-as-error", false))
+ kind = 'e';
if (messages != null)
messages.error(kind, message);
else