From ffe25d65b4ac1ee955807fa1c1f395796feb34a9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrg=20Billeter?= Date: Sat, 26 Sep 2009 14:32:50 +0200 Subject: [PATCH] valac: Add --disable-warnings command-line option --- compiler/valacompiler.vala | 3 +++ vala/valareport.vala | 6 ++++++ 2 files changed, 9 insertions(+) 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); -- 2.47.3