]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
valadoc: Add --fatal-warnings command line option b0c0a0ee097ed8968f77cf7b1548e916b7acd8d8
authorJiří Janoušek <janousek.jiri@gmail.com>
Sun, 25 Nov 2018 14:00:34 +0000 (15:00 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 25 Nov 2018 16:25:48 +0000 (17:25 +0100)
To be able to treat warnings as fatal.

doc/valadoc.1
valadoc/valadoc.vala

index accbf3a8549b088b6c535cdee372c844b0b3732b..965c2a4697499b469e07527b420de142cef662e8 100644 (file)
@@ -98,6 +98,9 @@ Display version number
 \fB\-\-force\fR
 force
 .TP
+\fB\-\-fatal\-warnings\fR
+Treat warnings as fatal
+.TP
 \fB\-\-verbose\fR
 Show all warnings
 .TP
index 7e74a187b6f8a6208d17bf0f5deb7e8af57eea62..d05da55d6dcdd570427adf68824ce8ccae4a7a9c 100644 (file)
@@ -49,6 +49,7 @@ public class ValaDoc : Object {
        private static bool disable_diagnostic_colors = false;
        private static bool verbose = false;
        private static bool force = false;
+       private static bool fatal_warnings = false;
 
        private static string basedir = null;
        [CCode (array_length = false, array_null_terminated = true)]
@@ -114,6 +115,7 @@ public class ValaDoc : Object {
                { "version", 0, 0, OptionArg.NONE, ref version, "Display version number", null },
 
                { "force", 0, 0, OptionArg.NONE, ref force, "force", null },
+               { "fatal-warnings", 0, 0, OptionArg.NONE, ref fatal_warnings, "Treat warnings as fatal", null },
                { "verbose", 0, 0, OptionArg.NONE, ref verbose, "Show all warnings", null },
                { "no-color", 0, 0, OptionArg.NONE, ref disable_diagnostic_colors, "Disable colored output", null },
                { "target-glib", 0, 0, OptionArg.STRING, ref target_glib, "Target version of glib for code generation", "MAJOR.MINOR" },
@@ -123,7 +125,7 @@ public class ValaDoc : Object {
        };
 
        private static int quit (ErrorReporter reporter) {
-               if (reporter.errors == 0) {
+               if (reporter.errors == 0 && (!fatal_warnings || reporter.warnings == 0)) {
                        stdout.printf ("Succeeded - %d warning(s)\n", reporter.warnings);
                        return 0;
                } else {