From: Jürg Billeter Date: Sat, 26 Sep 2009 12:32:50 +0000 (+0200) Subject: valac: Add --disable-warnings command-line option X-Git-Tag: 0.7.7~31 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ffe25d65b4ac1ee955807fa1c1f395796feb34a9;p=thirdparty%2Fvala.git valac: Add --disable-warnings command-line option --- diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala index 3d7108429..2b32f9dad 100644 --- a/compiler/valacompiler.vala +++ b/compiler/valacompiler.vala @@ -56,6 +56,7 @@ class Vala.Compiler { static bool experimental; static bool non_null_experimental; static bool disable_dbus_transformation; + static bool disable_warnings; static string cc_command; [CCode (array_length = false, array_null_terminated = true)] [NoArrayLength] @@ -97,6 +98,7 @@ class Vala.Compiler { { "enable-checking", 0, 0, OptionArg.NONE, ref enable_checking, "Enable additional run-time checks", null }, { "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 }, { "enable-non-null-experimental", 0, 0, OptionArg.NONE, ref non_null_experimental, "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" }, @@ -186,6 +188,7 @@ class Vala.Compiler { context.experimental = experimental; context.non_null_experimental = non_null_experimental; context.dbus_transformation = !disable_dbus_transformation; + context.report.enable_warnings = !disable_warnings; context.report.set_verbose_errors (!quiet_mode); context.verbose_mode = verbose_mode; diff --git a/vala/valareport.vala b/vala/valareport.vala index 0e839a3c9..22d689d41 100644 --- a/vala/valareport.vala +++ b/vala/valareport.vala @@ -31,6 +31,8 @@ public class Vala.Report : Object { bool verbose_errors; + public bool enable_warnings { get; set; default = true; } + /** * Set the error verbosity. */ @@ -97,6 +99,10 @@ public class Vala.Report : Object { * @param message warning message */ public virtual void warn (SourceReference? source, string message) { + if (!enable_warnings) { + return; + } + warnings++; if (source == null) { stderr.printf ("warning: %s\n", message);