From: Jiří Janoušek Date: Sun, 25 Nov 2018 14:00:34 +0000 (+0100) Subject: valadoc: Add --fatal-warnings command line option X-Git-Tag: 0.43.1~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0c0a0ee097ed8968f77cf7b1548e916b7acd8d8;p=thirdparty%2Fvala.git valadoc: Add --fatal-warnings command line option To be able to treat warnings as fatal. --- diff --git a/doc/valadoc.1 b/doc/valadoc.1 index accbf3a85..965c2a469 100644 --- a/doc/valadoc.1 +++ b/doc/valadoc.1 @@ -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 diff --git a/valadoc/valadoc.vala b/valadoc/valadoc.vala index 7e74a187b..d05da55d6 100644 --- a/valadoc/valadoc.vala +++ b/valadoc/valadoc.vala @@ -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 {