This is an automated email from the git hooks/post-receive script. ebourg-guest pushed a commit to branch master in repository ecj.
commit 77d682ef478b6947e2bd7d7e2bfbd2b2750286b1 Author: Matthias Klose <[email protected]> Date: Sat Feb 3 14:16:47 2007 +0100 Import Debian changes 3.2.1-6 ecj-bootstrap (3.2.1-6) unstable; urgency=low * Fix PR java/30585 (-Werror and -Wall not working). Taken from the rhug repository. --- debian/changelog | 7 +++ .../jdt/internal/compiler/batch/GCCMain.java | 55 +++++++++++++++++++++- 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index d442fa3..bf985ae 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +ecj-bootstrap (3.2.1-6) unstable; urgency=low + + * Fix PR java/30585 (-Werror and -Wall not working). Taken from the rhug + repository. + + -- Matthias Klose <[email protected]> Sat, 3 Feb 2007 14:16:47 +0100 + ecj-bootstrap (3.2.1-5) unstable; urgency=low * debian/control: Call it a "standalone" version, not a "bootstrap" diff --git a/src/org.eclipse.jdt.core/org/eclipse/jdt/internal/compiler/batch/GCCMain.java b/src/org.eclipse.jdt.core/org/eclipse/jdt/internal/compiler/batch/GCCMain.java index 7ee15de..4dbb799 100644 --- a/src/org.eclipse.jdt.core/org/eclipse/jdt/internal/compiler/batch/GCCMain.java +++ b/src/org.eclipse.jdt.core/org/eclipse/jdt/internal/compiler/batch/GCCMain.java @@ -231,6 +231,20 @@ public class GCCMain extends Main { super.handleWarningToken(token, isEnabling, useEnableJavadoc); } + private void turnWarningsToErrors() { + Object[] entries = this.options.entrySet().toArray(); + for (int i = 0, max = entries.length; i < max; i++) { + Map.Entry entry = (Map.Entry) entries[i]; + if (!(entry.getKey() instanceof String)) + continue; + if (!(entry.getValue() instanceof String)) + continue; + if (((String) entry.getValue()).equals(CompilerOptions.WARNING)) { + this.options.put(entry.getKey(), CompilerOptions.ERROR); + } + } + } + /** * Set the debug level to the indicated value. The level should be * between 0 and 2, inclusive, but this is not checked. @@ -269,6 +283,30 @@ public class GCCMain extends Main { } } + private void handleWall(boolean enable) throws InvalidInputException { + // A somewhat arbitrary list. We use the GCC names + // here, and the local handleWarningToken translates + // for us. + handleWarningToken("constructor-name", enable, false); + handleWarningToken("pkg-default-method", enable, false); + handleWarningToken("masked-catch-block", enable, false); + handleWarningToken("all-deprecation", enable, false); + handleWarningToken("unused-local", enable, false); + handleWarningToken("unused-label", enable, false); + handleWarningToken("static-receiver", enable, false); + handleWarningToken("indirect-static", enable, false); + handleWarningToken("no-effect-assign", enable, false); + handleWarningToken("char-concat", enable, false); + handleWarningToken("useless-type-check", enable, false); + handleWarningToken("final-bound", enable, false); + handleWarningToken("assert-identifier", enable, false); + handleWarningToken("enum-identifier", enable, false); + handleWarningToken("finally", enable, false); + handleWarningToken("varargs-cast", enable, false); + handleWarningToken("unused", enable, false); + handleWarningToken("forbidden", enable, false); + } + public void configure(String[] argv) throws InvalidInputException { if ((argv == null) || (argv.length == 0)) { // This is a "can't happen". @@ -279,6 +317,8 @@ public class GCCMain extends Main { ArrayList otherFiles = new ArrayList(); String classpath = null; boolean haveFileList = false; + boolean inhibitAllWarnings = false; + boolean treatWarningsAsErrors = false; for (int i = 0; i < argv.length; ++i) { String currentArg = argv[i]; @@ -329,12 +369,20 @@ public class GCCMain extends Main { // Handle -g1 but also things like -gstabs. setDebugLevel(1); } + } else if (currentArg.equals("-Werror")) { //$NON-NLS-1$ + treatWarningsAsErrors = true; + } else if (currentArg.equals("-Wno-error")) { //$NON-NLS-1$ + treatWarningsAsErrors = false; + } else if (currentArg.equals("-Wall")) { //$NON-NLS-1$ + handleWall(true); + } else if (currentArg.equals("-Wno-all")) { //$NON-NLS-1$ + handleWall(false); } else if (currentArg.startsWith("-Wno-")) { //$NON-NLS-1$ handleWarningToken(currentArg.substring(5), false, false); } else if (currentArg.startsWith("-W")) { //$NON-NLS-1$ handleWarningToken(currentArg.substring(2), true, false); } else if (currentArg.equals("-w")) { //$NON-NLS-1$ - disableWarnings(); + inhibitAllWarnings = true; } else if (currentArg.startsWith("-O")) { //$NON-NLS-1$ // Ignore. } else if (currentArg.equals("-v")) { //$NON-NLS-1$ @@ -408,6 +456,11 @@ public class GCCMain extends Main { fail(err); } + if (inhibitAllWarnings) + disableWarnings(); + if (treatWarningsAsErrors) + turnWarningsToErrors(); + this.checkedClasspaths = new FileSystem.Classpath[result.size()]; result.toArray(this.checkedClasspaths); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/ecj.git _______________________________________________ pkg-java-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

