]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
valac: Add --fatal-warnings option
authorEvan Nemerson <evan@coeus-group.com>
Fri, 20 Aug 2010 14:58:18 +0000 (16:58 +0200)
committerJürg Billeter <j@bitron.ch>
Sat, 21 Aug 2010 08:46:49 +0000 (10:46 +0200)
Fixes bug 615708.

compiler/valacompiler.vala
doc/valac.1

index 9826682f9390c31bd1242c86c89b7b777ae4c4b3..4c52866c80f35c522041825594a34a38244ed84c 100644 (file)
@@ -72,6 +72,7 @@ class Vala.Compiler {
        static bool nostdpkg;
        static bool enable_version_header;
        static bool disable_version_header;
+       static bool fatal_warnings;
 
        static string entry_point;
 
@@ -109,6 +110,7 @@ class Vala.Compiler {
                { "enable-deprecated", 0, 0, OptionArg.NONE, ref deprecated, "Enable deprecated features", null },
                { "enable-experimental", 0, 0, OptionArg.NONE, ref experimental, "Enable experimental features", null },
                { "disable-warnings", 0, 0, OptionArg.NONE, ref disable_warnings, "Disable warnings", null },
+               { "fatal-warnings", 0, 0, OptionArg.NONE, ref fatal_warnings, "Treat warnings as fatal", null },
                { "enable-experimental-non-null", 0, 0, OptionArg.NONE, ref experimental_non_null, "Enable experimental enhancements for non-null types", null },
                { "disable-dbus-transformation", 0, 0, OptionArg.NONE, ref disable_dbus_transformation, "Disable transformation of D-Bus member names", null },
                { "cc", 0, 0, OptionArg.STRING, ref cc_command, "Use COMMAND as C compiler command", "COMMAND" },
@@ -129,7 +131,7 @@ class Vala.Compiler {
                if (context.report.get_errors () == 0 && context.report.get_warnings () == 0) {
                        return 0;
                }
-               if (context.report.get_errors () == 0) {
+               if (context.report.get_errors () == 0 && (!fatal_warnings || context.report.get_warnings () == 0)) {
                        if (!quiet_mode) {
                                stdout.printf ("Compilation succeeded - %d warning(s)\n", context.report.get_warnings ());
                        }
@@ -325,7 +327,7 @@ class Vala.Compiler {
                        packages = null;
                }
                
-               if (context.report.get_errors () > 0) {
+               if (context.report.get_errors () > 0 || (fatal_warnings && context.report.get_warnings () > 0)) {
                        return quit ();
                }
 
@@ -388,7 +390,7 @@ class Vala.Compiler {
                }
                sources = null;
                
-               if (context.report.get_errors () > 0) {
+               if (context.report.get_errors () > 0 || (fatal_warnings && context.report.get_warnings () > 0)) {
                        return quit ();
                }
                
@@ -407,14 +409,14 @@ class Vala.Compiler {
                        }
                }
 
-               if (context.report.get_errors () > 0) {
+               if (context.report.get_errors () > 0 || (fatal_warnings && context.report.get_warnings () > 0)) {
                        return quit ();
                }
                
                var resolver = new SymbolResolver ();
                resolver.resolve (context);
                
-               if (context.report.get_errors () > 0) {
+               if (context.report.get_errors () > 0 || (fatal_warnings && context.report.get_warnings () > 0)) {
                        return quit ();
                }
 
@@ -433,20 +435,20 @@ class Vala.Compiler {
                        code_writer.write_file (context, dump_tree);
                }
 
-               if (context.report.get_errors () > 0) {
+               if (context.report.get_errors () > 0 || (fatal_warnings && context.report.get_warnings () > 0)) {
                        return quit ();
                }
 
                var flow_analyzer = new FlowAnalyzer ();
                flow_analyzer.analyze (context);
 
-               if (context.report.get_errors () > 0) {
+               if (context.report.get_errors () > 0 || (fatal_warnings && context.report.get_warnings () > 0)) {
                        return quit ();
                }
 
                context.codegen.emit (context);
 
-               if (context.report.get_errors () > 0) {
+               if (context.report.get_errors () > 0 || (fatal_warnings && context.report.get_warnings () > 0)) {
                        return quit ();
                }
 
index 5ee2556aa225fac23775374ea9867c19405519d8..aa0e2629bdc5edf5eaf497053c4f6f7edef0042f 100644 (file)
@@ -105,6 +105,9 @@ Enable experimental features
 .B \--disable-warnings
 Disable warnings
 .TP
+.B \--fatal-warnings
+Treat warnings as fatal
+.TP
 .B \--enable-experimental-non-null
 Enable experimental enhancements for non-null types
 .TP